I’m trying to set up neovim to be i tiny bit nicer and more modern.
I was trying to search github for examples, but I only find huge elaborate bloated configurations which are hard to disect.
I have a base setup using home-manager, and all I want is for it to drop down suggestions for nix language (and maybe nixpkgs?). Highlighting nix syntax errors would also be nice.
And I would really want it to stay small and not bloated. Having a language server running in bg, eating 1+GB of ram is not an option.
You can run distrobox on Nixos.
So you can then run a plain vanilla Linux OS, and run Neovim from there.
There are lots of choices for how to run Neovim within Nixos. It can be overwhelming. Sticking Nixvim on Home Manager seems to be the fashionable route.
Thereafter the complexity of the setup is up to you. You can just stick all your config in one file…
I’ve really enjoyed the kickstart.nvim template. Everything is clear and documented and it’s helped me set neovim the way I want to.
For the LSP side, I’m passing the tools I need from home-manager like this and in neovim I it check if I’m in NixOS like this so it doesn’t install the tools through Mason, but still load them in lsp-config. The advantage of doing this is that my config is portable in other distros where Mason will download the tools I need.
There is kickstart-nix.nvim which is based on kickstart.nvim and is tailored to run on Nix out of the gate, so I suggest you take a look at that first if you want something simple that just works.
Just to make something clear: to have nix & nixpkgs autocompletion, you need a tool to provide those. And given the structure of Nix I believe the only thing to properly provide that is nil - which in your words is “too bloated”. Your request is not “just autocompletion”', in technical terms it’s “even autocompletion”. It might be possible to get autocompletion for “simple” languages like C without an LSP (e.g. by using ctags), but it’s hard (or even impossible?) for functional languages like Nix.
I know your situation. I’ve been in more than enough situations where I just wanted something seemingly simple. But this sadly doesn’t work out most of the time. I’d recommend you take 2-3hours to try and write your own configuration. It took me over a year to take that step for neovim (have used vim for forever, just didn’t want to learn the nvim lua style when I decided to switch back from emacs) and I finally wrote a config a few months ago. It’s well worth it IMO
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
{
'folke/neodev.nvim',
opts = {
library = {
runtime = false, -- runtime path
types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
plugins = false, -- installed opt or start plugins in packpath
},
},
},
The lua lsp won’t autocomplete plugin/runtime, but at least it won’t start with 1GB+ of memory.
i understand that i have to have some kind of LSP, but what I would consider bloated is if that LSP requires 100 nodejs modules and is eating 500+ MB of ram - then I’d better just stretch my human memory a bit
I was very much expecting possibility that such setup is impossible, so no problem with that. I do have my minimal vim config, so it works both in tty, and in graphical mode, and eats below 10 MB of ram, i just wanted to improve it with LSP features while trying to keep it minimal.
now that is interesting - will try it too
googling Helix…
first thoughts:
oh my, having hotkeys similar to vim, but not the same just broke my brain
It seems that it doesn’t come with embedded LSPs, so then what benefit do I get in switching? it seems that my original question would apply to helix the same way, no?
Then when you open a nix file, nil will be automatically configured and working.
I find helix to be quite fast and comfortable since it shares a lot of its default keys with vim. However, it still lacks a lot of things (no file tree ) and is still not as extensible as Neovim. Hopefully this gets solved in the future, though.
This is the first time I use it so I’m not sure, but I suppose you can remap your keys. Maybe you can look around, there is a possibility that someone has already done this.
You can also read the documentation and try to run it for a few days to see how it feels.
[]/.config/helix took 6s ln
drwxr-xr-x - marcus 2 mai 07:53 .
.rw-r–r-- 249 marcus 16 mai 18:58 ├── config.toml
.rw-r–r-- 558 marcus 16 mai 21:37 └── languages.toml