Aide mémoire sur les commandes nvim
Publié le
Quelques commandes ou raccourcis bien utiles que j’oublie trop vite..
Characters
Insert special unicode character
- Insert mode
ctrl+U
(nb: U is Uppercase)- 2665 (ex: ♥)
List all digraphs
:digraphs
Usage
CTRL+K Eu
: €CTRL+K OK
: ✓CTRL+K XX
: ✗
G prefix command
move to last/next change (in insert mode)
g;
g,
Display ascii code of current character
ga
change case with motion (lower/upper)
gu
gU
gUiw (upper whole word)
Quick select or change
Change content inside quotes
ci"
Select content inside {
vi{
Insert Mode
Inserting and Deleting
CTRL+a
- Insert the last content inserted.CTRL+@
- Insert the last content inserted and quit INSERT mode.CTRL+h
- Delete the character before the cursor.CTRL+w
- Delete the word under the cursor.CTRL+u
- Delete everything before the cursor.CTRL+t
- Add one indentation.CTRL+d
- Delete one indentation.CTRL+O - Come back to normal mode for one stroke
Replacement with sed
:s/pattern/replacement/
- Substitute the first occurrence of pattern on the current line with replacement.:%s/pattern/replacement/
- Substitute every first occurrence of pattern on each line of the current buffer.:%s/pattern/replacement/g
- Substitute every occurrence of pattern on each line of the current buffer.
c - Ask you to confirm each substitution.
Quickfix list
You can think of a quickfix list as a set of positions in one or multiple files.
:cl̀
or:clist
- Display all valid entries of the current quickfix list. You can add a range as argument (only numbers).:cc <number>
- Move to the th entry of the current quickfix list.:cnext
or:cn
- Move to the next entry of the current quickfix list.:cprevious
or:cp
- Move to the previous entry of the current quickfix
commands (like :make
or :grep
) also populate automatically a quickfix list
The Quickfix Window
:copen
or:cope
- Open a window (with a special buffer) to show the current quickfix list.
Location List
you can have multiple location lists available at the same time (one per window open), but you can only have access to one quickfix list.
Command
:!man tree
Result in Buffer
- Insert mode
ctrl+r =
- your command (ex:
system("tree")
)
or
:r! tree