set up my neovim config
4m read
on this page
i keep the config i use in nvim-sektant. this guide installs it under a separate name so you can try it alongside your current setup. the project page explains what is in it.
##before cloning
these commands are for linux and macos with bash or zsh. install the current stable neovim release first, then check which version your terminal runs:
nvim --versionyou also need git, make, unzip, tar, curl and a c compiler. telescope's search
uses ripgrep; fd is useful for finding files. the config uses the main branch
of nvim-treesitter, which requires the tree-sitter cli, currently version
0.26.1 or newer.
install node.js and npm for javascript/typescript tooling. language tools have their own requirements: python needs a python installation, and c# tooling needs the .net sdk. install cmake and a c++ compiler for c++ projects. mason downloads editor tools, but does not replace those runtimes or project dependencies.
select a nerd font in your terminal, or set vim.g.have_nerd_font = false in
init.lua after cloning.
##install alongside your current config
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}"
git clone https://github.com/sektant1/nvim-sektant.git \
"${XDG_CONFIG_HOME:-$HOME/.config}/nvim-sektant"
env NVIM_APPNAME=nvim-sektant nvimNVIM_APPNAME changes
the directories neovim uses for config, data, state and cache. this launch reads
nvim-sektant; a plain nvim still reads your usual config. if the clone
destination already exists, git stops rather than replacing it.
lazy.nvim installs plugins on the first launch. let it finish, then close and reopen with the same command. mason and treesitter also download language tools and parsers, so the first setup needs internet access.
##check the first launch
this config swaps : and ; in normal mode. press ; to open the command line,
then type Lazy and press enter. the commands below use vim's usual : notation:
:Lazy
:Mason
:checkhealth
:checkhealth nvim-treesitterif a download or parser build fails, check the error before retrying. missing
tree-sitter, a missing compiler, or an unavailable language runtime will not be
fixed by repeatedly restarting neovim. :ConformInfo shows which formatter is
available for the current file.
the leader is space. Space sg means press space, then s, then g in normal
mode. capital letters matter.
##where to change things
init.lua: Leader key, Nerd Font setting, and module loadinglua/keymaps.lua: Editor mappings and plugin shortcutslua/options.lua: Editor optionslua/lazy-plugins.lua: Plugin list and custom plugin importslua/kickstart/plugins/lspconfig.lua: Language servers and Mason toolslua/kickstart/plugins/conform.lua: Formatters and format-on-save settingslua/custom/plugins/: Extra plugin specssnippets/: C and C++ snippets
The mappings include a few departures from default Vim:
;: Opens the command lineo/O: Add a blank line without entering Insert mode
Read lua/keymaps.lua before replacing shortcuts you already know.
The repository is where I keep subsequent changes.
##key mappings
Space Space: Find a file with TelescopeSpace sg: Search text in the projectSpace e: Open the current directory in OilSpace sk: Search the configured keymapsSpace sn: Find a file in this Neovim configSpace w: Save the current file if it changedgrd: Go to definition when an LSP is attachedgrn: Rename a symbol when an LSP is attachedCtrl-f: Format the bufferF5/F6: Pick a project script / rerun the last scriptSpace n/Space N: Open the global note / project noteSpace bb/Space bc: Toggle a breakpoint / start or continue debugging
o and O insert blank lines but stay in normal mode in this config. press i
when you want to start typing. the mappings live in lua/keymaps.lua if you want
to restore vim's defaults.
##keep a launch command
add this to ~/.bashrc or ~/.zshrc, then open a new terminal:
alias nvim-sektant='env NVIM_APPNAME=nvim-sektant nvim'you can pass a project directory or file as usual:
nvim-sektant .
nvim-sektant src/main.cpp##make it yours
start with lua/options.lua and lua/keymaps.lua. plugin specs live under
lua/kickstart/plugins/ and lua/custom/plugins/. clanger's spec contains my
name and an ENG namespace for generated c++ files; replace those with yours.
fork the repository if you plan to keep changes. it ignores lazy-lock.json;
remove that ignore entry and commit your lockfile to record the plugin versions
you installed. :Lazy restore uses that file to restore plugin revisions.
the older neovim post covers starting from
kickstart. this guide follows my config at
6939e01,
including its own keymaps and plugins.