3.3 KiB
3.3 KiB
My neovim workflow
All configs are in my dotfiles.
Search multiple words:
:/\vword1|word2|word3
Replace word:
:%s/word1/word2/g
Delete all lines contain word:
:g/word/d
Jump basic:
gg
: first lineG
: last line0
: first character of line$
: last character of linew
,b
: word forward/backwarde
,ge
: end of word current/beforeW
,B
: WORD (word with special char) forward/backwardE
,gE
: end of WORD current/beforef{char}
,F{char}
: find forward/backward character
Jump advance:
CTRL-O
,CTRL-I
: cursor position backward/forward(
,)
: sentence backward/forward{
,}
: paragraph backward/forwardH
: top of screenM
: middle of screenL
: bottom of screenCTRL-]
,CTRL-T
: jump to tag/jump back from tag- Support jump to Go definition with fatih/vim-go.
Use both \
and ;
as leader key:
vim.keymap.set("n", ";", "<Leader>", { remap = true })
vim.keymap.set("n", "'", "<Leader>", { remap = true })
Misc keymap:
vim.keymap.set("n", "n", "nzz")
vim.keymap.set("n", "N", "Nzz")
vim.keymap.set("n", "q", ":q<CR>")
-
<Leader>
prefix: prefer global keymap -
<Space>
prefix: prefer lsp keymap, for coding of course :D -
With ibhagwan/fzf-lua:
<Leader>f
: find files<Leader>rg
: grep files<Space>s
: find lsp symbols
-
With nvim-tree/nvim-tree.lua, inside nvim-tree:
<C-n>
: toggle<Leader>n
: locate filea
: created
: deleter
: renamex
: cutc
: copyp
: pasteU
: toggle hidden
-
With hrsh7th/nvim-cmp:
<C-Space>
: trigger completion
-
With lewis6991/gitsigns.nvim:
]c
,[c
: next/previous git change
-
:A
: open alternate file
-
- With mini-bracketed
[B
,]B
,[b
,]b
: buffer backward/forward[D
,]D
,[d
,]d
: diagnostic backward/forward[Q
,]Q
,[q
,]q
: quickfix backward/forward[T
,]T
,[t
,]t
: tree-sitter backward/forward- Support more languages with nvim-treesitter/nvim-treesitter
- With mini-comment
gcc
: comment/uncomment current linegc
: comment/uncomment selected lines
- With mini-surround
sa
: add surroundsd
: delete surroundsr
: replace surround
- With mini-trailspace
<Leader>tr
: trim trailing whitespace
- With mini-bracketed
-
<Space>gd
: go to definition<Space>k
: hover<F2>
: rename<Space>ca
: code action<Space>gr
: go to references<Space>f
: format