~
All configs are in my dotfiles.
Search current word: *
Search multiple words:
:/\vword1|word2|word3
Replace word:
:%s/word1/word2/g
Delete all lines contain word:
:g/word/d
Delete all lines not contain word:
:g!/word/d
:v/word/d
Play macro (after selecting lines):
:norm! @a
Sort lines (after selecting lines):
:sort -u
Reverse lines (after selcting lines):
:!tail -r
Column-ize lines:
:!column -t
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/backward
E
, gE
: end of WORD current/beforef{char}
, F{char}
: find forward/backward
character
Advance:
CTRL-O
, CTRL-I
: cursor position
backward/forward
{
, }
: paragraph backward/forwardH
: top of screenM
: middle of screenL
: bottom of screenCTRL-]
, CTRL-T
: jump to tag/jump back from tag
zR
: open all folds.za
, zA
: toggle foldUse both \
and ;
as leader key:
vim.keymap.set("n", ";", "<Leader>", { remap = true })
vim.keymap.set("n", "'", "<Leader>", { remap = true })
Ground rules:
<Leader>
prefix: prefer global keymap
<Space>
prefix: prefer lsp keymap, for coding of
course :D
With ibhagwan/fzf-lua:
<Leader>f
: find files<Leader>l
: find lines<Leader>rg
: grep files<Space>s
: find lsp symbols<Space>d
: go to definition<Space>r
: go to references<Space>i
: go to implementationWith nvim-tree/nvim-tree.lua, inside nvim-tree:
<C-n>
: toggle<Leader>n
: locate filea
: created
: deleter
: renamex
: cutc
: copyp
: pasteU
: toggle hiddenWith lewis6991/gitsigns.nvim:
]c
, [c
: next/previous git change:A
: open alternate file[D
, ]D
, [d
,
]d
: diagnostic backward/forward
[Q
, ]Q
, [q
,
]q
: quickfix backward/forward
[T
, ]T
, [t
,
]t
: tree-sitter backward/forward
gcc
: comment/uncomment current linegc
: comment/uncomment selected lines<C-Space>
: trigger completionsa
: add surroundsd
: delete surroundsr
: replace surroundWith neovim/nvim-lspconfig:
<Space>e
: float diagnostic<Space>k
: hover<F2>
: rename<Space>f
: format code<Space>ca
: code action<Space>ci
: organize imports