Skip to content

Keybindings

robin edited this page Mar 6, 2024 · 57 revisions

The default leader key is <Space>.

  • mode:
    • N -> Normal mode
    • I -> Insert mode
    • V -> Visual mode
  • <C-p> means pressing <Ctrl> and p simultaneously.
  • <A-d> means pressing <Alt> and d simultaneously.
  • <leader>ps means pressing <leader> then p then s.

For macOS users, please refer to this issue to make Alt key work.

  • Chinese
Effect Mode Shortcut
打开类似vscode的panel(包括key map) N <C-p>
同步插件 N <leader>ps
清除插件 N <leader>px
检查插件更新 N <leader>pc
触发nvim-tree N <C-n>
刷新nvim-tree N <leader>nr
触发撤销列表 N <leader>u
终端
触发垂直命令行终端 N <A-\>/<F5>
触发水平命令行终端 N <C-\>
触发悬浮命令行终端 N <A-d>
离开命令行终端 I <C-d>
缓存导航
pick buffer n(nmeans No) N <A-n>
right buffer N <A-j>
left buffer N <A-k>
move current buffer to right N <A-S-j>
move current buffer to left N <A-S-k>
关闭当前缓存 N <A-q>
关闭当前窗口 N <A-S-q>
split buffer vertically N <C-w>v
split buffer horizontally N <C-w>s
navigate down N <C-j>
navigate up N <C-k>
navigate left N <C-h>
navigate right N <C-l>
Operaions in nvim-tree <C-n>
创建新文件 N a
移除文件/目录名 N d
重命名文件/目录名 N r
打开当前目录 N o/Enter
关闭当前目录 N o/Backspace
拷贝文件名 N y
拷贝相对路径 N Y
拷贝绝对路径 N gy
toggle file/directory begin with dot N H
toggle hidden file/directory configured in nvim-tree N I
Window operation
垂直方向减少 5pixel N A-[
垂直方向增加 5pixel N A-]
Telescope Operations
在最近打开过的文件中查找 N <leader>fr
在当前项目中查找关键字 N <leader>fw
在当前项目找文件 N <leader>ff
在打开的缓存文件中我查找找缓存文件 N <leader>fb
search for the string under cursor in cwd N <leader>fs
search for recorded sessions N <leader>fd
在历史中查找文件 N <leader>fe
find directory recorded by zoxide N <leader>fz
查找项目 N <leader>fp
Vanilla vim operations
escape insert mode I jk
[fold current]/[unfold collapsed] block I <S-Tab>
Lsp operations by lspsaga.nvim
show code action N ga
预览定义 N gd
跳转定义 N gD
触发tagbar(outline) N go
lsp rename in current file N gr
rename in current project N gR
show signature help N gs
show current function/variable's definition or references N gh
request incoming calls from the language server N <leader>ci
request outgoing calls from the language server N <leader>co
show hover doc N K
code diagnostics of the current line N <leader>ld
Lsp operations bytrouble.nvim
toggle last diagnostics N gt
toggle lsp references N <leader>tr
toggle lsp document diagnostics N <leader>td
toggle lsp workspace diagnostics N <leader>tw
toggle code quickfix N <leader>tq
toggle code loclist N <leader>tl
Code completion
next candidate I <Tab>/<C-n>
prev candidate I <S-Tab>/<C-p>
confirm candidate I <Enter>
close completion window I <C-w>
Navigate in snippet
next snippet's block I <Tab>
prev snippet's block I <S-Tab>
Navigate in quote or bracket
jump to quote end I <A-l>
back to quote begin I <A-h>
Code selection
select current () block N vab
select current {} block N vaB
select current outer function block N vaf
select current outer class block N vac
select current inner function block N vif
select current inner class block N vic
Code-snip Run
Snip run for selected area V <leader>r
Snip run for whole file N <leader>r
Cursor movement
jump to one line N <leader>j/<leader>k
find one word N <leader>w
find one character N <leader>c
find two characters below cursor N <leader>cc
find one characterx in front of cursor N Fx
find one characterx behind cursor N fx
find next characterx follow direction N ;
find prev characterx follow direction N ,
next function begin N ][
prev function begin N [[
next function end N ]]
prev function end N []
next unstage git hunk N ]g
prev unstage git hunk N [g
next code diagnostics N g]
prev code diagnostics N g[
正常模式左/下/右/上移动[num]行 N [num] h/j/k/l
Code comment
toggle one line's comment N gcc
toggle selected lines' comment V gc
Markdown preview
触发MarkDown预览 N <F12>
Session management
保存当前会话 N <leader>ss
Load the session for the current dir (and git branch) N <leader>sl
Delete the current session N <leader>sd
Debug mode(supports c&cpp&rust&golang&python now)
Evaluate the expression under cursor/selection N/V K
Debug continue(run) N F6
Debug disconnect N F7
Debug toggle breakpoint N F8
Debug step into N F9
Debug step out N F10
Debug step over N F11
Debug run last N <leader>dl
Debug run to cursor N <leader>dc
Debug set breakpoint with condition N <leader>db
Debug set breakpoint with condition N <leader>db
Git management
open lazygit in current directory N <leader>g
Enter vim-fugitive N <leader>G
Enter git diff view N <leader>D
Close git diff view N <leader><leader>D
Stage hunk N/V <leader>hs
Reset hunk N/V <leader>hr
Undo stage hunk N <leader>hu
Reset buffer N <leader>hR
Preview hunk N <leader>hp
Blame hunk N <leader>hb
crates.io support (Only available in Cargo.toml)
Toggle spec activities N <leader>ct
Reload crate specs N <leader>cr
Toggle pop-up window N <leader>cs
Select spec versions N <leader>cv
Select spec features N <leader>cf
Show project dependencies N <leader>cd
Update current crate's spec N <leader>cu
Update selected crate's spec V <leader>cu
Update all crates' specs N <leader>ca
Upgrade current crate N <leader>cU
Upgrade selected crates V <leader>cU
Upgrade all crates N <leader>cA
Open current crate's homepage N <leader>cH
Open current crate's repository N <leader>cR
Open current crate's documentation N <leader>cD
Browse current crate on crates.io N <leader>cC
  • English
Effect Mode Shortcut
open vscode-like command panel N <C-p>
sync plugins N <leader>ps
clean plugins N <leader>px
check plugins update N <leader>pc
toggle nvim-tree N <C-n>
refresh nvim-tree N <leader>nr
toggle undotree N <leader>u
Terminal
toggle vertical terminal N <A-\>/<F5>
toggle horizontal terminal N <C-\>
toggle floating terminal N <A-d>
quit terminal I <C-d>
Buffer navigation
pick buffer n(nmeans No) N <A-n>
right buffer N <A-j>
left buffer N <A-k>
move current buffer to right N <A-S-j>
move current buffer to left N <A-S-k>
close current buffer N <A-q>
close current window N <A-S-q>
split buffer vertically N <C-w>v
split buffer horizontally N <C-w>s
navigate down N <C-j>
navigate up N <C-k>
navigate left N <C-h>
navigate right N <C-l>
Operaions in nvim-tree
new file N a
remove file/directory N d
rename file/directory N r
open directory N o/Enter
close directory N o/Backspace
copy filename N y
copy relative path N Y
copy absolute path N gy
toggle file/directory begin with dot N H
toggle hidden file/directory configured in nvim-tree N I
Telescope Operations
find file in recently opened N <leader>fr
find keyword in current project N <leader>fw
find file in current project N <leader>ff
find buffer in opened buffers N <leader>fb
search for the string under cursor in cwd N <leader>fs
search for recorded sessions N <leader>fd
find file in history N <leader>fe
find directory recorded by zoxide N <leader>fz
find project N <leader>fp
toggle symbols outline in Telescope N gto
Vanilla vim operations
escape insert mode I jk
[fold current]/[unfold collapsed] block I <S-Tab>
Lsp operations by lspsaga.nvim
show code action N ga
preview definition N gd
jump to definition N gD
toggle tagbar (outline) N go
lsp rename in current file N gr
rename in current project N gR
show signature help N gs
show current function/variable's definition or references N gh
request incoming calls from the language server N gci
request outgoing calls from the language server N gco
show hover doc N K
code diagnostics of the current line N <leader>lx
Lsp operations bytrouble.nvim
toggle last diagnostics N gt
toggle lsp references N <leader>ll
toggle lsp document diagnostics N <leader>ld
toggle lsp workspace diagnostics N <leader>lw
toggle code quickfix N <leader>lq
toggle code loclist N <leader>lL
Code completion
next candidate I <Tab>/<C-n>
prev candidate I <S-Tab>/<C-p>
confirm candidate I <Enter>
close completion window I <C-w>
Navigate in snippet
next snippet's block I <Tab>
prev snippet's block I <S-Tab>
Navigate in quote or bracket
jump to quote end I <A-l>
back to quote begin I <A-h>
Code selection
select current () block N vab
select current {} block N vaB
select current outer function block N vaf
select current outer class block N vac
select current inner function block N vif
select current inner class block N vic
Code-snip Run
Snip run for selected area V <leader>r
Snip run for whole file N <leader>r
Cursor movement
jump to one line N <leader>j/<leader>k
find one word N <leader>w
find one character N <leader>c
find two characters below cursor N <leader>C
find one characterx in front of cursor N Fx
find one characterx behind cursor N fx
find next characterx follow direction N ;
find prev characterx follow direction N ,
next function begin N ][
prev function begin N [[
next function end N ]]
prev function end N []
next unstage git hunk N ]g
prev unstage git hunk N [g
next code diagnostics N g]
prev code diagnostics N g[
Code comment
toggle one line's comment N gcc
toggle selected lines' comment V gc
Markdown preview
toggle MarkdownPreView N <F12>
Session management
Save the current session N <leader>ss
Load the session for the current dir (and git branch) N <leader>sl
Delete the current session N <leader>sd
Debug mode(supports c&cpp&rust&golang&python now)
Evaluate the expression under cursor/selection N/V K
Debug continue(run) N F6
Debug disconnect N F7
Debug toggle breakpoint N F8
Debug step into N F9
Debug step out N F10
Debug step over N F11
Debug run last N <leader>dl
Debug run to cursor N <leader>dc
Debug set breakpoint with condition N <leader>db
Debug set breakpoint with condition N <leader>db
Git management
open lazygit in current directory N <leader>gg
Enter vim-fugitive N <leader>gG
Enter git diff view N <leader>gd
Close git diff view N <leader>gD
Stage hunk N/V <leader>gs
Reset hunk N/V <leader>gr
Undo stage hunk N <leader>gu
Reset buffer N <leader>gR
Preview hunk N <leader>gp
Blame hunk N <leader>gb
crates.io support (Only available in Cargo.toml)
Toggle spec activities N <leader>ct
Reload crate specs N <leader>cr
Toggle pop-up window N <leader>cs
Select spec versions N <leader>cv
Select spec features N <leader>cf
Show project dependencies N <leader>cd
Update current crate's spec N <leader>cu
Update selected crate's spec V <leader>cu
Update all crates' specs N <leader>ca
Upgrade current crate N <leader>cU
Upgrade selected crates V <leader>cU
Upgrade all crates N <leader>cA
Open current crate's homepage N <leader>cH
Open current crate's repository N <leader>cR
Open current crate's documentation N <leader>cD
Browse current crate on crates.io N <leader>cC

You can see more keybindings in lua/core/mapping.lua and lua/keymap/init.lua.

Note:

  1. Put your cursor begin of the begin quote or bracket then press <A-l> you will jump to the end of the end quote or bracket.
  2. Put your cursor end of the end quote or bracket then press <A-h> you will jump to the begin of the begin quote or bracket.

Clone this wiki locally