NeoVIM
Environment
To run NeoVIM with a specific config located in ~/.config/<dir>, you can pass
it to the environment variable:
$ NVIM_APPNAME=<dir> nvim
Shortcuts
- space: Leader key
- jk / kj : Exit mode
By default
- TAB : Change buffer
- Shift + TAB : Change buffer from back
- leader + bd : Delete buffer
- leader + os : Stop research
- Ctrl + a : Decrement a number
- Ctrl + x : Increment a number
- Ctrl + o : Go to the previous point before jump
- Ctrl + i : Go to the next point before jump
- Ctrl + e : Scroll up
- Ctrl + y : Scroll down
Related to macros :
- q<name><macro>q => record
- <nombre>@<name> => call
Related to window spaces:
- Ctrl + direction : Change windows
- Shift + direction : Change dimensions
- Ctrl + w ; _ : Maximum height
Ctrl + w ; r : Maximum width- Ctrl + w ; = : Equal size windows
Related to auto-completion:
- Ctrl + x ; Ctrl + l : Complete the line
- Ctrl + x ; Ctrl + f : Complete from workspace file
Mini.surround
In Normal mode:
- sr<symbole><new symbole> : Change surrounding
- sd<symbole> : Delete surrounding
In Visual mode
- sa<symbole> : Surround selection
You can choose the symbol for the input and the output by using:
- any unique character,
tfor a tag (HTML kind)?for the interactive mode
In the case of the unique character, the left version will add a space (e.g. ()
whereas the right version will not (e.g. )).
Comment.nvim
- leader + cc : Comment
- leader + ci : Inverse comment / uncomment
Telescope
- leader + ff : Walk through git files
- leader + fg : Walk through code
- leader + b : Walk through buffers
Completion
When completion menu is opened:
- Ctrl + e: Complete or triger snippets
- Ctrl + c: Cancel completion
- Ctrl + space: Show or hide documentation
LSP
- leader + ld => Go to definitions
- leader + lr => Rename
- leader + lf => Format
- leader + lgt => Go to type definition
- leader + lgr => Go to the reference
- leader + lw => Change workspace
- leader + lca => Code action
- leader + lh => Object informations
- leader + ls => Signatures
Markdown
Using the markdown mode:
- leader + wg: Glowish markdown
- leader + wu: Go back to raw markdown
By default in NeoVIM:
- Format paragraphs:
- v (and selection) + gw: unify size for line (old version)
- v (and selection) + gq: unify size for line (old version of Neovim)
Mode
Visual
In visual mode it is possible to select the with:
- iw to select a specific word
Commands
Range
Many commands in NeoVIM can use a range to describe where the effect should take place. The range can be:
%to target the entire file
Replace
In NeoVIM, replacing some text is done using RegExpr. It is triggered using
:[range]s.
:[range]s/{pattern}/{replacement}/flags
Dot
. can be used to replay an action store in registers. For example you can
delete multiple lines with: dd.....
Macros
You can register a macro by using q<letter>, then register the macro and
finish with q. The macro will be stored inside of <letter>. Once it is
done, you can apply the macro with @<letter>. It is possible to mix it with
range. For example, you can apply it five times with 5@<letter>. If you want
to apply the previous macro, you can run @@. It also works with ranges.
Debugging Neovim
To print the variables, it is possible to use the
print(vim.inspect(<variable>)) directive. The value can be found in
:messages at startup.
To inspect the treesitter tree, you can use :InspectTree.
Resources
- 10 VIim shortcuts (TO TRANSLATE)
- Vim-advanced (TO TRANSLATE)