When using vim.customize (or vim-full.customize) to add a few plugins, all default plugins and settings are no longer included, which breaks syntax highlighting and many features that the regular vim (or vim-full) have enabled.
This is very confusing, especially with the current documentation, which says (emphasis mine):
Custom configuration
Adding custom .vimrc lines can be done using the following code:
vim-full.customize {
# `name` optionally specifies the name of the executable and package
name = "vim-with-plugins";
vimrcConfig.customRC = ''
set hidden
'';
}
I understand that some users might want to completely ignore the default configuration, but as that default is built from the plugins that are installed by default, that seems undesirable in most cases.
Steps To Reproduce
Steps to reproduce the behavior:
Put this flake into flake.nix in a new directory (replace aarch64-darwin with your system):
customRC should add lines to the existing vimrc instead of replacing it fully.
Screenshots
When running nix run github:NixOS/nixpkgs/nixpkgs-unstable#vim flake.nix
When running nix run path:$PWD#vim flake.nix with the "naive" customization
When running nix run path:$PWD#vim flake.nix with the workaround of manually sourcing the default configuration
Additional context
I'm willing to work on and submit a PR for this myself, but I'm uncertain what the correct solution for this problem is.
My proposal is to add a sourceDefaultRC boolean parameter to vimrcConfig that is true by default, and adding the source source ${vim}/share/vim/vim*/defaults.vim line by default before the customRC. This seems to be the most compatible solution without limiting choice.
I'm not sure if there is a better solution than globbing vim* to find that file, but it seems stable enough to me.
Notify maintainers
@dasJ @equirosa please let me know if you have opinions on my proposed solution.
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
Describe the bug
When using
vim.customize
(orvim-full.customize
) to add a few plugins, all default plugins and settings are no longer included, which breaks syntax highlighting and many features that the regularvim
(orvim-full
) have enabled.This is very confusing, especially with the current documentation, which says (emphasis mine):
I understand that some users might want to completely ignore the default configuration, but as that default is built from the plugins that are installed by default, that seems undesirable in most cases.
Steps To Reproduce
Steps to reproduce the behavior:
flake.nix
in a new directory (replaceaarch64-darwin
with your system):nix run github:NixOS/nixpkgs/nixpkgs-unstable#vim flake.nix
nix run path:$PWD#vim flake.nix
flake.nix
to have this contentnix run path:$PWD#vim flake.nix
againExpected behavior
customRC
should add lines to the existing vimrc instead of replacing it fully.Screenshots
When running
nix run github:NixOS/nixpkgs/nixpkgs-unstable#vim flake.nix
When running
nix run path:$PWD#vim flake.nix
with the "naive" customizationWhen running
nix run path:$PWD#vim flake.nix
with the workaround of manually sourcing the default configurationAdditional context
I'm willing to work on and submit a PR for this myself, but I'm uncertain what the correct solution for this problem is.
My proposal is to add a
sourceDefaultRC
boolean parameter tovimrcConfig
that is true by default, and adding thesource source ${vim}/share/vim/vim*/defaults.vim
line by default before thecustomRC
. This seems to be the most compatible solution without limiting choice.I'm not sure if there is a better solution than globbing
vim*
to find that file, but it seems stable enough to me.Notify maintainers
@dasJ @equirosa please let me know if you have opinions on my proposed solution.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.