bash <(curl -fsSL https://raw.githubusercontent.com/frog-game/Ubuntu20.04-nvim/master/install.sh)
zsh
https://www.bilibili.com/video/BV1se4y1x7op/?vd_source=eda9685c1fd919172e56a90b8eb7b69e
https://www.bilibili.com/video/BV1vv4y1U7gT/?vd_source=eda9685c1fd919172e56a90b8eb7b69e
tmux
gdb
- Leader key set as,
Key | Mode | Action |
---|---|---|
,+fn | nnoremap |
nnoremap <leader>fn :Telescope notify |
Key | Mode | Action |
---|---|---|
ga | xmap,nmap |
Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign)Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) |
Key | Mode | Action |
---|---|---|
,+S | nnoremap |
nnoremap <leader>S lua require('spectre').open() |
,+sw | vnoremap |
search current word nnoremap <leader>sw lua require('spectre').open_visual({select_word=true}) |
,+s | vnoremap |
search current word vnoremap <leader>s lua require('spectre').open_visual() |
,+sp | nnoremap |
search in current file nnoremap <leader>sp viw:lua require('spectre').open_file_search() |
Key | Mode | Action |
---|---|---|
M-o |
nnoremap |
nnoremap <M-o> :RnvimrToggletnoremap <M-o> <C->:RnvimrToggle |
M-i |
tnoremap |
Resize floating window by all preset layouts tnoremap <M-i> <C->:RnvimrResize |
M-l |
tnoremap |
Resize floating window by special preset layouts tnoremap <M-l> <C->:RnvimrResize 1,8,9,11,5 |
M-y |
tnoremap |
Resize floating window by single preset layout tnoremap <M-y> <C->:RnvimrResize 6 |
Key | Mode | Action |
---|---|---|
,+ff | nnoremap |
nnoremap <leader>ff ':Telescope find_files cwd='.FindRootDirectory().'/' |
,+fg | nnoremap |
nnoremap <leader>fg lua require'telescope.builtin'.live_grep() |
,+f? | nnoremap |
nnoremap <leader>f? lua require'telescope.builtin'.help_tags() |
,+fh | nnoremap |
nnoremap <leader>fh lua require'telescope.builtin'.oldfiles() |
,+fb | nnoremap |
nnoremap <leader>fb lua require'telescope.builtin'.marks() |
,+fe | nnoremap |
nnoremap <leader>fe lua require 'telescope'.extensions.file_browser.file_browser() |
,+fp | nnoremap |
nnoremap <leader>fp lua require'telescope'.extensions.project.project{} |
,+fr | nnoremap |
nnoremap <leader>fr lua require'telescope'.extensions.frecency.frecency() |
,+fm | nnoremap |
nnoremap <leader>fm lua require'telescope'.extensions.media_files.media_files() |
,+fn | nnoremap |
nnoremap<leader>fn lua require'telescope'.extensions.notify.notify() |
,+fde | nnoremap |
nnoremap <leader>fde lua require'telescope'.extensions.dap.commands() |
,+fdc | nnoremap |
nnoremap <leader>fdc lua require'telescope'.extensions.dap.configurations() |
,+fdb | nnoremap |
nnoremap <leader>fdb lua require'telescope'.extensions.dap.list_breakpoints() |
,+fdv | nnoremap |
nnoremap <leader>fdv lua require'telescope'.extensions.dap.variables()> |
,+fdf | nnoremap |
nnoremap <leader>fdf lua require'telescope'.extensions.dap.frames() |
Key | Mode | Action |
---|---|---|
C-n | nmap,imap |
[""] = actions.cycle_history_next, |
C-p | nmap,imap |
[""] = actions.cycle_history_prev, |
C-j | nmap,imap |
[""] = actions.move_selection_next, |
C-k | nmap,imap |
[""] = actions.move_selection_previous, |
C-d | nmap,imap |
[""] = actions.close, |
Down | nmap,imap |
[""] = actions.move_selection_next, |
Up | nmap,imap |
[""] = actions.move_selection_previous, |
CR | nmap,imap |
[""] = actions.select_default, |
Up | nmap,imap |
[""] = actions.move_selection_previous, |
C-s | nmap,imap |
[""] = actions.select_horizontal, |
C-t | nmap,imap |
[""] = actions.select_tab, |
PageUp | nmap,imap |
[""] = actions.results_scrolling_up, |
PageDown | nmap,imap |
[""] = actions.results_scrolling_down, |
Tab | nmap,imap |
[""] = actions.toggle_selection + actions.move_selection_worse, |
S-Tab | nmap,imap |
[""] = actions.toggle_selection + actions.move_selection_better, |
C-q | nmap,imap |
[""] = actions.send_to_qflist + actions.open_qflist, |
M-q | nmap,imap |
[""] = actions.send_selected_to_qflist + actions.open_qflist, |
C-l | nmap,imap |
[""] = actions.complete_tag, |
C-_ | nmap,imap |
["<C-_>"] = actions.which_key, -- keys from pressing |
m-t | nmap,imap |
[""] = trouble.open_with_trouble, |
Key | Mode | Action |
---|---|---|
C-p | nnoremap |
nnoremap <C-p> :SymbolsOutline |
Key | Mode | Action |
---|---|---|
,+ss | nnoremap |
<leader>ss SaveSession |
,+sd | nnoremap |
nnoremap <leader>sd !rm -f ~/.config/nvim/sessions/* |
Key | Mode | Action |
---|---|---|
,+ss | nnoremap |
restore the session for the current directory nnoremap <leader>ss lua require("persistence").load() |
,+sl | nnoremap |
restore the last session nnoremap <leader>sl lua require("persistence").load({ last = true }) |
,+st | nnoremap |
stop Persistence => session won't be saved on exit nnoremap <leader>st lua require("persistence").stop() |
- 使用
ctrl-n
选择单词 - 使用
ctrl-down
/ctrl-up
垂直创建光标 - 使用
shift
箭头一次选择一个字符 - 按
n/N
以获取下一个/上一个事件 - 按
[/]
选择下一个/上一个光标 - 按
q
键跳过当前事件并获取下一个事件 - 按
Q
键删除当前光标/所选内容 - 用
i,a,I,A
启动插入模式
Key | Mode | Action |
---|---|---|
c-t | tnoremap |
tnoremap <c-t> exe v:count1 . "ToggleTerm" |
,+tt | tnoremap |
nnoremap <leader>tt exe v:count1 . "ToggleTerm" |
,+tt | inoremap |
inoremap <leader>tt exe v:count1 . "ToggleTerm" |
,+gg | nnoremap |
nnoremap <leader>gg lua _LAZYGIT_TOGGLE() |
Key | Mode | Action |
---|---|---|
,+nt | nnoremap |
nnoremap <leader>nt :NvimTreeToggle |
nvim-tree
可以执行常见的 创建 、删除、拷贝、剪切 文件等操作
o
打开关闭文件夹a
创建文件r
重命名x
剪切c
拷贝p
粘贴d
删除
Key | Mode | Action |
---|---|---|
A-Left | nmap |
nmap <A-Left> :lua require('smart-splits').resize_left() |
A-Down | nmap |
nmap <A-Down> :lua require('smart-splits').resize_down() |
A-Up | nmap |
nmap <A-Up> :lua require('smart-splits').resize_up() |
A-Right | nmap |
nmap <A-Right> :lua require('smart-splits').resize_right() |
Key | Mode | Action |
---|---|---|
,+n | map |
map <leader>n :call RenameFile() |
Key | Mode | Action |
---|---|---|
,+xx | nnoremap |
nnoremap <leader>xx TroubleToggle |
,+xw | nnoremap |
nnoremap <leader>xw TroubleToggle workspace_diagnostics |
,+xd | nnoremap |
nnoremap <leader>xd TroubleToggle document_diagnostics |
,+xq | nnoremap |
nnoremap <leader>xq TroubleToggle quickfix |
,+xl | nnoremap |
nnoremap <leader>xl TroubleToggle loclist |
gR | nnoremap |
nnoremap gR TroubleToggle lsp_references |
Key | Mode | Action |
---|---|---|
f | nnoremap |
nnoremap f HopWord |
F | nnoremap |
nnoremap F HopWord |
Key | Mode | Action |
---|---|---|
,+ts | nmap |
nmap <Leader>ts TranslateW |
,+ts | vmap |
vmap <Leader>ts TranslateWV |
Key | Mode | Action |
---|---|---|
Tab | nmap |
nmap <Tab> :BufferLineCycleNext |
S-Tab | nmap |
nmap <S-Tab> :BufferLineCyclePrev |
,+1 | nnoremap |
nnoremap <leader>1 BufferLineGoToBuffer 1 |
,+2 | nnoremap |
nnoremap <leader>2 BufferLineGoToBuffer 2 |
,+3 | nnoremap |
nnoremap <leader>3 BufferLineGoToBuffer 3 |
,+4 | nnoremap |
nnoremap <leader>4 BufferLineGoToBuffer 4 |
,+5 | nnoremap |
nnoremap <leader>5 BufferLineGoToBuffer 5 |
,+6 | nnoremap |
nnoremap <leader>6 BufferLineGoToBuffer 6 |
,+7 | nnoremap |
nnoremap <leader>7 BufferLineGoToBuffer 7 |
,+8 | nnoremap |
nnoremap <leader>8 BufferLineGoToBuffer 8 |
,+9 | nnoremap |
nnoremap <leader>9 BufferLineGoToBuffer 9 |
Key | Mode | Action |
---|---|---|
f | map |
f Sneak_f |
F | map |
F Sneak_F |
t | map |
t Sneak_t |
T | map |
T Sneak_T |
Key | Mode | Action |
---|---|---|
gD | nmap |
buf_set_keymap("n", "gD" , "lua vim.lsp.buf.declaration()", opts) |
gd | nmap |
buf_set_keymap("n", "gd" , "lua vim.lsp.buf.definition()", opts) |
gi | nmap |
buf_set_keymap("n", "gi" , "lua vim.lsp.buf.implementation()", opts) |
,+wa | nmap |
buf_set_keymap("n", "<leader>wa" , "lua vim.lsp.buf.add_workspace_folder()", opts) |
,+wr | nmap |
buf_set_keymap("n", "<leader>wr" , "lua vim.lsp.buf.remove_workspace_folder()", opts) |
,+wl | nmap |
buf_set_keymap("n", "<leader>wl" , "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) |
,+ca | nmap |
buf_set_keymap("n", "<leader>ca" , "lua vim.lsp.buf.code_action()", opts) |
,+e | nmap |
buf_set_keymap("n", "<leader>e" , "lua vim.diagnostic.open_float()", opts) |
,+q | nmap |
buf_set_keymap("n", "<leader>q" , "lua vim.diagnostic.setloclist()", opts) |
,+so | nmap |
buf_set_keymap("n", "<leader>so" , [[lua require('telescope.builtin').lsp_document_symbols()]], opts) |
gr | nmap |
buf_set_keymap('n', 'gr' , 'lua vim.lsp.buf.references()', opts) |
[d | nmap |
buf_set_keymap("n", "[d" , "lua vim.diagnostic.goto_prev()", opts) |
]d | nmap |
buf_set_keymap("n", "]d" , "lua vim.diagnostic.goto_next()", opts) |
Key | Mode | Action |
---|---|---|
rn | nmap |
buf_set_keymap("n", "rn" , "Lspsaga rename", opts) |
gx | nmap |
buf_set_keymap("n", "gx" , "Lspsaga code_action", opts) |
gx | xmap |
buf_set_keymap("x", "gx" , ":Lspsaga range_code_action", opts) |
K | nmap |
buf_set_keymap("n", "K" , "Lspsaga hover_doc", opts) |
go | nmap |
buf_set_keymap("n", "go" , "Lspsaga show_line_diagnostics", opts) |
gf | nmap |
buf_set_keymap("n", "gf" , "lua require'lspsaga.provider'.lsp_finder()", opts) |
Key | Mode | Action |
---|---|---|
gpd | nmap |
buf_set_keymap("n", "gpd" , "lua require('goto-preview').goto_preview_definition()", opts) |
gpi | nmap |
buf_set_keymap("n", "gpi" , "lua require('goto-preview').goto_preview_implementation()", opts) |
gP | nmap |
buf_set_keymap("n","gP" , "lua require('goto-preview').close_all_win()", opts) |
gF | nmap |
buf_set_keymap("n", "gF" , "lua require('goto-preview').goto_preview_references()", opts) |
Key | Mode | Action |
---|---|---|
ctrl-s | nmap |
['ctrl-s' ] = 'split' |
ctrl-t | nmap |
['ctrl-t' ] = 'tab drop' |
Key | Mode | Action |
---|---|---|
,+hs | nmap |
['n <leader>hs '] = 'Gitsigns stage_hunk' |
,+hs | vmap |
['v <leader>hs '] = 'Gitsigns stage_hunk', |
,+hu | nmap |
['n <leader>hu '] = 'Gitsigns undo_stage_hunk', |
,+hr | nmap |
['n <leader>hr '] = 'Gitsigns reset_hunk', |
,+hr | vmap |
['v <leader>hr '] = 'Gitsigns reset_hunk', |
,+hR | nmap |
['n <leader>hR '] = 'Gitsigns reset_buffer', |
,+hb | nmap |
['n <leader>hb '] = 'lua require"gitsigns".blame_line{full=true}', |
,+hS | nmap |
['n <leader>hS '] = 'Gitsigns stage_buffer', |
,+hU | nmap |
['n <leader>hU '] = 'Gitsigns reset_buffer_index', |
,+gd | nmap |
['n <leader>gd '] = 'Gitsigns diffthis', |
,+gw | nmap |
['n <leader>gw '] = 'Gitsigns toggle_word_diff', |
,+gp | nmap |
['n <leader>gp '] = 'Gitsigns preview_hunk', |
C-U | nmap |
['o ih'] = ':<C-U> Gitsigns select_hunk', |
C-U | nmap |
['x ih'] = ':<C-U> Gitsigns select_hunk' |
Key | Mode | Action |
---|---|---|
ctrl-u | nmap |
{'scroll', {'-vim.wo.scroll', 'true', '250'}} |
ctrl-d | nmap |
{'scroll', { 'vim.wo.scroll', 'true', '250'}} |
ctrl-b | nmap |
{'scroll', {'-vim.api.nvim_win_get_height(0)', 'true', '450'}} |
ctrl-f | nmap |
{'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450'}} |
ctrl-y | nmap |
{'scroll', {'-0.10', 'false', '100'}} |
ctrl-e | nmap |
{'scroll', { '0.10', 'false', '100'}} |
zt | nmap |
{'zt', {'250'}} |
zz | nmap |
{'zz', {'250'}} |
zb | nmap |
{'zb', {'250'}} |
gg | nmap |
{'scroll', {'-2*vim.api.nvim_buf_line_count(0)', 'true', '1', '5', e}} |
G | nmap |
{'scroll', {'2*vim.api.nvim_buf_line_count(0)', 'true', '1', '5', e}} |
Key | Mode | Action |
---|---|---|
jk | inoremap |
inoremap jk |
U | nnoremap |
nnoremap U |
/ | nnoremap vnoremap |
nnoremap / /\vvnoremap / /\v |
// | vnoremap |
vnoremap // y/" |
,+d | nnoremap |
add quote for current word nnoremap <leader>d ::bufdo! bd! |
,+q" | nnoremap |
add quote for current word nnoremap <Leader>q" ciw""P |
,+q' | nnoremap |
add quote for current word nnoremap <Leader>q' ciw''P** |
,+q( | nnoremap |
add quote for current word nnoremap <Leader>q( ciw()P |
,+q{ | nnoremap |
add quote for current word nnoremap <Leader>q{ ciw{}P** |
,+qd | nnoremap |
add quote for current word nnoremap <Leader>qd daW"=substitute(@@,"'\|"","","g")P |
C-h | nnoremap |
nnoremap <C-h> h |
C-j | nnoremap |
nnoremap <C-j> j |
C-k | nnoremap |
nnoremap <C-k> k |
C-l | nnoremap |
nnoremap <C-l> l |
C-q | nnoremap |
nnoremap <C-q> q |
( | nnoremap |
nnoremap ( % |
) | nnoremap |
nnoremap ) % |
TAB | inoremap |
use tab/shift tab to switch coc or native lsp cmp inoremap <TAB> pumvisible() ? "<C-n>" : "<TAB>" |
S-TAB | inoremap |
use tab/shift tab to switch coc or native lsp cmp inoremap <S-TAB> pumvisible() ? "<C-p>" : "<C-h>" |
C-a | cnoremap |
cmdline quickly go to head or tail cnoremap <C-a> |
C-e | cnoremap |
cmdline quickly go to head or tail cnoremap <C-e> |
esc | cnoremap |
清除上次搜索高亮显示 nnoremap <esc> :noh |
tmux [new -s 会话名 -n 窗口名] | 启动新session |
---|---|
tmux at [-t 会话名] | 恢复session |
tmux ls | 列出所有sessions |
tmux kill-server | 关闭整个tmux服务器 |
tmux kill-session -t 会话名 | 关闭session |
**prefix ** key set as C-a
前缀 | 指令 | 描述 |
---|---|---|
C-a | ? | 显示快捷键帮助文档 |
C-a | d | 退出 tmux 工作模式,返回 terminal 模式 |
C-a | D | 选择要断开的会话 |
C-a | z | 挂起当前会话 |
C-a | r | 强制重载当前会话 |
C-a | s | 显示会话列表用于选择并切换 |
C-a | : | 进入命令行模式,此时可直接输入ls等命令 |
C-a | [ | 进入复制模式,按q退出 |
C-a | ] | 粘贴复制模式中复制的文本 |
C-a | ~ | 列出提示信息缓存 |
前缀 | 指令 | 描述 |
---|---|---|
C-a | c | 新建窗口 |
C-a | & | 关闭当前窗口 |
C-a | 0~9 | 切换到指定窗口 |
C-a | n | 切换到下一窗口 |
C-a | w | 打开窗口列表,用于且切换窗口 |
C-a | , | 重命名当前窗口 |
C-a | . | 修改当前窗口编号(适用于窗口重新排序) |
C-a | f | 快速定位到窗口(输入关键字匹配窗口名称) |
前缀 | 指令 | 描述 |
---|---|---|
C-a | h | 当前面板上下一分为二,下侧新建面板 |
C-a | v | 当前面板左右一分为二,右侧新建面板 |
C-a | x | 关闭当前面板(关闭前需输入y or n确认) |
C-a | z | 最大化当前面板,再重复一次按键后恢复正常(v1.8版本新增) |
C-a | ! | 将当前面板移动到新的窗口打开(原窗口中存在两个及以上面板有效) |
C-a | ; | 切换到最后一次使用的面板 |
C-a | q | 显示面板编号,在编号消失前输入对应的数字可切换到相应的面板 |
Shift | ← | 向前置换当前面板 |
Shift | → | 向后置换当前面板 |
C-a | Ctrl+o | 顺时针旋转当前窗口中的所有面板 |
C-a | ↑ | 向上切换面板 |
C-a | ↓ | 向下切换面板 |
C-a | ← | 向左切换面板 |
C-a | → | 向右切换面板 |
C-a | o | 选择下一面板 |
C-a | 空格键 | 在自带的面板布局中循环切换 |
C-a | Alt+方向键 | 以5个单元格为单位调整当前面板边缘 |
C-a | Ctrl+方向键 | 以1个单元格为单位调整当前面板边缘(Mac下 |
C-a | t | 显示时钟 |
C-a | m | 关闭开启鼠标控制 |