my highly opinionated Neovim 0.10+ Lua config
-
modern nvim 0.10+ lua-based config with lazy.nvim package manager, telescope and LSP configured via nvim-lspconfig
-
complete package with useful plugins, autocommands, bindings and colorschemes
-
fully portable; place this repo anywhere you want (see below)
-
nicely structured and fine-tuned
init.luaconfig -
which-key: displays a popup with possible keybindings of the command you started typing
-
enhanced markdown editing with folding, fenced code highlighting and TOC
-
regex commands (like search/replace) with live preview; change directly in quickfix list
-
smart text objects: select text, then use
.to enlarge selection -
optional lo-fi mode without Nerd Font icons via
NVIM_STYLE=plain
Note: if you need something established and well maintained, backed by a large community to answer your questions, I highly recommend checking out:
First, you need to install Neovim. Then, follow one of the following methods:
- default location: follow
XDGenv conventions and put this config in~/.configto have./config/nvim - portable/custom location: custom location for this config by setting
XDGenv vars; see PORTABLE.md
cd
mkdir .config; cd $_
test -d nvim && mv -v nvim nvim.bck # save existing config
git clone https://github.com/sohooo/nvim.git
nvim
# plugin installation; see belowThis config uses lazy.nvim to manage Neovim plugins:
# start nvim using this config
# this will install all plugins
nvim
# restart nvim, then check if everything's there :)
:Lazy # plugins
:TSInstallInfo # Treesitter grammarsLSP servers, linters and formatters are not installed automatically. Install them with your system package manager so they are available on $PATH.
Helper scripts are provided to update and verify plugins:
./scripts/update-plugins.sh # upgrade plugins via lazy.nvim
./scripts/verify-plugins.sh # run headless test after updatesHere's a list of some useful keymaps. Just start typing and wait for the context-sensitive which-key popup. Try it with , (the Leader key) and wait to see further options. Alternatively, search through them with Legendary by hitting , <space>.
,ffind_files (ripgrep highly recommended),slive_grep ("search"),bbuffers
Telescope bindings to select/open files (same for nvim-tree):
<C-n|p>(insert mode) movement, completion; scroll lsp help docs with<c-j|k><C-t>open in tab<C-v>open in vertical split<C-x>open in horizontal split- toggle seletion with
(s)-tab - close selected buffers with
<c-d>
gd | gDpreview/goto definitiongi | gIpreview/goto implementiongr | gRpreview/goto referencesKshow docsga | gAalign | with preview- e.g.: to align markdown tables:
gA | <cr>✨
- e.g.: to align markdown tables:
gsshow signatur helpgpgo to preview actions,ccode actions:aactionrrenamesreformat file
,ttelescope stuff:etoggletermotodosrTroublesgo to symbol
,ggit actionssTelescope git statusgopen Neogit; README
,hhelp,rvim-test,hshow line diagnosticsC-n|p(command mode) jump to next|previous lsp diagnostics
tab, S-tabswitch buffers (close with,q)<cr> / <bs>exand / shrink selection (in normal mode)sleap.nvim; like 'f', but multiple lines;gsto jump to other splits,dtoggle nvim-tree; bindings;Ito toggle gitignore'd files,gLazygit floating terminal,utoggle UndoTreegcctoggle comment on/offkjremap of ESC<space> lclear search highlight<space> ktoggle node action (toogle bools, split/join hashes, ...),tetoggle terminal;:ToggleTermSendCurrentLineand other goodies, see README
maset marka; READMEm:apreview markadm-delete all marks in current linedm<space>delete all marks in current buffer
C-p|ncycle through elementsC-f|bjump to next/previous placeholder
Search and replace is like nothing you've ever experienced, thanks to Telescope and quickfix-reflector. Ok, let's say you want to replace the function foo with bar in some files in the project. Watch this:
- search for string:
,sto open Telescope live_grep, then enterfoo - put those results into the quickfix list with
<c-q>(watch this if you have no idea what the quickfix list is; send all selected items to qflist with<m-q>btw.) - now, edit the contents in the quickfix list! optionally remove lines you don't want to replace, then some kind of:
:s/foo/bar/g. We even get a preview of our replacement. - if we're happy,
:write the changes
:Tocdisplay table of contentszm, zO, ...usual folding syntax- fenced code blocks
Run ./tests/run.sh to check the configuration in a headless Neovim instance. The
script exits with an error if any warnings or errors occur.
The colorscheme and other goodies require a terminal with truecolor support. Sadly, that isn't the case for MacOS' Terminal. Currently I'm mostly using iTerm2.
For all the icons to show correctly, please use one of the Nerd Fonts. However, there's also a Lo-Fi mode/style available, which transparently removes all Nerdfont/Devicon requirements ✨ To use, just set the env var NVIM_STYLE=plain before calling this neovim config.