Tomas Vik

neovim

TODO read A Vim Guide for Advanced Users | Hacker News

Plugin development

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 tags
  • CTRL-] - go to tag
  • CTRL-T - go back - tag stack
  • Ctlr+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 register
    • 0 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

Autocompletion

Debugging

  • mappings

  • General

    • open logs with :e $NVIM_LOG_FILE
    • set verbosity -V9 (e.g. vim -V9 file.txt)
  • 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 the runtimepath with a slight delay. So my init script was able to import the module from the “default” runtimepath and shortly after lazy.nvim changed runtimpath 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

Formatting

  • :noautocmd w will turn off the “format on save” for this single command

Fast search and replace

TODOs

  • It happens to me quite often that I see some diagnostics
    • image.png
    • 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:
    • image.png
    • 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