Fork from Allanman's nvim config
This is my first Lua based Neovim (>=0.6) 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 on 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 fully featured status line via Lualine
- Terminal integration via nvim-toggleterm.lua
- Fancy notifications via nvim-notify
- Fast startup 🚀
- Telescope.nvim for all your search needs
- Project management with Project.nvim
- File tree navigation/manipulation via nvim-tree
- 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
- Convenient jumping through windows with nvim-window
- 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.
.
├── after
│ └── 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
├── plugin # packer_compiled
├── snippets # snippets for vsnip
└── spell # my spell files linked from another repo
| Mode | key | binding |
|---|---|---|
| n | space | Leader key |
| v | ga | Easyalign |
| n | gcc | Toggle line comment |
| n/v | gc | Toggle line comment (works with movements like gcip) |
| n | ⬆ ⬇ ⬅ ➡ | Resize panes |
| i | <c-l> | Move out of closing bracket |
| n | <c-h|j|k|l> | change pane focus (including Tmux panes) |
| n | <leader>space | switch to previously opened buffer |
| v | sa | Add surrounding |
| n | sd | Delete surrounding |
| n | sr | Replace surrounding |
| n | ss | Search 2 char forward (lightspeed) |
| n | S | Search 2 char backward (lightspeed) |
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.
If you want to follow my method adding a plugin is simple:
In lua/plugins.lua add the config to Packer. You are free to use a name for the configuration file (should be a valid filenam)
use {"<Address-of-the-plugin>", config = get_config("<name-of-the-plugin>")}Create lua/config/<name-of-the-plugin>.lua where you put the plugins settings. If your plugin does not require additional configuration or loading you can omit the config part.
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 PackerSync.
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-extractedgo 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
