This is my nvim configuration. I use it to work with rust and go lang programs (LSP). But highlight works for all maintained languages with tree-sitter. It should be easy to add new languages.
There can be more binaries that are required but some could be installed already in my OS use checkhealth
Arch-linux based systems
sudo pacman -S ripgreap \ # for telescope
tar curl \ # nvim-treesitter
community/wl-clipboard # allow copy/past to `+` register (system) on Wayland
pamac build stylua-bin
go install github.com/lighttiger2505/sqls # for SQL support with LSP (need configuration file in $HOME/.config/config.yml)
LSPs:
sudo pacman -S \
lua-language-serve \
rust-analyzer rust \
go gopls revive \ # golang
Ubunut based systems
TODO
Download neovim configuration:
git clone https://github.com/xoac/nvim ~/.config/
Next you need to run nvim
(you got some errors) and then :PackerSync
. Unfortunately you need to close nvim
and repeat procedure until you are out of errors (this is bug).
This configuration uses a different approach than the standard ones. Most of them have a struct of files like this:
Standard structure
├── init.lua
├── lua
│ ├── keymap
│ │ ├── buffer.lua
│ │ ├── escape.lua
│ │ ├── global.lua
│ │ ├── init.lua
│ │ ├── lsp.lua
│ │ ├── move.lua
│ │ ├── neovide.lua
│ │ ├── resize.lua
│ │ ├── toggleterm.lua
│ │ └── window.lua
│ ├── lsp
│ │ ├── config
│ │ │ ├── init.lua
│ │ │ ├── rust.lua
│ │ │ ├── s-lua.lua
│ │ │ ├── styl.lua
│ │ │ └── ts-js.lua
│ │ ├── init.lua
│ │ ├── lsp-setup.lua
│ │ └── ts-js-deno.lua
│ ├── packer
│ │ ├── loader.lua
│ │ ├── plugins.lua
│ │ └── settings
│ │ ├── alpha.lua
│ │ ├── autopairs.lua
│ │ ├── bufferline.lua
│ │ ├── compe.lua
│ │ ├── format.lua
│ │ ├── kommantary.lua
│ │ ├── luasnip.lua
│ │ ├── nvimtree.lua
│ │ ├── snippets
│ │ │ ├── global.lua
│ │ │ ├── init.lua
│ │ │ ├── lua.lua
│ │ │ └── rust.lua
│ │ ├── toggleterm.lua
│ │ ├── treesitter.lua
│ │ ├── which-key.lua
│ │ └── windline.lua
│ ├── settings.lua
│ └── terminal.lua
My approach should be simpler, and looks like this:
One plugin one file approach
├── init.lua
├── lua
│ ├── packer
│ │ ├── loader.lua
│ │ └── plugs
│ │ ├── bufferline.lua
│ │ ├── comment.lua
│ │ ├── formatter.lua
│ │ ├── gitsigns.lua
│ │ ├── indent-blankline.lua
│ │ ├── init.lua
│ │ ├── lightbulb.lua
│ │ ├── lsp
│ │ │ ├── go.lua
│ │ │ ├── init.lua
│ │ │ ├── rust.lua
│ │ │ └── sql.lua
│ │ ├── luasnip.lua
│ │ ├── nvim-treesitter.lua
│ │ ├── packer.lua
│ │ ├── renamer.lua
│ │ ├── telescope.lua
│ │ ├── tokyonight.lua
│ │ ├── trouble.lua
│ │ ├── twilight.lua
│ │ ├── which-key.lua
│ │ └── windline.lua
│ └── settings.lua
The rules are:
- In
lua/packer/plugs/init.lua
- one line, one plugin - in
lua/packer/plugs/<plug_name>.lua
- one file, one plugin with settings and key mapping - In
lua/packer/plugs/<folder>
- a group of plugins that add special functionality. In my case LSP - There are 2 plugins that should be accessible everywhere:
packer
with global variablepacker
- used to add more pluginswhich-key
that should be accessed withlocal wk = require("which-key")
and this is suggested way to add new key mapping
Example benefits of this approach:
- disable one plugin with all settings and key mapping, all you need is to comment one line in
/lua/packer/plugs/init.lua
- conflict key mapping you can check with
checkhealth which-key
- if you want modify plugin settings you only look in one file.
- should be simpler for beginners
I was looking for inspiration in this repositories:
Feel free to open PR or issue.