Post

Personal Desktop Keybindings

Personal Desktop Keybindings

Table of Contents

  1. Hyprland Keybindings
  2. Neovim Keybindings
  3. Fish Shell Aliases and Functions

Hyprland Keybindings

My Hyprland setup has 4 workspaces on the main screen and 1 workspace on the side screen. This layout helps me stay focused on the main screen while keeping the side screen available for dedicated tasks.

Main modifier key: SUPER

Terminal & Apps

  • SUPER + f → Open terminal (uwsm app -- $terminal)
  • SUPER + m → Open terminal with clipse class and run clipse
  • SUPER + g → Launch rofi app launcher with icons
  • SUPER + SHIFT + g → Run rofi-next-empty-ws.sh script

The rofi-next-empty-ws.sh script iterates through all workspaces and switches to the first empty one (a workspace with no open windows). This allows you to launch new applications on a clean workspace automatically, keeping your workflow organized and avoiding clutter.

System Utilities

  • SUPER + SHIFT + m → Lock screen (hyprlock)
  • SUPER + i → Open color picker (hyprpicker)
  • SUPER + o → Take screenshot of a region (hyprshot)

Window Management

  • SUPER + d → Kill active window
  • SUPER + n → Toggle fullscreen for active window
  • SUPER + q → Exit Hyprland
  • SUPER + h → Toggle split mode on active window

Window Navigation

  • SUPER + j → Move focus left
  • SUPER + ; (semicolon) → Move focus right
  • SUPER + l → Move focus up
  • SUPER + k → Move focus down

Workspace Switching

  • SUPER + e → Switch to workspace 1
  • SUPER + r → Switch to workspace 2
  • SUPER + t → Switch to workspace 3
  • SUPER + y → Switch to workspace 4
  • SUPER + u → Switch to workspace 5

Move Active Window to Workspace

  • SUPER + SHIFT + e → Move window to workspace 1
  • SUPER + SHIFT + r → Move window to workspace 2
  • SUPER + SHIFT + t → Move window to workspace 3
  • SUPER + SHIFT + y → Move window to workspace 4
  • SUPER + SHIFT + u → Move window to workspace 5

Resize Active Window

  • SUPER + SHIFT + j → Resize active window by -15px horizontally
  • SUPER + SHIFT + ; (semicolon) → Resize active window by +15px horizontally
  • SUPER + SHIFT + l → Resize active window by -15px vertically
  • SUPER + SHIFT + k → Resize active window by +15px vertically

Move Active Window Around

  • SUPER + ALT + j → Move window left
  • SUPER + ALT + ; (semicolon) → Move window right
  • SUPER + ALT + l → Move window up
  • SUPER + ALT + k → Move window down

Neovim Keybindings

Plugins

LSP and Diagnostics (must)

  • <leader>lgD → Go to declaration
  • <leader>lgd → Go to definition
  • <leader>lgr → List references
  • <leader>ln → Rename symbol
  • <C-o> → Go back to the previous location in jump list (e.g. after a definition jump)
  • <C-i> → Go forward in the jump list (opposite of <C-o>)

  • <leader>la → Code action
  • <leader>lgt → Go to type
  • <leader>lS → List document symbols
  • <leader>lgi → List implementations
  • <leader>lwl → List workspace folders
  • <leader>lws → List workspace symbols
  • <leader>lgn → Go to next diagnostic
  • <leader>lgp → Go to previous diagnostic
  • <leader>le → Open diagnostic float
  • K → Show hover information, including the function signature (when cursor is on the function name)
  • <leader>ls → Show signature help while typing function parameters (e.g. when cursor is inside the parentheses functionName(|))

nvim-treesitter-textobjects

  • if/af → Inner/around function selection
  • ic/ac → Inner/around class selection
  • ia/aa → Inner/around parameter selection
  • ii/ai → Inner/around conditional block selection
  • il/al → Inner/around loop selection
  • i./a. → Inner/around function call selection
  • i'/a' → Inner/around code block selection

    Must be used with operators like y (yank), d (delete), c (change), or v (visual mode)

  • ]m/[m → Go to next/previous function start
  • ]M/[M → Go to next/previous function end
  • ]]/[[ → Go to next/previous class start
  • ][/[] → Go to next/previous class end

    Can be used with operators as mentioned above

  • <CR> → Confirm the selected completion item
  • <Tab> → Select next item in the completion menu
  • <S-Tab> → Select previous item in the completion menu
  • <C-e> → Close the completion menu
  • <C-Space> → Trigger completion manually

Harpoon

  • <C-j> → Jump to file 1
  • <C-k> → Jump to file 2
  • <C-l> → Jump to file 3
  • <C-;> → Jump to file 4
  • <C-h> → List marked files
  • <C-m> → Mark current file

Telescope

  • <leader>ff → Find files in current directory
  • <leader>fG → Live grep in current directory
  • <leader>fp → Find projects
  • <leader>fg → Find files in git repository

Todo Comments

  • <leader>th → Show all todo comments in Telescope
  • <leader>tj → Show fix-related comments (FIX, FIXME, BUG)
  • <leader>tk → Show note-related comments (NOTE, INFO)
  • <leader>tl → Show hack-related comments (HACK)
  • <leader>t; → Show only TODO comments

Neogen (Documentation Generator)

  • <leader>nd → Generate general documentation
  • <leader>nf → Generate function documentation
  • <leader>nc → Generate class documentation

Comment-nvim

  • <C-c> → Toggle comment for current line in normal mode
  • <C-c> → Toggle comment for selected lines in visual mode
  • <C-v> → Toggle comment for current block in normal mode
  • <C-v> → Toggle comment for selected block in visual mode

Copilot

  • <C-j> → Accept Copilot suggestion
  • <C-;> → Accept single word from Copilot suggestion
  • <C-CR> (Ctrl + Enter) → Accept entire line from Copilot suggestion
  • <C-x> → Dismiss Copilot suggestion
  • <C-k> → Next Copilot suggestion
  • <C-l> → Previous Copilot suggestion
  • <leader>ap → Open Copilot panel
  • <CR> (Enter) → Accept suggestion in Copilot panel
  • <C-n> → Jump to next suggestion in Copilot panel
  • <C-m> → Jump to previous suggestion in Copilot panel

nvim-surround

  • ys{motion}{char} → Surround text object with character (e.g., ysiw" surrounds word with quotes)
  • yss{char} → Surround entire line with character
  • ds{char} → Delete surrounding characters (e.g., ds" removes surrounding quotes)
  • cs{target}{replacement} → Change surrounding characters (e.g., cs"' changes “ to ‘)
  • S{char} → In visual mode, surround selection with character

    Use with text objects (w: word, s: sentence, p: paragraph) or motions

Utility

  • <leader>q → Quit current buffer/window

Diffview

  • <leader>dh → Open current file history
  • <leader>dj → Open file history for every file in the repo
  • <leader>d; → Close Diffview
  • <leader>dk → Navigate to next hunk/change
  • <leader>dl → Navigate to previous hunk/change
  • <leader>df → Switch between windows (hop between changes)

Debugging (nvim-dap)

  • <F5> → Continue/Start debugging
  • <F10> → Step over
  • <F11> → Step into
  • <F12> → Step out
  • <leader>db → Toggle breakpoint
  • <leader>dB → Set conditional breakpoint

ThePrimeagen-inspired Keybindings

Text Movement and Manipulation

  • <leader>p (Visual mode) → Paste over selection without copying the deleted text
  • <leader>d (Normal mode) → Delete without saving to register
  • <leader>d (Visual mode) → Delete selection without saving to register

File Operations

  • <leader>x (Normal mode) → Make current file executable (chmod +x)

Basic

Modes

  • i → Enter Insert mode at cursor position
  • I → Enter Insert mode at beginning of line
  • a → Enter Insert mode after cursor
  • A → Enter Insert mode at end of line
  • o → Insert new line below and enter Insert mode
  • O → Insert new line above and enter Insert mode
  • v → Enter Visual mode (character selection)
  • V → Enter Visual Line mode (line selection)
  • R → Enter Replace mode
  • Esc → Return to Normal mode
  • : → Enter Command mode
  • q: → Open command history window
  • q/ or q? → Open search history window

Normal Mode Navigation

Basic Movement

  • j → Move cursor left
  • k → Move cursor down
  • l → Move cursor up
  • ; → Move cursor right

Word Navigation

  • w → Move to start of next word
  • W → Move to start of next WORD (space-separated)
  • e → Move to end of current/next word
  • E → Move to end of current/next WORD
  • b → Move to beginning of current/previous word
  • B → Move to beginning of current/previous WORD
  • ge → Move to end of previous word
  • gE → Move to end of previous WORD

Line Navigation

  • 0 → Move to start of line (first column)
  • ^ → Move to first non-blank character of line
  • $ → Move to end of line
  • g_ → Move to last non-blank character of line
  • {n}| → Move to column n (prefix with number)
  • f{char} → Move to next occurrence of character {char} on current line
  • F{char} → Move to previous occurrence of character {char} on current line
  • t{char} → Move to before next occurrence of character {char} on current line
  • T{char} → Move to after previous occurrence of character {char} on current line
  • h → Repeat last f, F, t, or T movement (NOTE: modified from ;)
  • , → Repeat last f, F, t, or T movement in opposite direction

Document Navigation

  • gg → Go to first line of document
  • G → Go to last line of document
  • {number}G or :{number} → Go to line {number}
  • Ctrl + o → Jump to previous location in jump list
  • Ctrl + i → Jump to next location in jump list
  • H → Move to top of screen (High)
  • M → Move to middle of screen (Middle)
  • L → Move to bottom of screen (Low)
  • zz → Center current line on screen
  • zt → Position current line at top of screen
  • zb → Position current line at bottom of screen

Scrolling

  • Ctrl + f → Scroll forward one full screen
  • Ctrl + b → Scroll backward one full screen
  • Ctrl + d → Scroll down half a screen
  • Ctrl + u → Scroll up half a screen
  • Ctrl + e → Scroll down one line
  • Ctrl + y → Scroll up one line

Paragraph and Section Navigation

  • } → Move to next paragraph/code block
  • { → Move to previous paragraph/code block
  • ]] → Move to next section
  • [[ → Move to previous section
  • ][ → Move to end of section
  • [] → Move to end of previous section

Marks

  • m{a-zA-Z} → Set mark at current position
  • '{a-zA-Z} → Jump to line of mark
  • ```{a-zA-Z}` → Jump to position of mark
  • '' → Jump to position before last jump
  • ` `` ` → Jump to position before last jump
  • '. → Jump to position of last change
  • `. → Jump to position of last change
  • :marks → List all marks

Pattern Searching

  • /{pattern} → Search forward for pattern
  • ?{pattern} → Search backward for pattern
  • n → Repeat last search in same direction
  • N → Repeat last search in opposite direction
  • * → Search forward for word under cursor
  • # → Search backward for word under cursor
  • g* → Search forward for partial word under cursor
  • g# → Search backward for partial word under cursor
  • gd → Go to local declaration of word under cursor
  • gD → Go to global declaration of word under cursor

Text Objects

d, c, and y commands can be used with text objects to delete, change, or yank text within specific structures. Here are some common text objects:

  • iw → Inner word (word without spaces)
  • aw → A word (word with spaces)
  • is → Inner sentence
  • as → A sentence
  • ip → Inner paragraph
  • ap → A paragraph
  • i( or i) → Inside parentheses
  • a( or a) → Around parentheses
  • i{ or i} → Inside curly braces
  • a{ or a} → Around curly braces
  • i[ or i] → Inside square brackets
  • a[ or a] → Around square brackets
  • i< or i> → Inside angle brackets
  • a< or a> → Around angle brackets
  • i" → Inside double quotes
  • a" → Around double quotes
  • i' → Inside single quotes
  • a' → Around single quotes
  • i` → Inside backticks
  • a` → Around backticks
  • it → Inside tags (HTML/XML)
  • at → Around tags (HTML/XML)

Editing in Normal Mode

Basic Editing

  • x → Delete character under cursor
  • X → Delete character before cursor
  • r{char} → Replace character under cursor with {char}
  • ~ → Switch case of character under cursor
  • J → Join current line with next line
  • gJ → Join current line with next line without space
  • >> → Indent current line
  • << → Unindent current line

Deletion Commands

  • d{motion} → Delete text covered by motion
  • dd → Delete current line
  • D → Delete from cursor to end of line
  • {number}dd → Delete {number} lines
  • {number}d{motion} → Delete {number} of motion (e.g. 3dw - delete 3 words)
  • dw → Delete from cursor to start of next word
  • diw → Delete inner word (word without spaces)
  • daw → Delete a word (word with spaces)
  • d0 → Delete from cursor to start of line
  • d^ → Delete from cursor to first non-blank character of line
  • d$ or D → Delete from cursor to end of line
  • dG → Delete from current line to end of file
  • dgg → Delete from current line to start of file
  • di{ → Delete text inside curly braces
  • da{ → Delete text including curly braces
  • di( → Delete text inside parentheses
  • da( → Delete text including parentheses
  • di[ → Delete text inside square brackets
  • da[ → Delete text including square brackets
  • di" → Delete text inside double quotes
  • da" → Delete text including double quotes
  • di' → Delete text inside single quotes
  • da' → Delete text including single quotes

Changing Commands (Delete and Enter Insert Mode)

  • c{motion} → Change text covered by motion
  • cc → Change current line
  • C → Change from cursor to end of line
  • {number}cc → Change {number} lines
  • cw → Change from cursor to start of next word
  • ciw → Change inner word (word without spaces)
  • caw → Change a word (word with spaces)
  • c0 → Change from cursor to start of line
  • c^ → Change from cursor to first non-blank character of line
  • c$ or C → Change from cursor to end of line
  • ci{ → Change text inside curly braces
  • ca{ → Change text including curly braces
  • ci( → Change text inside parentheses
  • ca( → Change text including parentheses
  • ci[ → Change text inside square brackets
  • ca[ → Change text including square brackets
  • ci" → Change text inside double quotes
  • ca" → Change text including double quotes
  • ci' → Change text inside single quotes
  • ca' → Change text including single quotes

Yanking (Copying) Commands

  • y{motion} → Yank text covered by motion
  • yy or Y → Yank current line
  • {number}yy → Yank {number} lines
  • yw → Yank from cursor to start of next word
  • yiw → Yank inner word (word without spaces)
  • yaw → Yank a word (word with spaces)
  • y0 → Yank from cursor to start of line
  • y^ → Yank from cursor to first non-blank character of line
  • y$ → Yank from cursor to end of line
  • yi{ → Yank text inside curly braces
  • ya{ → Yank text including curly braces
  • yi( → Yank text inside parentheses
  • ya( → Yank text including parentheses
  • yi[ → Yank text inside square brackets
  • ya[ → Yank text including square brackets
  • yi" → Yank text inside double quotes
  • ya" → Yank text including double quotes
  • yi' → Yank text inside single quotes
  • ya' → Yank text including single quotes

Putting (Pasting) Commands

  • p → Put after cursor
  • P → Put before cursor
  • ]p → Put after cursor and align with current line
  • [p → Put before cursor and align with current line
  • gp → Put after cursor and move cursor to end of pasted text
  • gP → Put before cursor and move cursor to end of pasted text

Undo and Redo

  • u → Undo last change
  • U → Undo all changes on current line
  • Ctrl + r → Redo last undone change

Repeating

  • . → Repeat last change
  • {number}. → Repeat last change {number} times
  • @: → Repeat last command
  • @@ → Repeat last macro
  • {number}@{a-z} → Execute macro {a-z} {number} times

Text Case Manipulation

  • ~ → Toggle case of character under cursor and move to next character
  • g~{motion} → Toggle case of text covered by motion
  • g~iw → Toggle case of current word
  • g~$ → Toggle case from cursor to end of line
  • g~~ → Toggle case of current line
  • gU{motion} → Make text covered by motion uppercase
  • gUiw → Make current word uppercase
  • gU$ → Make text from cursor to end of line uppercase
  • gUU → Make current line uppercase
  • gu{motion} → Make text covered by motion lowercase
  • guiw → Make current word lowercase
  • gu$ → Make text from cursor to end of line lowercase
  • guu → Make current line lowercase

Insert Mode

  • Esc → Exit Insert mode
  • Ctrl + o → Execute one Normal mode command, then return to Insert mode
  • Ctrl + t → Indent line
  • Ctrl + d → Unindent line
  • Ctrl + h → Delete character before cursor (like Backspace)
  • Ctrl + w → Delete word before cursor
  • Ctrl + u → Delete all characters before cursor in current line
  • Ctrl + m → Insert line break (same as Enter)
  • Ctrl + n → Insert next match of word before cursor (autocomplete)
  • Ctrl + p → Insert previous match of word before cursor (autocomplete)
  • Ctrl + r {register} → Insert content of {register}
  • Ctrl + r = → Insert result of expression (calculator)
  • Ctrl + x Ctrl + l → Insert whole line (completion)
  • Ctrl + x Ctrl + f → Insert filename (completion)
  • Ctrl + x Ctrl + o → Insert language-aware completion (omnicomplete)
  • Ctrl + v {char} → Insert character literally
  • Ctrl + v {code} → Insert character by decimal code
  • Ctrl + v u{hex} → Insert Unicode character by hex code
  • Ctrl + k {char1} {char2} → Insert digraph (special character)

Visual Mode

  • v → Start Visual mode (character-wise)
  • V → Start Visual Line mode
  • Ctrl + v → Start Visual Block mode
  • o → Move to other end of selection
  • O → Move to other corner of block
  • aw → Select a word
  • ab → Select a block with ()
  • aB → Select a block with {}
  • at → Select a block with tags
  • iw → Select inner word
  • ib → Select inner block with ()
  • iB → Select inner block with {}
  • it → Select inner block with tags
  • Esc or Ctrl + [ → Exit Visual mode
  • > → Shift right
  • < → Shift left
  • y → Yank (copy) selection
  • d → Delete selection
  • c → Change selection (delete and enter Insert mode)
  • ~ → Toggle case
  • u → Make lowercase
  • U → Make uppercase
  • J → Join selected lines
  • r{char} → Replace all selected characters with {char}
  • gq → Format selected text
  • : → Enter Command mode for selected range
  • Ctrl + a → Increment number in selection
  • Ctrl + x → Decrement number in selection
  • I → Insert text at start of each line in block (Visual Block mode)
  • A → Insert text at end of each line in block (Visual Block mode)
  • $ → Move to end of line for all lines in selection (Visual Block mode)

File Operations

  • :w → Write (save) file
  • :w {file} → Write to {file}
  • :w! {file} → Overwrite {file}
  • :wq or :x or ZZ → Write and quit
  • :q → Quit
  • :q! or ZQ → Quit without saving
  • :wqa → Write all buffers and quit
  • :qa → Quit all buffers
  • :qa! → Quit all buffers without saving

Search and Replace Flag Behavior

Without the g Flag:

  • :%s/old/new → Replace only the first occurrence of “old” with “new” on each line
  • :s/old/new → Replace only the first occurrence of “old” on the current line
  • :%s/old/new/c → Replace the first occurrence on each line with confirmation

With the g Flag (global):

  • :%s/old/new/g → Replace all occurrences of “old” with “new” in the entire file
  • :s/old/new/g → Replace all occurrences on the current line
  • :%s/old/new/gc → Replace all occurrences with confirmation

Other Useful Flags:

  • i → Case-insensitive matching (:s/old/new/i)
  • I → Case-sensitive matching (explicitly override ‘ignorecase’ setting)
  • c → Confirm each replacement
  • e → Suppress error messages (useful in scripts)
  • n → Count matches without replacing

Fish Shell Aliases and Functions

Aliases

  • nssudo nixos-rebuild switch --flake .#desktop
  • rebootsystemctl reboot

  • ..cd ..
  • ...cd ../..
  • .3cd ../../..
  • .4cd ../../../..
  • .5cd ../../../../..

  • lseza -al --color=always --group-directories-first
  • laeza -a --color=always --group-directories-first
  • lleza -l --color=always --group-directories-first
  • lteza -T --color=always --group-directories-first --ignore-glob=".git/*"
  • l.eza -al --color=always --group-directories-first ../
  • l..eza -al --color=always --group-directories-first ../../
  • l...eza -al --color=always --group-directories-first ../../../

  • dfdf -h
  • grepgrep --color=auto
  • cclear
  • catbat

  • gagit add
  • gaagit add --all
  • gaugit add -u
  • gcgit commit -m
  • gclgit clone
  • gcogit checkout
  • gbgit branch
  • gfgit fetch
  • gpgit push origin
  • gplgit pull origin
  • gtgit tag
  • gtagit tag -a
  • gsgit status

  • jctljournalctl -p 3 -xb

Functions

  • __history_previous_command: Handles !! to replace it with the last command in history.
  • __history_previous_command_arguments: Handles !$ to replace it with the arguments of the last command.

  • __my-ctrl-k: On Ctrl+k, moves down in history or paging mode.
  • __my-ctrl-l: On Ctrl+l, moves up in history or paging mode.

  • fj: Finds and jumps to a directory using fd and fzf with an interactive selector.
  • fk: Selects and kills a process using fzf with an interactive process list.
  • fl: Finds and opens a file in your default editor using fd and fzf.
  • fh: Searches and executes a command from your shell history using fzf.
This post is licensed under CC BY 4.0 by the author.