Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim-plug and Nixos? #1010

Closed
peterstorm opened this issue Aug 30, 2020 · 4 comments
Closed

vim-plug and Nixos? #1010

peterstorm opened this issue Aug 30, 2020 · 4 comments
Labels

Comments

@peterstorm
Copy link

Hello!

I really, really like vim-plug, but at the moment I am installing Nixos on all my systems, and it's a bit of a hassle to get vim-plug to be my prefered plugin manager, because I haven't figured out how to get vim-plug to start, without putting plug.vim in the corret autoload folder, but I have no idea how to do that with Nixos configuration files.

I have a vim.nix file where I override neovim, and ask it to start with vim-plug, but that doesn't seem to work. Anyone have any ideas?

with import <nixpkgs> {};

neovim.override {
  configure = {
    customRC = builtins.readFile "/home/peterstorm/.config/nvim/init.vim";
    packages.myVimPackage = with pkgs.vimPlugins; {
      start = [ vim-plug ];
    };
  };
}
@janlazo
Copy link
Collaborator

janlazo commented Aug 30, 2020

Did you check NixOS/nixpkgs#56338?

@peterstorm
Copy link
Author

Did you check NixOS/nixpkgs#56338?

I did skim it, but reading it again, I'm not sure there is anything in there that can help me :(
I just want to autoload vim-plug through my configuration file, without having to manually install vim-plug and then copy it from the store to the autoload dir.

@junegunn
Copy link
Owner

This is not something we can answer. Please use the issue tracker of NixOS.

FWIW, you can set up your Vim configuration file to automatically download vim-plug.

@grwlf
Copy link

grwlf commented Aug 21, 2022

I'm working on my test vim configuration in a Nixos project. vim-plug almost works for me, with the following configuration

  {
   # ...
    plugvim = pkgs.vim_configurable.customize {
      name = "plugvim";

      vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
        start = [
          vim-plug 
          # Below is an example of how to modify the plugin before installation.
          # This particular modification doesn't work for me.
          # (vim-plug.overrideAttrs (old: {
          #   postInstall = ''
          #    mkdir -pv $target/autoload
          #     ln -s $target/plug.vim $target/autoload
          #   '';
          # }))
        ];
      };
      vimrcConfig.customRC = ''

        runtime! plug.vim

        call plug#begin($HOME.'/_vim')
        Plug 'https://github.com/grwlf/litrepl.vim' , { 'rtp': 'vim' }
        call plug#end()
      '';
    };
  # ...
  }

The expression defines a barebone Vim with a single vim-plug plugin. It could be built with nix-build -A plugvim and run with ./result/bin/plugvim.

The only problem I see is probably a Vim-related one. The runtime! line of the config returns successfully, but plug#* functions don't appear on this run of the config, so vim issues errors. If I re-type the commands manually or source the config (by looking its absolute path) then everything starts to work.

Do you have an idea what could prevent Vim from loading the plugin and how to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants