Skip to content

Instantly share code, notes, and snippets.

@dzintars
Last active March 19, 2022 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzintars/6155bbeeff66830d7f715a55d42cdbb3 to your computer and use it in GitHub Desktop.
Save dzintars/6155bbeeff66830d7f715a55d42cdbb3 to your computer and use it in GitHub Desktop.
Neovim setup

My Neovim setup

https://github.com/oswee/prime/ansible/custom/roles/nvim

Structure

99% of the config examples i saw in the wild gives me a feeling that people actually don't know what they are doing with Neovim configuration. Neither I do. But I am questioning myself: How to structure configuration in a clean, modular, swappable, easy to read and navigate way. There, in the wild, I see things like: "Throw it all in a single file", "Plugins are evil, vanilla Vim is all I need", "I will leave that dead code for the reference in case if I need it", "Italian Copy Pasta" and many, many more variations.

While the primary target must be "to get things done", I don't want to maintain the garbage. Neovim and its plugin ecosystem is rapidly evolving. Many plugins encounter renaissance and become rewritten in Lua. A lot of breaking changes are introduced. This requires constant maintenance of my configuration.

For me, it means that the maintenance and discoverability should be extremely transparent. Plugin configurations should be decoupled as much as possible. They should be easy unpluggable.

So far I came up with somewhat structure I think I like.

All my configuration is written in Lua because currently I don't use things which are configured in VimScript. My configurations is organized in modules. Core, UI, Edittor, LSP, Completion and others. Each module can be turned on or off. Each module handles its own set of Packer plugins. So, if I turn off the module, plugins also gets uninstalled to not mess up with the other configurations.

Whole configuration is managed by Ansible role/s. Ansible tasks are responsible to inject the modules into init.lua so that I can develop and test modules separately without running whole Ansible Nvim role. Actually I have 2 Ansible roles. The oswee.generic.nvim one just installs the bare Neovim from sources. I plan to make simple toggle to switch between distribution Neovim package or to installation from sources. And the oswee.custom.nvim role which does all the personal customization. On top of that, booth roles is tested with Molecule in the virtual machine.

... to be continued

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment