File tree Expand file tree Collapse file tree 2 files changed +33
-3
lines changed
pkgs/applications/editors/neovim Expand file tree Collapse file tree 2 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 8080 sha256 = "1ykcvyx82nhdq167kbnpgwkgjib8ii7c92y3427v986n2s5lsskc" ;
8181 } ;
8282
83- # neovim-drv must be a wrapped neovim
83+ /* neovim-drv must be a wrapped neovim
84+ - exposes lua config in $luarcGeneric
85+ - exposes vim config in $vimrcGeneric
86+
87+ */
88+
8489 runTest = neovim-drv : buildCommand :
8590 runCommandLocal "test-${ neovim-drv . name } " ( {
8691 nativeBuildInputs = [ ] ;
164169 ${ nvim_with_plug } /bin/nvim -V3log.txt -i NONE -c 'color base16-tomorrow-night' +quit! -e
165170 '' ;
166171
172+ nvim_with_autoconfigure = pkgs . neovim . overrideAttrs ( oa : {
173+ plugins = [ vimPlugins . unicode-vim ] ;
174+ autoconfigure = true ;
175+ # legacy wrapper sets it to false
176+ wrapRc = true ;
177+ } ) ;
178+
167179 nvim_with_ftplugin = let
168180 # this plugin checks that it's ftplugin/vim.tex is loaded before $VIMRUNTIME/ftplugin/vim.tex
169181 # $VIMRUNTIME/ftplugin/vim.tex sources $VIMRUNTIME/ftplugin/initex.vim which sets b:did_ftplugin
324336
325337 inherit nvim-with-luasnip ;
326338
339+ autoconfigure = runTest nvim_with_autoconfigure ''
340+ assertFileContains \
341+ "$luarc" \
342+ '${ vimPlugins . unicode-vim . passthru . initLua } '
343+ '' ;
344+
327345 # check that bringing in one plugin with lua deps makes those deps visible from wrapper
328346 # for instance luasnip has a dependency on jsregexp
329347 can_require_transitive_deps =
Original file line number Diff line number Diff line change 2020
2121 wrapper = {
2222 extraName ? ""
23+ # certain plugins need a custom configuration (available in passthru.initLua)
24+ # to work with nix.
25+ # if true, the wrapper automatically appends those snippets when necessary
26+ , autoconfigure ? false
2327 # should contain all args but the binary. Can be either a string or list
2428 , wrapperArgs ? [ ]
2529 , withPython2 ? false
8791 packpathDirs . myNeovimPackages = myVimPackage ;
8892 finalPackdir = neovimUtils . packDir packpathDirs ;
8993
94+ luaPluginRC = let
95+ op = acc : normalizedPlugin :
96+ acc ++ lib . optional ( finalAttrs . autoconfigure && normalizedPlugin . plugin . passthru ? initLua ) normalizedPlugin . plugin . passthru . initLua ;
97+ in
98+ lib . foldl' op [ ] pluginsNormalized ;
99+
90100 rcContent = ''
91101 ${ luaRcContent }
92102 '' + lib . optionalString ( neovimRcContent' != null ) ''
93103 vim.cmd.source "${ writeText "init.vim" neovimRcContent' } "
94- '' ;
104+ '' +
105+ lib . concatStringsSep "\n " luaPluginRC
106+ ;
95107
96108 getDeps = attrname : map ( plugin : plugin . ${ attrname } or ( _ : [ ] ) ) ;
97109
155167 __structuredAttrs = true ;
156168 dontUnpack = true ;
157169 inherit viAlias vimAlias withNodeJs withPython3 withPerl withRuby ;
158- inherit wrapRc providerLuaRc packpathDirs ;
170+ inherit autoconfigure wrapRc providerLuaRc packpathDirs ;
159171 inherit python3Env rubyEnv ;
160172 inherit wrapperArgs generatedWrapperArgs ;
161173 luaRcContent = rcContent ;
You can’t perform that action at this time.
0 commit comments