my highly opinionated neovim 0.9+ lua config
- modern nvim 0.9+ lua-based config with lazy.nvim package manager, telescope and lsp-zero
- 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.loa
config - which-key: displays a popup with possible keybindings of the command you started typing
- enhanced markdown editing with folding, fenced code hightighting and TOC
- regex commands (like search/replace) with live preview; change directly in quickfix list
- smart text objects: select text, then use
.
to enlage selection
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
XDG
env conventions and put this config in~/.config
to have./config/nvim
- portable/custom location: custom location for this config by setting
XDG
env 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 below
This config uses lazy.nvim to manage Neovim plugins. To install them, you do one of the following:
# start nvim using this config
# this will install all plugins
nvim
# install some LSP servers;
# NOTE: currently disabled, bring your own!
# more can be installed via :Mason
# :MasonInstallAll
# restart nvim, then check if everything's there ;)
:Lazy # plugins
:TSInstallInfo # Treesitter grammars
# :Mason # LSP server, linter, formatter, ...
Here'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>
.
,f
find_files (ripgrep highly recommended),s
live_grep ("search"),b
buffers
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 | gD
preview/goto definitiongi | gI
preview/goto implementiongr | gR
preview/goto referencesK
show docsga | gA
align | with preview- e.g.: to align markdown tables:
gA | <cr>
✨
- e.g.: to align markdown tables:
gs
show signatur helpgp
go to preview actions,c
code actions:a
actionr
renames
reformat file
,t
telescope stuff:e
toggletermo
todosr
Troubles
go to symbol
,g
git actionss
Telescope git statusg
open Neogit; README
,h
help,r
vim-test,h
show line diagnosticsC-n|p
(command mode) jump to next|previous lsp diagnostics
tab, S-tab
switch buffers (close with,q
)<cr> / <bs>
exand / shrink selection (in normal mode)s
leap.nvim; like 'f', but multiple lines;gs
to jump to other splits,d
toggle nvim-tree; bindings;I
to toggle gitignore'd files,g
Lazygit floating terminal,u
toggle UndoTreegcc
toggle comment on/offkj
remap of ESC<space> l
clear search highlight<space> k
toggle node action (toogle bools, split/join hashes, ...),te
toggle terminal;:ToggleTermSendCurrentLine
and other goodies, see README
ma
set marka
; READMEm:a
preview marka
dm-
delete all marks in current linedm<space>
delete all marks in current buffer
C-p|n
cycle through elementsC-f|b
jump 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:
,s
to 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,
:w
rite the changes
:Toc
display table of contentszm, zO, ...
usual folding syntax- fenced code blocks
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.