Closed mjlbach closed 3 years ago
really wish we didn't have like 3 different conventions in how to configure vim. Makes it really confusing as to which one is preferred.
The home-manager's neovim configuration is separate from nixpkgs/nixos as you can see at https://github.com/rycee/home-manager/blob/master/modules/programs/neovim.nix. Nixos/nixpkgs does not have a programs.neovim
option ?
Home-manager uses the same infrastructure for neovim/vim plugin management as nix, the issue can be reproduced without home-manager using the following nix-shell:
{ pkgs ? import <nixpkgs> { } }:
let
neovim = pkgs.neovim.override {
configure = {
customRC = ''
colorscheme onedark
'';
packages.myVimPackage = with pkgs.vimPlugins; {
# see examples below how to use custom packages
start = [ onedark-vim ];
};
};
};
in
pkgs.mkShell {
buildInputs = [ neovim ];
}
Onedark color scheme has installation instructions for vim8 package manager: https://github.com/joshdick/onedark.vim#installation
{ pkgs ? import <nixpkgs> { } }:
let
neovim = pkgs.neovim.override {
configure = {
customRC = ''
packadd! onedark-vim
colorscheme onedark
'';
packages.myVimPackage = with pkgs.vimPlugins; {
# see examples below how to use custom packages
opt = [ onedark-vim ];
};
};
};
in
pkgs.mkShell {
buildInputs = [ neovim ];
}
It's not a nixpkgs problem.
@basilgood That works. Is this the intended behavior of vim packages in nixpkgs? It seems odd that some modules work without manually activating them with packadd! and some do not (nvim-lsp, onedark-vim)
@mjlbach It's a vim8 native package manager behavior. Nixpkgs follows the same behavior. In this case (onedark.vim) it's a colorscheme plugin and they probably didn't expect from a colorscheme plugin to contain an autoload folder and so autoload it's not loaded. Same thing with dracula colorscheme and probably with some other plugins which does not follow vim8 pack rules. But nvim-lsp in my experience works out of the box either in start or opt.
This was really helpful. Thanks for the packadd! onedark-vim
bit!
I think this can be closed as the vim/neovim configuration works as expected.
Describe the bug For some reason, onedark.vim is failing to load.
To Reproduce Steps to reproduce the behavior (if using home-manager)
or
if the customRC attribute is left out, onedark-vim loads fine if invoked manually after neovim start.
Furthermore, this can be fixed by ammending the rtp: The following amendment to rtp fixes it:
Metadata ❯ nix-shell -p nix-info --run "nix-info -m" these paths will be fetched (0.00 MiB download, 0.00 MiB unpacked): /nix/store/1hg7ssk7dzpmccsz018p8vb9jr3pq47i-nix-info copying path '/nix/store/1hg7ssk7dzpmccsz018p8vb9jr3pq47i-nix-info' from 'https://cache.nixos.org'...
"x86_64-linux"
Linux 5.7.15-200.fc32.x86_64, Fedora, 32 (Workstation Edition)
no
yes
nix-env (Nix) 2.3.7
"nixos-unstable-20.09pre239318.c59ea8b8a0e, nixpkgs-20.09pre239803.909539e6a09"
/home/michael/.nix-defexpr/channels/nixpkgs
This seems like it's related to: https://github.com/NixOS/nixpkgs/issues/39364 https://github.com/NixOS/nixpkgs/pull/78385