My personal Neovim config, Lua-only, from scratch where "scratch" means a bunch of plugins supplemented with personal quirks.
Assumes macOS and Neovim 0.9+.
brew tap homebrew/cask-fonts
brew install neovim ripgrep fzf bat git-delta gnu-sed fd rg lazygitYou'll also need node, golang, zig and zstd to auto-install language servers (zstd is used to compress the Zig language server):
brew install node golang zig zstdThen:
mkdir ~/.config && cd ~/.config
git clone https://github.com/nickcernis/neovim-config nvimOptionally set the theme for bat to match Neovim, so that preview colours match:
mkdir -p "$(bat --config-dir)/themes"
cd "$(bat --config-dir)/themes"
curl -O https://raw.githubusercontent.com/folke/tokyonight.nvim/main/extras/sublime/tokyonight_night.tmTheme
bat cache --build
bat --list-themes | grep tokyo # should output "tokyonight_night"
echo '--theme="tokyonight_night"' > "$(bat --config-dir)/config"├── README.md -> You are here.
├── init.lua -> ASCII art and includes.
├── lazy-lock.json -> Plugin lockfile updated by Lazy.
├── local-plugins/ -> Personal plugins not yet released publicly.
└── lua
└── config
├── autocommands.lua -> Auto-strip whitespace, file picker on load.
├── keymaps.lua -> Do things when you press things.
├── lazy.lua -> Bootstrap the Lazy plugin manager.
├── options.lua -> General settings.
└── plugins -> Plugin configs, loaded automatically by Lazy.
├── [plugin1].lua
├── [plugin2].lua
└── [...].lua
<space> f pto find files in current project.<space> f fto find lines in current file (similar to swiper in Emacs).<space> f gto search text in current project (backed by ripgrep).<space> eto toggle the file tree. (Thenato create,e|r|Ctrl-rto edit,dto delete,?for help,Ctrl-eto close.)<space> mfor mini file browser: create, edit, or move files by editing the nav buffer then press = in normal mode to commit changes. Browse with hjkl.<space> f jfor the project switcher.<space> f bfor buffer list, then Ctrl-x to close buffer.<space> f yfor LSP symbols list.<space> f sfor git status, left to stage, right to unstage.<space> jfor word jump targets.<space> tfor tab jump targets.Ctrl-hto go back in jump list (also reopens closed buffers).Ctrl-lto go forward, :FzfLua jumps for a visual view.Ctrl-wto close the buffer.Ctrl-qto save all and quit.Ctrl-rto find-replace across project (uses Grug Find and Replace).Ctrl-j|Ctrl-k|Ctrl-[number]to navigate tabs.
I use these in normal mode in place of the default Ctrl-w window commands, since I map Ctrl-w to close buffer:
<space> w vto split vertically.<space> w sto split horizontally.<space> w hto move cursor left.<space> w lto move cursor right.<space> w rto rotate buffers between window.<space> w d|xto close the window.<space> b d|xto close the buffer.
<space> g hto display a GitHub CLI UI.<space> h pto preview a git hunk.<space> h rto reset a git hunk.<space> h Rto reset the current buffer.<space> h sto stage the hunk.<space> h Sto stage the buffer.
Kto show LSP hints.glto show LSP issues.gdto go to definition and Ctrl-o to return.grto show references and :q to exit.F2to rename current cursor position.F4for code actions on the current cursor position.Ctrl-;to format the current buffer or selection if the LSP server provides formatting support.
:Lazyto update/install plugins.:FzfLuafor all FzfLua pickers.:Masonto manage LSP servers.:LspInfois sometimes useful, as is:LspInstall.
Managed with Lazy, which gives us a lockfile, automatic caching and bytecode compilation, a smart upgrade/install UI with load time reports, and easy plugin config split across files.
Configs in ./lua/config/plugins/ are automatically loaded.
:Lazy summons the plugin UI.
Things to explore:
- Format pasted code when it's pasted. https://github.com/ConradIrwin/vim-bracketed-paste
- Hex editor backed by xxd: https://github.com/RaafatTurki/hex.nvim
- Disable or adjust swap file handling? https://neovim.io/doc/user/recover.html
- Check how file handling works if open buffers are deleted outside of nvim, such as when when switching git branch.
- Explore writing modes, perhaps https://github.com/Pocco81/true-zen.nvim or https://github.com/folke/zen-mode.nvim.
- Look at neural and similar? https://github.com/dense-analysis/neural or https://github.com/zbirenbaum/copilot.lua or https://github.com/Bryley/neoai.nvim
- Task runner for cargo run etc. with jump-to-line for compiler errors, via quickfix lists or other.
- Play with replacer: https://github.com/gabrielpoca/replacer.nvim
- Try tabout: https://github.com/abecodes/tabout.nvim
- Crates and package.json version number helpers: https://github.com/Saecki/crates.nvim
- Explore https://github.com/roobert/search-replace.nvim.
I use panes or tabs instead of Neovim's terminal emulation. Long-running terminal processes in Neovim itself reduce editor performance for me. (If I open a toggleterm, then run yes and toggle the terminal closed, Neovim movements and edits lag for me.)
I use git and GitHub CLI in the terminal, as well as lazygit in a separate long-running terminal tab.
- Plugin ideas: https://neovimcraft.com/
- More plugin ideas: https://github.com/rockerBOO/awesome-neovim
- New stuff every week: https://this-week-in-neovim.org/
- The semi-official starter config. A little scrappy but worth reading: https://github.com/nvim-lua/kickstart.nvim/blob/master/init.lua
- Opinionated starter distribution using custom plugins: https://nvchad.com/Features
- Less opinionated starter distributions using off-the-shelf plugins: https://astronvim.github.io/ and https://www.lunarvim.org/
- An overview of Neovim's LSP configuration spaghetti: https://roobert.github.io/2022/12/03/Extending-Neovim/