Comment Multiple Lines
:15,25s/^/#
~ comment from line 15 to 25.%s/foo/bar/g
~ replace all apearances offoo
withbar
in whole files/foo//g
~ delete all apearances offoo
in a line:[range]s/{pattern}/{string}/[flags] [count]
this is how it is structured out
hjkl
from now on use this keysx[visual]
delete character at current posdw[visual]
delete a word
s
- open horizontallyi
- open vertically
ctrl + w
- move through panesctrl + w s
- split horizontallyctrl + w v
- split vertically
VISUAL over function name -> gd
~ go to function definitionVISUAL over data type -> gy / gi
~ go to type definitionVISUAL over function/ datatype -> K
~ show documentationINSERT -> ctl + space
~ toggle autosuggestionsctl + o
~ return backVISUAL gf
~ go to filectl + o
~ take me where i have bene beforectrl + i
~ take me forward
:sav file.txt
~ save new file:new file.txt
~ create new file and open horizontally:vsp file.txt
~ create new file and open vertically
:term
~ open terminalctrl + \ and then ctrl +n
~ Go into visual mode
:r !ls
~ paste the output of ls into vim
Record a macro with qa
where a
is the register name
Then do the macro and then stop recording with q
Then run the macro with @a
where a
is the register name
then:
:5,10norm! @a
~ run the macro from line 5 to 10
:5,$norm! @a
~ run the macro from line 5 to end of file
:%norm! @a
~ run the macro on the whole file
:g/pattern/norm! @a
~ run the macro on all the lines that match the pattern
To execute the macro on visually selected lines, press V and the j or k until the desired region is selected.
Then type :norm! @a
and observe the that following input line is shown.
:help nvim-tree-default-mappings
:g/^$/d
Add mark with ma
And then list them with :marks
Select the mark with 'x
where x is the character thas is next to the mark listed using :marks
command.
Command | Description |
---|---|
ma | set mark a at current cursor location |
'a | jump to line of mark a (first non-blank character in line) |
`a | jump to position (line and column) of mark a |
d'a | delete from current line to line of mark a |
d`a | delete from current cursor position to position of mark a |
c'a | change text from current line to line of mark a |
y`a | yank text to unnamed buffer from cursor to position of mark a |
:marks | list all the current marks |
:marks aB | list marks a, B |