nvim-dotfiles
One Neovim config for a laptop and for any server. Started life as kickstart.nvim, now split into small files and trimmed to what is actually used.
- Needs Neovim 0.11+ (developed on 0.12).
scripts/install-nvim.shinstalls a release into~/.local, no root required. - Plugins: lazy.nvim, with the versions pinned in
lazy-lock.json. - LSP: native
vim.lsp.config/vim.lsp.enable, servers installed by mason. - Degrades gracefully: no java means no Java LSP, no TeX means no vimtex, no clipboard tool means OSC 52. Nothing errors on a bare box.
Install
git clone <this repo> ~/.config/nvim
cd ~/.config/nvim
scripts/doctor.sh # what's missing on this machine?
scripts/install-nvim.sh # only if nvim is missing or older than 0.11
nvim # first launch installs plugins, LSP servers and parsers; give it a minute
Same steps on a server. Needs git, curl (or wget), a C compiler, unzip and ripgrep. On Debian/Ubuntu: sudo apt install git curl build-essential unzip ripgrep.
Layout
init.lua version check, then requires the files below
lazy-lock.json plugin versions (tracked on purpose)
lua/
env.lua ssh? clipboard tool? minimal mode? (read by everything else)
options.lua vim.opt, clipboard
keymaps.lua global keymaps, incl. the ThePrimeagen ones
autocmds.lua yank highlight, last position, mkdir on save, ...
bootstrap.lua installs lazy.nvim, loads lua/plugins/*
plugins/ one file per concern, each returns a lazy.nvim spec
colorscheme completion editing format gitsigns harpoon
lsp telescope treesitter vimtex which-key
servers/
init.lua THE list of language servers
<name>.lua per-server overrides (clangd, jdtls, lua_ls, ruff, verible)
scripts/
doctor.sh read-only report of what this machine has
install-nvim.sh user-level Neovim install
Add a plugin: drop a file in lua/plugins/ that returns a spec. lazy.nvim picks it up.
Add a language server: add one line to lua/servers/init.lua (list any executables it needs in requires). Add lua/servers/<name>.lua only if it needs overrides, and set custom = true.
Format a language: add it to formatters_by_ft in lua/plugins/format.lua.
Machine-specific tweaks: create lua/local.lua (git-ignored), loaded last.
Switches
| Variable | Effect |
|---|---|
NVIM_MINIMAL=1 |
no mason or treesitter auto-installs; servers already on PATH still work |
NVIM_NO_NERD_FONT=1 |
plain-text icons |
Over SSH, copying goes through OSC 52 into your local clipboard. Inside tmux add set -g set-clipboard on.
Keys worth knowing
<Space> is leader. which-key shows the rest after a pause.
| Keys | Does |
|---|---|
<leader>sf sg sw s. |
find files / grep / word under cursor / recent files |
<leader><leader> |
buffers |
gd gr gI <leader>rn <leader>ca |
LSP: definition, references, implementation, rename, code action |
<leader>f |
format buffer |
<leader>a / <C-e> / <leader>1-4 |
harpoon: add / menu / jump |
[h ]h |
harpoon previous / next |
<leader>u |
undo tree |
<leader>gs |
git status (fugitive) |
<leader>hs hr hp hb |
gitsigns: stage / reset / preview / blame hunk |
<leader>pv |
netrw |
<leader>p (visual) |
paste over selection without losing the register |
<leader>S |
substitute word under cursor |
J K (visual) |
move selection |
Maintenance
:Lazy update, then commitlazy-lock.json. Other machines pick it up with:Lazy restore.:Masonfor language servers and tools,:checkhealthwhen something misbehaves.- Formatting:
stylua .(config in.stylua.toml).
Troubleshooting
- No syntax highlighting: parsers are built locally and need the
tree-sitterCLI plus a C compiler. mason installs the CLI on first launch, after whichnvimbuilds the parsers.scripts/doctor.shshows which piece is missing. - A server won't start:
:LspInfo, then:Mason. Servers installed through npm or pip neednpmorpython3(withvenv) on the machine. - Offline server: set
NVIM_MINIMAL=1and install what you need from your package manager.