neovim
TODO read A Vim Guide for Advanced Users | Hacker News
Plugin development
- watch Developing a Neovim Docker Plugin from Scratch - YouTube which was recommended in Jonas Hietala: Customizing Neovim
Ctrl+w deletes the last word in insert mode
🫵 custom mapping
- inspect custom mappings with
:map
copy current file path to system clipboard :let @+ = expand("%")
Help
F1
- 🫵 fuzzy search through tagsCTRL-]
- go to tagCTRL-T
- go back - tag stackCtlr+O
- go back - jump list:helpgrep
- grep through all help pages:Helptags
- fzf search through help tags
Search and replace
-
Visual selected text
- yank it
- type in the
:%s/<C-R>0/replace text/
Ctrl+R
pastes a register0
is the yank register
-
across the whole project
:grep <search term>
:cfdo %s/<search term>/<replace term>/g
- (If you want to save the changes in all files)
:cfdo update
Movement
LSP support
- I installed the
nvim-lspconfig
plugin to make the LSP server config eaiser https://github.com/neovim/nvim-lspconfig - For TypeScript, it required me to install the language server with
-
npm install -g typescript typescript-language-server
-
- Other LS configs can be found here https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#tsserver
- Rename tweak: Neovim LSP rename like a boss (with normal mode keymaps)
- Neovim - Make LSP Workspace Symbols show only workspace symbols
Autocompletion
Debugging
-
mappings
:verbose map <key>
- taken from Debugging Lua mappings/commands/autocommands
-
General
- open logs with
:e $NVIM_LOG_FILE
- set verbosity
-V9
(e.g.vim -V9 file.txt
)
- open logs with
-
lua modules
- I found where lua module is loaded from with
:lua print(debug.getinfo(package.loaded["nvim-treesitter.configs"].attach_module, "S").source)
- I found out that
lazy.nvim
changed theruntimepath
with a slight delay. So my init script was able to import the module from the “default”runtimepath
and shortly afterlazy.nvim
changedruntimpath
but the pesky module has already been loaded. - The best way is to skip init file with
nvim -u NONE
and then inspect the:set runtimepath
to see where the modules can come from
- I found where lua module is loaded from with
Formatting
:noautocmd w
will turn off the “format on save” for this single command
Fast search and replace
cgn
replaces the next search term, then you can press.
to repeat
TODOs
- It happens to me quite often that I see some diagnostics
- But I don’t know what plugin is adding them.
- I need to find a way to diagnose the diagnostics 👹
- I sometimes see error in the command window:
- I would like to be able to quickly copy it to the clipboard so I can search for solution on the web.
- Globals, Command Line and Functions on Vimeo - video recommended on Reddit