2.7 KiB
2.7 KiB
My neovim workflow
All configs are in my dotfiles.
Use both \
and ;
as leader key:
vim.keymap.set("n", ";", "<leader>", { remap = true })
vim.keymap.set("n", "q", ":q<CR>")
Search multiple words:
:/\vword1|word2|word3
Replace word:
:%s/word1/word2/g
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.
Keymap for plugin (sync with dotfiles):
vim.keymap.set("n", "<leader>f", ":FZF<CR>")
vim.keymap.set("n", "<leader>rg", ":FZFRg<CR>")
vim.keymap.set("n", "<leader>cm", ":FZFCommands<CR>")
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
vim.keymap.set("n", "<leader>n", ":NvimTreeFindFile<CR>")
vim.keymap.set("n", "<leader>tr", ":lua MiniTrailspace.trim()<CR>")
- With nvim-tree/nvim-tree.lua, inside nvim-tree:
a
: created
: deleter
: renamex
: cutc
: copyp
: pasteU
: toggle hidden
- With lewis6991/gitsigns.nvim:
]c
,[c
: next/previous git change
- With echasnovski/mini.nvim
- With mini-bracketed
[b
,]b
: buffer 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-bracketed
- With neovim/nvim-lspconfig
gd
: go to definitiongr
: go to referencesK
: hover<F2>
: rename<space>f
: format<space>ca
: code action