diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
commit | 99fcaeccb89621dd492203ce1f2d551c06f228ed (patch) | |
tree | 41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/doc/languages-frameworks/vim.section.md | |
parent | 59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff) | |
parent | 75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff) | |
download | nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2 nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/nixos/modules/config/console.nix nixpkgs/nixos/modules/services/mail/mailman.nix nixpkgs/nixos/modules/services/mail/public-inbox.nix nixpkgs/nixos/modules/services/mail/rss2email.nix nixpkgs/nixos/modules/services/networking/ssh/sshd.nix nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix nixpkgs/pkgs/applications/networking/irc/weechat/default.nix nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/go/module.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/interpreters/python/default.nix nixpkgs/pkgs/development/node-packages/overrides.nix nixpkgs/pkgs/development/tools/b4/default.nix nixpkgs/pkgs/servers/dict/dictd-db.nix nixpkgs/pkgs/servers/mail/public-inbox/default.nix nixpkgs/pkgs/tools/security/pinentry/default.nix nixpkgs/pkgs/tools/text/unoconv/default.nix nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/doc/languages-frameworks/vim.section.md')
-rw-r--r-- | nixpkgs/doc/languages-frameworks/vim.section.md | 84 |
1 files changed, 51 insertions, 33 deletions
diff --git a/nixpkgs/doc/languages-frameworks/vim.section.md b/nixpkgs/doc/languages-frameworks/vim.section.md index ec0e60389155..bf0d663179b9 100644 --- a/nixpkgs/doc/languages-frameworks/vim.section.md +++ b/nixpkgs/doc/languages-frameworks/vim.section.md @@ -8,14 +8,23 @@ Loading can be deferred; see examples. At the moment we support two different methods for managing plugins: - Vim packages (*recommended*) -- vim-plug +- vim-plug (vim only) + +Right now two Vim packages are available: `vim` which has most features that require extra +dependencies disabled and `vim-full` which has them configurable and enabled by default. + +::: {.note} +`vim_configurable` is a deprecated alias for `vim-full` and refers to the fact that its +build-time features are configurable. It has nothing to do with user configuration, +and both the `vim` and `vim-full` packages can be customized as explained in the next section. +::: ## Custom configuration {#custom-configuration} Adding custom .vimrc lines can be done using the following code: ```nix -vim_configurable.customize { +vim-full.customize { # `name` optionally specifies the name of the executable and package name = "vim-with-plugins"; @@ -62,7 +71,7 @@ neovim-qt.override { To store your plugins in Vim packages (the native Vim plugin manager, see `:help packages`) the following example can be used: ```nix -vim_configurable.customize { +vim-full.customize { vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; { # loaded on launch start = [ youcompleteme fugitive ]; @@ -101,7 +110,7 @@ The resulting package can be added to `packageOverrides` in `~/.nixpkgs/config.n ```nix { packageOverrides = pkgs: with pkgs; { - myVim = vim_configurable.customize { + myVim = vim-full.customize { # `name` specifies the name of the executable and package name = "vim-with-plugins"; # add here code from the example section @@ -125,13 +134,13 @@ If one of your favourite plugins isn't packaged, you can package it yourself: { config, pkgs, ... }: let - easygrep = pkgs.vimUtils.buildVimPlugin { + easygrep = pkgs.vimUtils.buildVimPluginFrom2Nix { name = "vim-easygrep"; src = pkgs.fetchFromGitHub { owner = "dkprice"; repo = "vim-easygrep"; rev = "d0c36a77cc63c22648e792796b1815b44164653a"; - sha256 = "0y2p5mz0d5fhg6n68lhfhl8p4mlwkb82q337c22djs4w5zyzggbc"; + hash = "sha256-bL33/S+caNmEYGcMLNCanFZyEYUOUmSsedCVBn4tV3g="; }; }; in @@ -155,8 +164,10 @@ in } ``` -### Specificities for some plugins -#### Treesitter +If your package requires building specific parts, use instead `pkgs.vimUtils.buildVimPlugin`. + +### Specificities for some plugins {#vim-plugin-specificities} +#### Treesitter {#vim-plugin-treesitter} By default `nvim-treesitter` encourages you to download, compile and install the required Treesitter grammars at run time with `:TSInstall`. This works @@ -170,8 +181,8 @@ of precompiled grammars, you can use `nvim-treesitter.withPlugins` function: start = [ (nvim-treesitter.withPlugins ( plugins: with plugins; [ - tree-sitter-nix - tree-sitter-python + nix + python ] )) ]; @@ -180,7 +191,7 @@ of precompiled grammars, you can use `nvim-treesitter.withPlugins` function: }) ``` -To enable all grammars packaged in nixpkgs, use `(pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars))`. +To enable all grammars packaged in nixpkgs, use `pkgs.vimPlugins.nvim-treesitter.withAllGrammars`. ## Managing plugins with vim-plug {#managing-plugins-with-vim-plug} @@ -188,7 +199,7 @@ To use [vim-plug](https://github.com/junegunn/vim-plug) to manage your Vim plugins the following example can be used: ```nix -vim_configurable.customize { +vim-full.customize { vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; { # loaded on launch plug.plugins = [ youcompleteme fugitive phpCompletion elm-vim ]; @@ -196,24 +207,14 @@ vim_configurable.customize { } ``` -For Neovim the syntax is: +Note: this is not possible anymore for Neovim. -```nix -neovim.override { - configure = { - customRC = '' - # your custom configuration goes here! - ''; - plug.plugins = with pkgs.vimPlugins; [ - vim-go - ]; - }; -} -``` ## Adding new plugins to nixpkgs {#adding-new-plugins-to-nixpkgs} -Nix expressions for Vim plugins are stored in [pkgs/applications/editors/vim/plugins](https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/vim/plugins). For the vast majority of plugins, Nix expressions are automatically generated by running [`./update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py). This creates a [generated.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/generated.nix) file based on the plugins listed in [vim-plugin-names](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/vim-plugin-names). Plugins are listed in alphabetical order in `vim-plugin-names` using the format `[github username]/[repository]@[gitref]`. For example https://github.com/scrooloose/nerdtree becomes `scrooloose/nerdtree`. +Nix expressions for Vim plugins are stored in [pkgs/applications/editors/vim/plugins](https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/vim/plugins). For the vast majority of plugins, Nix expressions are automatically generated by running [`./update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py). This creates a [generated.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/generated.nix) file based on the plugins listed in [vim-plugin-names](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/vim-plugin-names). + +After running `./update.py`, if nvim-treesitter received an update, also run [`nvim-treesitter/update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py) to update the tree sitter grammars for `nvim-treesitter`. Some plugins require overrides in order to function properly. Overrides are placed in [overrides.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/overrides.nix). Overrides are most often required when a plugin requires some dependencies, or extra steps are required during the build process. For example `deoplete-fish` requires both `deoplete-nvim` and `vim-fish`, and so the following override was added: @@ -225,9 +226,9 @@ deoplete-fish = super.deoplete-fish.overrideAttrs(old: { Sometimes plugins require an override that must be changed when the plugin is updated. This can cause issues when Vim plugins are auto-updated but the associated override isn't updated. For these plugins, the override should be written so that it specifies all information required to install the plugin, and running `./update.py` doesn't change the derivation for the plugin. Manually updating the override is required to update these types of plugins. An example of such a plugin is `LanguageClient-neovim`. -To add a new plugin, run `./update.py --add "[owner]/[name]"`. **NOTE**: This script automatically commits to your git repository. Be sure to check out a fresh branch before running. +To add a new plugin, run `./update.py add "[owner]/[name]"`. **NOTE**: This script automatically commits to your git repository. Be sure to check out a fresh branch before running. -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 `update.py` 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. +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 `update.py` 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. ## Updating plugins in nixpkgs {#updating-plugins-in-nixpkgs} @@ -243,10 +244,27 @@ Alternatively, set the number of processes to a lower count to avoid rate-limiti ./pkgs/applications/editors/vim/plugins/update.py --proc 1 ``` -## Important repositories {#important-repositories} +## How to maintain an out-of-tree overlay of vim plugins ? {#vim-out-of-tree-overlays} + +You can use the updater script to generate basic packages out of a custom vim +plugin list: + +``` +pkgs/applications/editors/vim/plugins/update.py -i vim-plugin-names -o generated.nix --no-commit +``` + +with the contents of `vim-plugin-names` being for example: -- [vim-pi](https://bitbucket.org/vimcommunity/vim-pi) is a plugin repository - from VAM plugin manager meant to be used by others as well used by +``` +repo,branch,alias +pwntester/octo.nvim,, +``` + +You can then reference the generated vim plugins via: + +```nix +myVimPlugins = pkgs.vimPlugins.extend ( + (pkgs.callPackage generated.nix {}) +); +``` -- [vim2nix](https://github.com/MarcWeber/vim-addon-vim2nix) which generates the - .nix code |