My personal neovim configuration.
- When you do the remap, it always give you some time (a little lagging time to do the combination of key) to execute the new mapping key and do the default movement. So do it with some special key like
<C> or <leader>
- You can source the
.vimrc
file with:so %
or remap it withnnoremap <leader><CR> :so ~/.config/nvim/init.vim<CR>
- Mark use
m
+A
to make the line where you are, and use'
+A
to go back from another file. - Quick fix: when you use
:grep SOCK **/*.c
to search for all files, you can usecopen
to open the list of the search results, usecnext
to jump to the next result and usecprev
to jump back. And also remap it.
/<term><CR>
then usen
to jump to the next, useN
to the previous.- you can select with visual and search (
:s/...
) for certain region'<,'>:s/target/new_term
. :s/target/replace_term
to when on the line of where you are:s/target/replace_term/g
to replace the whole term of the line:s/target/replace_term/gc
to let you replace one by one and determine the action that you are going to do.:%s/target/new_term/g
replace the whole file of what you find.
- Press
q
and pick a letter for the macro, then it starts to record it. <C + a>
will automatically increment the number- After all you have done, you can press
q
again to stop recording. - Use
@[the letter you macro]
to execute the macro. - Use
[times]@[the letter you macro]
to do it several times.
- Use
:reg
to take a look of what you have record - Use
"[letter]p
to paste the recording command - Then you can edit it. No need to recording the whole process again.
- Use
"[letter]y
to save it with a specific letter, no need to be the same one. - And do it with
@[letter]
C
delete the right-hand side of the line and go into insert mode.S
delete the whole line, in respect to the indent and go into the insert mode.
f
to find the character behind the line and use;
and,
. You can also keep doing it to jump horizontally.t
to find the character behind the line, land before the character and use;
and,
. You can also keep doing it to jump horizontally. You can usedt)
to delete the content of the conditional close. You can also usect)
s
delete one character and be in insert mode.^
go to the beginning of the line and unlike0
- use
{}
to jump between paragraph - You can go to
{}[]()
and use%
to jump between the start and end. - Combo:
V$%d
orVf}%d
to delete the whole paragraph. - Combo:
di} or di] or di)
to delete the content inside the bracket. - Combo:
di} or vi} or ci} or yi}
to compose with other movement within bracket. - Combo:
da} or va} or ca} or ya}
to compose with other movement with bracket. - Combo:
va}V
to highlight the whole function and bracket. - Combo:
va}o
to switch between bracket and goj or k
to select more and hito
to switch again. - Combo:
diw or yiw or viw or ciw
to do things upon a word - Combo:
yiW
to copy the whole word exceptspace
Ctrl + d
andCtrl + u
a good way to jump through file contentShift + v
select whole line,Shift + G
to the bottom- use
y
to yank - use
Esc
to close the highlight after search (withnoh
)
Can be called as selection mode. Use v
to enter the mode.
- use
V
to select whole line. - use
C+v
single selection mode - use
d
to delete what you selected. Deleted content will be store and usep
in standard mode to paste it. - use
c
to delete and insert. Deleted content reserved. - use
aw
to mark a word - use
ab
to block with () - use
aB
to block with {} - use
ib
to block with () - use
iB
to block with {} - use
it
to block with <> (content first then tag then outer tag) - use
v
,iB
,c
,delete
,enter
to delete whole content of {} and insert new content with nice format with delete {}. - use
V
andy
to copy a line and paste it under a new line - use
C+v
andj
to select single vertical line of code and useg C+a
to replace with incremental content - You can use
>
to indent your line as well. - use
C+v
to create multiple cursors for multi-line editing. - Code folding:
zf
to create folding,za
to open or close the created folding.
- get the repo
name/package-name
and put it inplugins-setup.lua
. After you save it, our script in lua will install the packer. - you may need to new a file for certain packer in plugins folder. Simply for further configurations.
- require the new file in
init.lau
to make it works. - use
<leader><CR>
to source the file you modified. Because I mapped it to:so %<CR>
. - folder structure is below.
comment packer for nvim
gcc
to comment a line- selection with
gc
- use
t + e
to open a new tab,S + t
to switch between them
- use
<leader>e
to toggle it (setting is in map.lua) - use
a
to create a new file - use
d
to delete it - use
r
to rename it - use
space
to switch between the window
ys
+w
+"[{''}]"
to do the surround of a wordds
+"'[{}]'"
to delete what you surround
<C-hjkl>
to move around the windows
- use
:MaximizerToggle
to make the window maximized - do it again the restore the size
- keymap is
<leader>sm
Auto-completion
cmp-path
: use ./ to give completion of current files
gd
to get the definition of the Function or Classgf
to get the definition, implementation and reference<C-i>
and<C-o>
to jump between opened files- Handle error message
- go to the error position
]d
- open code action
<leader>ca
- press enter or number for actions
- go to the error position
<leader>rn
to rename the variable and update all the file of variable names of whole project)<leader>rf
to rename the file name:wa
will save all the files<leader>d
to tell the error detail
- you can install things by pressing
i
X
to uninstall it
:TSEnable highlight
to turn on highlight for specific language
:Todo
to get the list or something elseTODO:
,FIX:
to further comment todos