Files
dotfiles/nvim/.config/nvim/README.md
T
2026-11-19 23:12:38 +01:00

133 lines
3.1 KiB
Markdown

# Neovim config
Inspirations:
- [illya](https://codeberg.org/42nerds/nvim)
- [nolan](https://github.com/Hrumble/sneaky-nvim-config)
- [mats](https://github.com/BeerB34r/dotfiles)
[Great guide on vim.pack](https://echasnovski.com/blog/2026-03-13-a-guide-to-vim-pack#delete)
# Micro vim.pack tutorial
- Remove a plugin `:lua vim.pack.del({ 'name' })`.
- Update a plugin `:lua vim.pack.update({ 'name' })`
- Update all `:lua vim.pack.update()`
# Neovim Notes
See custom keymaps with short descriptions with `<leader><leader>h`.
General shortcuts:
- `<leader>e` opens the file browser
- `gx` opens an external viewer
- `gR`, `<F5>` refresh
Windowing shortcuts:
- `<leader>sv` open a vertical split
- `<leader>sh` open a horizontal split
- `<leader>se` equalize split sizes
- `<leader>sc` close the current window
- `<leader>r-hjkl` to resize
- `<leader>re` equalize split sizes
- `<C-hjkl>` move between windows
Buffer shortcuts:
- `<leader>bp` previous buffer
- `<leader>bn` next buffer
- `<leader>bd` delete the current buffer
- `<leader>bc` force close all non-visible buffers
- `<leader>bf` find buffers
Telescope shortcuts:
- `<leader>ff` find files
- `<leader>fg` live grep
- `<leader>fb` list buffers
- `<leader>fh` browse help tags
Git shortcuts:
- `:Git` to run commands directly (`:Git status`, `:Git log --oneline`)
- `<leader>lg` open LazyGit
- `<leader>dv` open Diffview
- `<leader>dc` close Diffview
- `[h`, `]h`, `[H`, `]H` jump to hunks
- `<leader>th` — toggle the expanded hunk view
Oil shortcuts:
- `gp` opens preview panel
Toggle shortcuts:
- `<leader>tw` toggle soft wrap
- `<leader>ts` toggle spell checking
- `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics
- `<leader>th` — toggle the expanded hunk view
- `<leader>tf` — toggle auto formatting on save
## Terminal
Two options to leave terminal mode and return to normal mode:
```vim
<\\-Esc>
<C-Esc>
```
## LSP
Useful Mason commands:
```vim
:Mason
:MasonLog
:checkhealth mason
```
Useful LSP commands:
- `lsp restart` restart LSP clients attached to the current buffer
- `K` show the type and documentation for the symbol under the cursor
- `gd` go to definition
- `gD` go to declaration
- `grd` list references
- `grn` rename symbol
- `<leader>ca` show code actions
- `<leader>cf` apply quick fixes
- `<leader>cs` show source actions
- `<C-x><C-n>` manually word completion
Diagnostics:
- `g.` open diagnostic float
- `gl` send diagnostics to the location list
- `gld` display diagnostic information
- `]g`, `[g` jump to warning or error
- `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics
- `<leader>xx`, `:ProjectDiagnostics` check the current Dart or TypeScript
package and show warnings and errors in Trouble. Save modified package files
first. Other languages show available LSP diagnostics; project coverage
depends on the language server.
## Tree-sitter
`tree-sitter-cli` and a C compiler is required to be installed.
Useful commands:
```vim
:TSUpdate
:TSInstall lua bash json
:TSInstallInfo
:InspectTree
:checkhealth vim.treesitter
```