just records some tricks
1. spell checking and correction.
when in insert mode, type Ctrl-l will correct the misspelled words.
set spell
set spelllang=nl,en_us,cjk
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
2. easy expansion of the active file directory
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:p:h').'/' : '%%'
3. Treesitter folding without first opening, all text in folded mode.
-- zc folding
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
vim.wo.foldlevel = 99
4. move visual selected items UP and DOWN
lua << EOF
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
EOF
visual selected items.
type K to move the all items up one line. (or you could use J to move down one line)
5. change selected item in incremental order
Ctrl v select the items to be incremented.
press g, and Ctrl+a
6. change multiple same item in one replace
visual select where items to be changed are included.
press :, and type old name and new name.
7. treesitter incremental selection
type enter, to increase, type backspace to decrease
8. g; & g,
Go to [count] (older or newer) position in change list.
9. metacharacters in replacement strings
use &
with the entire text matched by the search pattern to avoid retyping.