Vim and Nvim config

So at the moment I am trying out nixos in vbox on my freebsd laptop. Setup with zfs on root and everything is working great but I have a problem, well not a problem, but well I guess a question on setup options.

So I have a vimrc I use everywhere and have it in bitbucket to grab wherever. I use vundle for package management on other platforms. However although that works fine it does not work for Youcompleteme. So I have read about vim options to configure and well neovim is better and a workaround. I cannot get ycm to compile and frankly I have been thinking about switching to deoplete anyway.

Sorry going off on a tangent but looking what other developers who use vim as their ide on nixos do to manage packages. I don’t care if I grab the packages through nixpkgs (in fact I might prefer that). All I do prefer is that my .vimrc (or init.vim for neovim) can remain the same as it does in other places where I use vundle to manage packages.

Ken

1 Like

We have youcomplete and many other plugins in nixpkgs.
See https://github.com/NixOS/nixpkgs/blob/98686d3b7f9bf156331b88c2a543da224a63e0e2/pkgs/misc/vim-plugins/overrides.nix and https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/vim-plugins/generated.nix and https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/vim-plugins/overrides.nix

I use ncm2 in neovim, but we have ycmd and youcompleteme precompiled as well.

Here is how I manage mine: https://github.com/Mic92/dotfiles/blob/6c9a8461ac0cea223f7a33bdd80af8127ff304a5/nixpkgs-config/config.nix#L50
This adds a myvim package for the user that can be installed with home-manager or nix-env (nix-env -f '<nixpkgs>' -iA myvim)
You could still keep the vundle configuration in your vimrc but not running :PluginInstall on NixOS.

1 Like

I have a setup with vims builtin package management and nix that makes it possible to add plugins and their configuration in a modular way:

1 Like

That way I can still use my regular vimrc for the basic settings, but plugins are only available on nixos. I only really use plugins on my main workstation anyways, all other usecases are usually some quick config file editing where I only need the basic settings.

I tend to use plugins everywhere I might spend more than 10 minutes doing something. I should probably limit that. I am also thinking it is probably worth it to switch completely over to nvim for development and leave vim alone so I am used to it being more vanilla every place.

I am digging the nix way of doing many things. I need to take your example and see how it works for me as having nix handle the plugin load but the init.vim handle the setup is probably a better way to work on nix.

I loaded nix because replicating my config easily across installs as well as hearing it was “the best zfs on linux implementation” brought me to trying it out.

Things keeping me staying are allowing users to install user specific software without being part of the main system config and I am wanting to see how nix-shell can compare with some of my docker workflows. It reads to me as being similar to BSD jails.

Ken

Note that you can still install neovim with plugins as a user with my approach, but you do need nix for the plugins. So its a bit more involved than fetching you init.vim from some place and sticking it into the appropriate directory.

The advantages are that its “cleaner”. I like that I can just remove one of the pugins sets and have the plugin gone without a trace. Lazy loding is trivial. Plugins get updated with the rest of the system. All plugin magic happens statically, not at runtime.

I’m using nvim with plugins from nixpkgs + my custom plugins, all configured and managed by nix. Here’s my config https://github.com/kamilchm/.nixpkgs/tree/master/vim-config

So far I got neovim and deoplete with jedi completion working just fine. But looking at everything vundle is still handling the downloads to .vim/bundle. I did install the packages for these things through nix-env as well. I will see about getting to having nix-env truly handle these soon enough. Still have to get back to the printer issue.

Ken

Hey I would like to use Neovim but I’m not sure how to manage plugins using home-manager or nixOS. Do I really have to use a vim plugin manager to use plugins? Or can I just install the package vim-nix and enable it somehow?

I use veovim. You can take a look at my home-manager files. main files of interest are home.nix and vim.nix GitHub - jonringer/nixpkgs-config: ~/.config/nixpkgs

the installation of plugins in nix is taken care of, for you. (Technically uses a plugin manager under the cover, but this is abstracted away)

please take a look at my home-manager configuration for how this is done.