Skip to content

Commit d3c2689

Browse files
authoredMar 25, 2025
vimPlugins: refactoring
2 parents 04d59c3 + 06422e6 commit d3c2689

26 files changed

+238
-316
lines changed
 

‎doc/languages-frameworks/vim.section.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ Note: this is not possible anymore for Neovim.
139139

140140
## Adding new plugins to nixpkgs {#adding-new-plugins-to-nixpkgs}
141141

142-
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 [`nix-shell -p vimPluginsUpdater --run vim-plugins-updater`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/updater.nix). 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).
142+
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 [`nix-shell -p vimPluginsUpdater --run vim-plugins-updater`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/utils/updater.nix). 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).
143143

144-
When the vim updater detects an nvim-treesitter update, it also runs [`nvim-treesitter/update.py $(nix-build -A vimPlugins.nvim-treesitter)`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py) to update the tree sitter grammars for `nvim-treesitter`.
144+
When the vim updater detects an nvim-treesitter update, it also runs [`nvim-treesitter/update.py $(nix-build -A vimPlugins.nvim-treesitter)`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/utils/update.py) to update the tree sitter grammars for `nvim-treesitter`.
145145

146146
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:
147147

‎pkgs/applications/editors/vim/plugins/aliases.nix

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ mapAliases (
116116
snipmate = vim-snipmate;
117117
sourcemap = sourcemap-vim;
118118
"sourcemap.vim" = sourcemap-vim;
119+
Spacegray-vim = throw "Spacegray-vim has been removed: abandoned by upstream"; # Added 2025-03-24
119120
surround = vim-surround;
120121
sleuth = vim-sleuth;
121122
solidity = vim-solidity;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
buildVimPlugin,
3+
coc-clangd,
4+
coc-css,
5+
coc-diagnostic,
6+
coc-pyright,
7+
coc-toml,
8+
}:
9+
final: prev: {
10+
coc-clangd = buildVimPlugin {
11+
inherit (coc-clangd) pname version meta;
12+
src = "${coc-clangd}/lib/node_modules/coc-clangd";
13+
};
14+
15+
coc-css = buildVimPlugin {
16+
inherit (coc-css) pname version meta;
17+
src = "${coc-css}/lib/node_modules/coc-css";
18+
};
19+
20+
coc-diagnostic = buildVimPlugin {
21+
inherit (coc-diagnostic) pname version meta;
22+
src = "${coc-diagnostic}/lib/node_modules/coc-diagnostic";
23+
};
24+
25+
coc-pyright = buildVimPlugin {
26+
pname = "coc-pyright";
27+
inherit (coc-pyright) version meta;
28+
src = "${coc-pyright}/lib/node_modules/coc-pyright";
29+
};
30+
31+
coc-toml = buildVimPlugin {
32+
pname = "coc-toml";
33+
inherit (coc-toml) version meta;
34+
src = "${coc-toml}/lib/node_modules/coc-toml";
35+
};
36+
}

‎pkgs/applications/editors/vim/plugins/default.nix

+19-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,25 @@ let
1919

2020
initialPackages = self: { };
2121

22-
plugins = callPackage ./generated.nix {
22+
cocPlugins = callPackage ./cocPlugins.nix {
2323
inherit buildVimPlugin;
24+
};
25+
26+
luaPackagePlugins = callPackage ./luaPackagePlugins.nix {
2427
inherit (neovimUtils) buildNeovimPlugin;
2528
};
2629

27-
extras = callPackage ./extras.nix {
30+
nodePackagePlugins = callPackage ./nodePackagePlugins.nix {
31+
inherit buildVimPlugin;
32+
};
33+
34+
nonGeneratedPlugins =
35+
self: super:
36+
lib.mapAttrs (name: _: callPackage (./non-generated + "/${name}") { }) (
37+
lib.filterAttrs (name: type: type == "directory") (builtins.readDir ./non-generated)
38+
);
39+
40+
plugins = callPackage ./generated.nix {
2841
inherit buildVimPlugin;
2942
inherit (neovimUtils) buildNeovimPlugin;
3043
};
@@ -44,7 +57,10 @@ let
4457
in
4558
lib.pipe initialPackages [
4659
(extends plugins)
47-
(extends extras)
60+
(extends cocPlugins)
61+
(extends luaPackagePlugins)
62+
(extends nodePackagePlugins)
63+
(extends nonGeneratedPlugins)
4864
(extends overrides)
4965
(extends aliases)
5066
lib.makeExtensible

‎pkgs/applications/editors/vim/plugins/extras.nix

-104
This file was deleted.

‎pkgs/applications/editors/vim/plugins/generated.nix

+26
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,19 @@ final: prev:
458458
meta.hydraPlatforms = [ ];
459459
};
460460

461+
VimCompletesMe = buildVimPlugin {
462+
pname = "VimCompletesMe";
463+
version = "2015-04-20";
464+
src = fetchFromGitHub {
465+
owner = "vim-scripts";
466+
repo = "VimCompletesMe";
467+
rev = "b915ac2c081dd5aec69b561b04a8ac1778d2277c";
468+
sha256 = "0mal1raflzzmahb4skc01dwp9vasvwcyh9mpw3r75gfrfzbyjrlk";
469+
};
470+
meta.homepage = "https://github.com/vim-scripts/VimCompletesMe/";
471+
meta.hydraPlatforms = [ ];
472+
};
473+
461474
VimOrganizer = buildVimPlugin {
462475
pname = "VimOrganizer";
463476
version = "2020-12-15";
@@ -18757,6 +18770,19 @@ final: prev:
1875718770
meta.hydraPlatforms = [ ];
1875818771
};
1875918772

18773+
vim-pony = buildVimPlugin {
18774+
pname = "vim-pony";
18775+
version = "2018-06-24";
18776+
src = fetchFromGitHub {
18777+
owner = "jmcomets";
18778+
repo = "vim-pony";
18779+
rev = "cd0949971c485fd23de62bb78ca39e5bbe8b915a";
18780+
sha256 = "0sassx3mkkd543mljycfmvgwcnw36zbpanm41mf3bavxvsk0azx6";
18781+
};
18782+
meta.homepage = "https://github.com/jmcomets/vim-pony/";
18783+
meta.hydraPlatforms = [ ];
18784+
};
18785+
1876018786
vim-poweryank = buildVimPlugin {
1876118787
pname = "vim-poweryank";
1876218788
version = "2017-08-13";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
lib,
3+
buildNeovimPlugin,
4+
neovim-unwrapped,
5+
}:
6+
final: prev:
7+
let
8+
luaPackages = neovim-unwrapped.lua.pkgs;
9+
10+
luarocksPackageNames = [
11+
"fidget-nvim"
12+
"gitsigns-nvim"
13+
"image-nvim"
14+
"lsp-progress-nvim"
15+
"lualine-nvim"
16+
"luasnip"
17+
"lush-nvim"
18+
"lz-n"
19+
"lze"
20+
"lzextras"
21+
"lzn-auto-require"
22+
"middleclass"
23+
"mini-test"
24+
"neorg"
25+
"neotest"
26+
"nui-nvim"
27+
"nvim-cmp"
28+
"nvim-nio"
29+
"nvim-web-devicons"
30+
"oil-nvim"
31+
"orgmode"
32+
"papis-nvim"
33+
"plenary-nvim"
34+
"rest-nvim"
35+
"rocks-config-nvim"
36+
"rtp-nvim"
37+
"telescope-manix"
38+
"telescope-nvim"
39+
];
40+
in
41+
lib.genAttrs luarocksPackageNames (
42+
name:
43+
buildNeovimPlugin {
44+
luaAttr = luaPackages.${name};
45+
}
46+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
lib,
3+
buildVimPlugin,
4+
nodePackages,
5+
}:
6+
final: prev:
7+
let
8+
nodePackageNames = [
9+
"coc-cmake"
10+
"coc-docker"
11+
"coc-emmet"
12+
"coc-eslint"
13+
"coc-explorer"
14+
"coc-flutter"
15+
"coc-git"
16+
"coc-go"
17+
"coc-haxe"
18+
"coc-highlight"
19+
"coc-html"
20+
"coc-java"
21+
"coc-jest"
22+
"coc-json"
23+
"coc-lists"
24+
"coc-ltex"
25+
"coc-markdownlint"
26+
"coc-pairs"
27+
"coc-prettier"
28+
"coc-r-lsp"
29+
"coc-rls"
30+
"coc-rust-analyzer"
31+
"coc-sh"
32+
"coc-smartf"
33+
"coc-snippets"
34+
"coc-solargraph"
35+
"coc-spell-checker"
36+
"coc-sqlfluff"
37+
"coc-stylelint"
38+
"coc-sumneko-lua"
39+
"coc-tabnine"
40+
"coc-texlab"
41+
"coc-tsserver"
42+
"coc-ultisnips"
43+
"coc-vetur"
44+
"coc-vimlsp"
45+
"coc-vimtex"
46+
"coc-wxml"
47+
"coc-yaml"
48+
"coc-yank"
49+
"coc-nginx"
50+
];
51+
52+
packageNameOverrides = {
53+
"coc-nginx" = "@yaegassy/coc-nginx";
54+
};
55+
56+
getPackageName = name: packageNameOverrides.${name} or name;
57+
in
58+
lib.genAttrs nodePackageNames (
59+
name:
60+
buildVimPlugin {
61+
pname = name;
62+
inherit (nodePackages.${getPackageName name}) version meta;
63+
src = "${nodePackages.${getPackageName name}}/lib/node_modules/${getPackageName name}";
64+
}
65+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
vimUtils,
3+
fetchFromGitHub,
4+
nix-update-script,
5+
}:
6+
vimUtils.buildVimPlugin {
7+
pname = "bitbake-vim";
8+
version = "2025-03-24";
9+
10+
src = fetchFromGitHub {
11+
owner = "openembedded";
12+
repo = "bitbake";
13+
rev = "8cc976e2792fdde3900729f3b09dd18ab640b5e8";
14+
sha256 = "12k48zhd9bh3b8xjpang2xj14nhyla2p55r1is3m25wkqys10p9c";
15+
};
16+
17+
sourceRoot = "source/contrib/vim";
18+
19+
meta.homepage = "https://github.com/openembedded/bitbake/";
20+
21+
passthru.updateScript = nix-update-script { };
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
vimPlugins,
3+
vimUtils,
4+
}:
5+
vimUtils.buildVimPlugin {
6+
pname = "vim2nix";
7+
version = "1.0";
8+
src = ./src;
9+
dependencies = [ vimPlugins.vim-addon-manager ];
10+
}

0 commit comments

Comments
 (0)
Failed to load comments.