This is my first Lua based NeoVim (>0.5) configuration. My goal was to achieve the same functionality as my old vimrc and move onwards to a full Lua based configuration and Lua based plugins especially the promising builtin LSP and Treesitter.
💻 This configuration is working on my Manjaro Linux as well as on my macOS!
Have a look at my rice how my Linux machine is configured and at my mac-setup how my MacBook is configured. The Tmux configuration you can see in the image is here (as well as my other dotfiles).
There is a number of great NeoVim configurations online (see Inspiration) that give you a pleasant experience right out of the box. 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.
So I decided to move to a fresh Lua based NeoVim on my own trying to accomplish the following principles:
- At least feature parity with my mentioned old vimrc (my lua config is superior almost since day one (or two 😉)).
- Migrate to Lua based alternative plugins.
- Keep the config as simple 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 utilizing all Lua features.
- Package management and plugin configuration via Packer
- Mnemonic keyboard mappings inspired by Spacemacs via which-key.nvim; no more than three keystrokes for each keybinding
- Minimal yet awesome status line via Lualine
- Terminal integration via nvim-toggleterm.lua
- Startup in under 60ms 🚀
- Telescope.nvim for all your search needs
- Project management with Project.nvim
- File tree navigation/manipulation via nvim-tree
- Informative sidebar via sidebar.nvim
- Easy Tmux navigation with your home row via Navigator.vim
- Buffer management via Bufferline.nvim
- LF integration via lf.vim for a full featured file manager in Neovim
- Auto completion powered by nvim-cmp
- Built-in LSP configured via nvim-lspconfig
- Treesitter and Tresitter-textobjects for your syntax needs
- Asynchronous auto formatting via Formatter.nvim
- Excellent Go support via LSP and go.nvim including sensible keybindings
- Git integration via Neogit, gitsigns, git-blame, and gitui
- Schema integration via LSPs for Kubernetes, package.json, github workflows, gitlab-ci.yml, kustomization.yaml, and more
- YAML navigation via yaml.nvim; useful for your hundreds of lines of Kubernetes manifests 😉
Each plugin to be installed is defined in plugins.lua
and each plugin has its own configuration file (if necessary) in lua/config
which is loaded by packer.
.
├── ftplugin/ # file specific settings
├── init.lua # main entry point
├── lua
│ ├── autocmd.lua # vim autocommands
│ ├── config/ # each plugin configuration is in its own file
│ ├── mappings.lua # Vim keymaps defintions -> config/which.lua for more
│ ├── options.lua # non plugin related (vim) options
│ └── plugins.lua # define plugins to be managed via Packer
├── plugins # packer_compiled
├── snippets # snippets for vsnip
└── spell # my spell files linked from another repo
Mode | key | binding |
---|---|---|
n | space | Leader key |
v | ga | Easyalign |
v/n | gcc | Toggle line comment |
n | ↑ ↓ ⟶ ⟵ | Resize panes |
i | Move out of closing bracket | |
n | <c-h|j|k|l | change pane focus (including Tmux panes) |
See ./lua/config/which.lua
for details.
key | cluster |
---|---|
b | Buffer management |
c | Language specific actions (only in Go, e.g. run tests) |
f | File management |
g | Git actions |
h | Harpoon integration |
l | LSP integration |
m | Misc stuff |
s | Searching |
t | Trouble integration |
w | Window management |
x | Languagetool integration |
y | YAML integration (only in YAML files) |
z | Spell bindings |
Basically, you can remove unwanted plugins by just removing the appropriate line in ./lua/plugins.lua
and, if applicable, delete its configuration file in ./lua/config/
.
ℹ️ Keep in mind that some plugins are configured to work in conjunction with other plugins. For instance, autopairs is configured in ./lua/config/treesitter.lua
. For now there is no logic implemented that cross-checks such dependencies.
There are some tools that are required in order to use some features/plugins:
- prettier
- gofmt
- terraform fmt
- luarocks and
luarocks install --server=https://luarocks.org/dev luaformatter
- black
For the builtin LSP (see lspconfig for more info about LSP configuration)
sudo npm i -g bash-language-server dockerfile-language-server-nodejs yaml-language-server typescript typescript-language-server vscode-langservers-extracted
go get golang.org/x/tools/gopls
(optionalgolangci-lint
,gomodifytags
,gorename
)- terraform-ls
- texlab and tectonic
- lua-language-server
- For advanced spell checks via vim-grammarous Java 8+ is required