π» This configuration works on my NixOS Linux as well as on my macOS. It requires and is tested with Neovim >= 0.10. It should run with Neovim 0.9.5 but I can't recommend it.
Have a look at my rice how my Linux machine is configured and at my mac-setup how my MBP is configured. My dotfiles are also on GitHub.
Terminal: alacritty
Font: Jetbrains Mono
There are many great Neovim configurations (see Inspiration), that give you a pleasant experience right out of the box, available. However, I am a long time (Neo)Vim user with a specific workflow and needs. Additionally, I do not have any Lua background and was not willing to spent too much time into that. Therefore, it was quite hard for me to customize and strip down the existing configs to my needs especially because the code is quite sophisticated.
I decided to move to my own fresh Lua based Neovim from my good old vimrc trying to accomplish the following principles.
- Migrate to Lua based alternative plugins respectively use only Lua based plugins (if possible).
- Keep the config as maintainable as possible knowing that this would possibly impact the code quality.
- Modular and meaningful directory structure and file naming.
- Just make it work and not make it beautiful π. Of course, Neovim itself must look beautiful, but my focus is not on beautiful code or on utilizing all Lua features.
- Package management and plugin configuration via lazy.nvim
- Mnemonic keyboard mappings inspired by Spacemacs via which-key.nvim; no more than three keystrokes for each keybinding
- Complete transformation via noice.nvim
- Fully featured status line via lualine.nvim
- Terminal integration via nvim-toggleterm.lua
- Fancy notifications via nvim-notify
- Search and replace frontend via nvim-spectre (optional)
- Better writing with ltex-ls
- Dashboard via alpha.nvim
- Multiple preconfigured themes like catppuccin, tokyonight, nightfox, and more
- AI assistance with ChatGPT.nvim, gp.nvim, copilot.lua (optionally), and supermave-nvim (optionally)
- Health check via
checkhealth core
- Lazy loading plugins (19 of 95 in my case)
- Startup <= 40 ms π
- Telescope.nvim for all your search needs
- Project management with Project.nvim
- File tree navigation/manipulation via neo-tree
- Alternative file handling via oil.nvim (optional)
- LF integration via lf.nvim (optional)
- yazi integration with yazi.nvim
- Miller columns file navigation via mini.files
- Better Tmux navigation with your home row via Navigator.nvim
- Auto-completion powered by nvim-cmp
- Built-in LSP configured via nvim-lspconfig, mason, and mason-lspconfig
- Debugging for Go and Python via nvim-dap and friends
- Treesitter and Tresitter-textobjects for your syntax needs
- Auto formatting via conform.nvim
- Linting via nvim-lint
- Excellent Go support via LSP including sensible keybindings
- Always know where you are in your code via nvim-navic
- Git integration via Neogit and gitsigns
- Outlining symbols with outline.nvim
- Snippets provided by Luasnip and friendly snippets with autocompletion
- Schema integration via LSPs for Kubernetes, package.json, GitHub workflows, gitlab-ci.yml, kustomization.yaml, and more
- GitHub Copilot integration via copilot.lua (optional)
- Taskrunner via Overseer (optional)
- Check your code with trouble.nvim
If you have Docker on your system you can try out this configuration.
π‘ Due to installing required tools like LSPs, CLI apps, etc. the image is approximately 3 GB large
There is a GitHub action in place that builds and pushes the Docker image to Dockerhub as allaman/nvim
docker run --name nvim --rm -it allaman/nvim
docker run --name nvim --rm -it -v ${HOME}/tmp:/home/nvim/mount allaman/nvim
docker run --name nvim --rm -it --entrypoint=/bin/bash allaman/nvim
You can also build the image on your own
docker build -t nvim .
Replace allaman/nvim
in the former commands with just nvim
.
There are some tools that are required in order to use some features/plugins:
Run :checkhealth core
to check the status.
For the neo-tree delete functionality:
For Latex functionality:
The following programs should be installed on your system so that the appropriate tools can be installed:
- Go
- Python
- NodeJs > 12
- Cargo
All other dependencies are managed by Mason. Tools are installed by running :MasonToolsInstall
(in vim.fn.std path("data") .. "mason"
). Mason requirements must be available on your system.
Some bindings can be overwritten in your user config file. See ./lua/core/config/defaults.lua
for possible settings.
Mode | key | binding |
---|---|---|
n | space | Leader key |
n | <c-h | j | k | l> | Change window focus (including Tmux panes) |
n | <leader>Tab | Switch to previously opened buffer |
n | <Tab> | Switch to next buffer (bnext) |
n | <S-Tab> | Switch to previous buffer (bprevious) |
n | st | Visual selection with Treesitter hint textobject |
v | sa | Add surrounding |
n | sd | Delete surrounding |
n | sr | Replace surrounding |
n | <c-Tab> | Start auto completion |
n/v | ga | Start mini.align (align text) |
n | gcc | ToggleΒ line comment |
n/v | gc | ToggleΒ line comment (works with movements like gcip ) |
n | ss | Jump to character(s) (flash.nvim) |
i/s | <c-j> | Luasnip expand/forward |
i/s | <c-k> | Luasnip backward |
i | <c-h> | Luasnip select choice |
n | <c-n> | Toggleterm (opens/hides a full terminal in Neovim) |
i | <c-l> | Move out of closing brackets |
n | <CR> | Start incremental selection |
v | <Tab> | Increment selection |
v | <S-Tab> | Decrement selection |
n | <c-f> | Search buffer |
i/v/n/s | <c-s> | Save file |
n | <leader>Rr | Toggle Search and Replace (via Spectre) |
n | <leader>Rw | Search (and replace) current word (via Spectre) |
n | <leader>Rf | Search (and replace) in current file (via Spectre) |
n | <leader>Rc | Replace current selection (in Spectre) |
n | <leader>RR | Replace all (in Spectre) |
n | :LtexLang <lang> | Set a specific language like "de-DE" for ltex-ls |
n | <leader>mc | Enable GitHub Copilot (if plugin is enabled in your user config) |
n | <leader>tr | Toggle Overseer (if plugin is enabled in your user config) |
n | <leader>r | OverseerRun (if plugin is enabled in your user config) |
n | <leader>lf | yazi.nvim or lf.nvim (if enabled in your user config) |
n | <leader>tz | Toggle distraction free mode (if plugin is enabled in your user config) |
n | <leader>tF | Disable auto formatting (if conform.nvim is enabled in your user config) |
n | <leader>tL | Disable linting (if nvim-lint is enabled in your user config) |
Hit <leader>
to start which-key
which gives you more mappings grouped by topic.
β― tree -L 1 .
.
βββ after # file specific settings
βββ config-example.lua # user-config file
βββ init.lua # main entry point
βββ lazy-lock.json # Lockfile for Lazy.nvim
βββ lua # lua configuration
βββ snippets # snippets directory (luasnip style)
βββ spell # my spell files linked from another repo
β― tree -L 1 lua
lua
βββ config # Neovim config and user-config handling
βββ core # checkhealth and plugins
βββ utils # utilities
β― tree -L 1 lua/config
lua/config
βββ autocmds.lua # autocmds
βββ defaults/ # default configuration
βββ init.lua # entry point
βββ lazy.lua # plugin management
βββ mappings.lua # "global" key mappings
β― tree -L 1 lua/core
lua/core
βββ health.lua # :checkhealth core
βββ plugins # plugins and their config
Each plugin to be installed is defined in ./lua/core/plugins/
in a separate file.
The intention of my Neovim configuration was never to be a fully customizable "distribution" like LunarVim, LazyVim, SpaceVim, etc. but from time to time I like to change my color scheme and the idea of making this configurable came to my mind. Based upon this idea I implemented some further configuration options that might be useful.
The default configuration can be found in ./lua/config/defaults.
You can overwrite any of this configuration by writing a .nvim_config.lua
file that follows the same structure as the default table and pick only those keys that you want to modify. Have a look at my user configuration in my dots repo. The configuration file should be placed in $XDG_CONFIG_HOME
, $HOME
, or the windows equivalent path.
You can start with cp ./config-example.lua $HOME/.nvim_config.lua
.
You can remove unwanted plugins by just removing the appropriate file in ./lua/core/plugins/
. Lazy will take care of removing the plugin. You should also clean up any default configurations in ./lua/config/defaults.
Keep in mind that some plugins are configured to work in conjunction with other plugins. For instance, autopairs is configured in ./lua/core/plugins/treesitter.lua
. For now there is no logic implemented that cross-checks such dependencies.
If you want to follow my method adding a plugin is straight forward:
Create a file in ./lua/core/plugins/
following the expected format of Lazy.
Open another instance of Neovim (I always try to keep one running instance of Neovim open in case I messed up my config) and run Lazy sync
.