vimPlugins: introduce passthru.initLua for some plugins (#334913)
* vimPlugins: introduce passthru.initLua for some plugins as described in https://github.com/NixOS/nixpkgs/issues/172538, some vim plugins need some configuration to be able to work at all. We choose not to patch those plugins and instead expose the necessary configuration to make them work in `PLUGIN.passthru.initLua`. For now the user can check if plugins have a `PLUGIN.passthru.initLua` and if yes, prepend it to their own init.lua. Maybe later we can revisit this to either patch them in a way that is clear that it's a nixpkgs patch or by having the neovim wrapper pick those snippets and autoadd them to init.lua ? * Update doc/languages-frameworks/vim.section.md Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com> --------- Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>
This commit is contained in:
parent
db1fb55d82
commit
a5e5d66a4c
@ -232,6 +232,14 @@ To add a new plugin, run `nix-shell -p vimPluginsUpdater --run 'vim-plugins-upda
|
||||
|
||||
Finally, there are some plugins that are also packaged in nodePackages because they have Javascript-related build steps, such as running webpack. Those plugins are not listed in `vim-plugin-names` or managed by `vimPluginsUpdater` at all, and are included separately in `overrides.nix`. Currently, all these plugins are related to the `coc.nvim` ecosystem of the Language Server Protocol integration with Vim/Neovim.
|
||||
|
||||
### Plugin optional configuration {#vim-plugin-required-snippet}
|
||||
|
||||
Some plugins require specific configuration to work. We choose not to
|
||||
patch those plugins but expose the necessary configuration under
|
||||
`PLUGIN.passthru.initLua` for neovim plugins. For instance, the `unicode-vim` plugin
|
||||
needs the path towards a unicode database so we expose the following snippet `vim.g.Unicode_data_directory="${self.unicode-vim}/autoload/unicode"` under `vimPlugins.unicode-vim.passthru.initLua`.
|
||||
|
||||
|
||||
## Updating plugins in nixpkgs {#updating-plugins-in-nixpkgs}
|
||||
|
||||
Run the update script with a GitHub API token that has at least `public_repo` access. Running the script without the token is likely to result in rate-limiting (429 errors). For steps on creating an API token, please refer to [GitHub's token documentation](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token).
|
||||
|
@ -783,7 +783,7 @@
|
||||
'';
|
||||
};
|
||||
|
||||
fzf-hoogle-vim = super.fzf-hoogle-vim.overrideAttrs {
|
||||
fzf-hoogle-vim = super.fzf-hoogle-vim.overrideAttrs (oa: {
|
||||
# add this to your lua config to prevent the plugin from trying to write in the
|
||||
# nix store:
|
||||
# vim.g.hoogle_fzf_cache_file = vim.fn.stdpath('cache')..'/hoogle_cache.json'
|
||||
@ -792,7 +792,11 @@
|
||||
gawk
|
||||
];
|
||||
dependencies = with self; [ fzf-vim ];
|
||||
};
|
||||
passthru = oa.passthru // {
|
||||
|
||||
initLua = "vim.g.hoogle_fzf_cache_file = vim.fn.stdpath('cache')..'/hoogle_cache.json";
|
||||
};
|
||||
});
|
||||
|
||||
fzf-lua = super.fzf-lua.overrideAttrs {
|
||||
propagatedBuildInputs = [ fzf ];
|
||||
@ -1506,7 +1510,7 @@
|
||||
meta.homepage = "https://github.com/ackyshake/Spacegray.vim/";
|
||||
};
|
||||
|
||||
sqlite-lua = super.sqlite-lua.overrideAttrs {
|
||||
sqlite-lua = super.sqlite-lua.overrideAttrs (oa: {
|
||||
postPatch =
|
||||
let
|
||||
libsqlite = "${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||
@ -1515,7 +1519,11 @@
|
||||
substituteInPlace lua/sqlite/defs.lua \
|
||||
--replace "path = vim.g.sqlite_clib_path" "path = vim.g.sqlite_clib_path or ${lib.escapeShellArg libsqlite}"
|
||||
'';
|
||||
};
|
||||
|
||||
passthru = oa.passthru // {
|
||||
initLua = ''vim.g.sqlite_clib_path = "${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}"'';
|
||||
};
|
||||
});
|
||||
|
||||
ssr = super.ssr-nvim.overrideAttrs {
|
||||
dependencies = with self; [ nvim-treesitter ];
|
||||
@ -1699,14 +1707,19 @@
|
||||
sha256 = "16b0jzvvzarnlxdvs2izd5ia0ipbd87md143dc6lv6xpdqcs75s9";
|
||||
};
|
||||
in
|
||||
super.unicode-vim.overrideAttrs {
|
||||
super.unicode-vim.overrideAttrs (oa: {
|
||||
# redirect to /dev/null else changes terminal color
|
||||
buildPhase = ''
|
||||
cp "${unicode-data}" autoload/unicode/UnicodeData.txt
|
||||
echo "Building unicode cache"
|
||||
${vim}/bin/vim --cmd ":set rtp^=$PWD" -c 'ru plugin/unicode.vim' -c 'UnicodeCache' -c ':echohl Normal' -c ':q' > /dev/null
|
||||
'';
|
||||
};
|
||||
|
||||
passthru = oa.passthru // {
|
||||
|
||||
initLua = ''vim.g.Unicode_data_directory="${self.unicode-vim}/autoload/unicode"'';
|
||||
};
|
||||
});
|
||||
|
||||
unison = super.unison.overrideAttrs {
|
||||
# Editor stuff isn't at top level
|
||||
|
Loading…
Reference in New Issue
Block a user