Nvim

From Colettapedia
Jump to navigation Jump to search

Conversion steps

  1. brew update
  2. brew install neovim
  3. brew tap homebrew/cask-fonts
  4. brew install --cask font-roboto-mono-nerd-font
  5. :TSInstall python r

Nvim specific quirks

terminal

  • Ctrl+\ Ctrl+n key combo to get out of terminal mode, i to get into terminal mode.
  • :h standard-path
  • LSP
    • :help lsp
    • :help lspconfig
    • :LspInfo
    • :h lspconfig-keybindings
  • leader = spacebar in NvChad
  • Meta is command key on mac


NVChad-specific features

  • <leader> + ch or :NvCheatsheet shows you all your mappings
  • <leader> + x closes buffer (:bd)
  • <tab> - goto next buffer (:bn)
  • <leader> + n - toggle line number
  • <leader> + v - gimme a new zsh terminal in the right vertical pane

AstroNvim-specific features

  • :LspInstall pyright - Install LSP
  • :TSInstall python - Install Language Parser
  • :DapInstall python - Install debugger
  • Manage plugins with :Lazy - check, update, sync, clean

Plugins

Lazy

  • lazy - package manager
    • :Lazy
    • :help lazy.nvim.txt
  • To add plugin as part of NvChad, put an entry in the file $HOME/.config/nvim/lua/custom/plugins.lua

NvimTree

  • nvim-tree.lua
  • C-n to open tree, or :NvimTreeOpen
  • Inside the file tree window type g? to see mappings

commands

  • E - expand all for folder under the cursor
  • C-K - get info
  • x - cut a file
  • p - paste it (in another folder)
  • hover cursor over file an press m to mark a file
  • a - create a new file then type in the file name
  • r - rename file
  • d - delete
  • C-] - make directory under cursor top level in tree view
  • - ("minus") - to go up

Telescope

  • <leader> ff - "find file" brings up fuzzy finder by filename
  • <leader> fw - "find word" brings up find in files via grep
    • Requrires ripgrep (grep implementation in rust) and fd (find replacement) brew install ripgrep fd
  • <leader> fh - bring up help fuzzy matching
  • <leader> fb - only search for a word inside open buffers

vista.vim

Comment.nvim

  • Enter visual block mode and type gc to toggle linewise comment

SnipRun

WhichKey

  • WhichKey shows pop-up window with current key-bindings, marks, registers
  • :WhichKey

Mason

  • Acts as a package manager for external dependencies, so that you keep configuration as code rather than just adhoc
  • mason.nvim
    • :h mason-introduction
    • :Mason
{
  "williamboman/mason",
  opts={
    Ensure_installed ={
      "Pyright"
}
}
}

TreeSitter

  • TreeSitter for advanced code highlighting
    • :help treesitter
    • :TSInstall python r sql cmake bash bibtex cpp dockerfile doxygen latex make sql ssh_config svelte terraform yaml

ChatGPT integration

neo-tree

  • Astronvim default tree viewer
  • neo-tree.nvim
  • :Neotree - press ? while inside for cheatsheet
  • :h neo-tree

Nvim distributions


Helpful related websites

Youtubers