@@ -33,24 +33,6 @@ vim-with-plugins in PATH:
33
33
# To automatically load a plugin when opening a filetype, add vimrc lines like:
34
34
# autocmd FileType php :packadd phpCompletion
35
35
};
36
-
37
- # plugins can also be managed by VAM
38
- vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; # optional
39
- vimrcConfig.vam.pluginDictionaries = [
40
- # load always
41
- { name = "youcompleteme"; }
42
- { names = ["youcompleteme" "foo"]; }
43
-
44
- # only load when opening a .php file
45
- { name = "phpCompletion"; ft_regex = "^php\$"; }
46
- { name = "phpCompletion"; filename_regex = "^.php\$"; }
47
-
48
- # provide plugin which can be loaded manually:
49
- { name = "phpCompletion"; tag = "lazy"; }
50
-
51
- # full documentation at github.com/MarcWeber/vim-addon-manager
52
- ];
53
-
54
36
};
55
37
56
38
WHAT IS A VIM PLUGIN?
278
260
279
261
plugins = findDependenciesRecursively ( map ( pluginToDrv knownPlugins ) pathogen . pluginNames ) ;
280
262
281
- pathogenPackages . pathogen = lib . warn "'pathogen' attribute is deprecated. Use 'packages' instead in your vim configuration" {
263
+ pathogenPackages . pathogen = {
282
264
start = plugins ;
283
265
} ;
284
266
in
@@ -313,71 +295,26 @@ let
313
295
yet
314
296
315
297
*/
316
- vamImpl = lib . optionalString ( vam != null )
317
- ( let
298
+ vamImpl =
299
+ let
318
300
knownPlugins = vam . knownPlugins or vimPlugins ;
319
301
320
302
# plugins specified by the user
321
303
specifiedPlugins = map ( pluginToDrv knownPlugins ) ( lib . concatMap vamDictToNames vam . pluginDictionaries ) ;
322
304
# plugins with dependencies
323
305
plugins = findDependenciesRecursively specifiedPlugins ;
324
-
325
- # Convert scalars, lists, and attrs, to VimL equivalents
326
- toVimL = x :
327
- if builtins . isString x then "'${ lib . replaceStrings [ "\n " "'" ] [ "\n \\ " "''" ] x } '"
328
- else if builtins . isAttrs x && builtins ? out then toVimL x # a derivation
329
- else if builtins . isAttrs x then "{${ lib . concatStringsSep ", " ( lib . mapAttrsToList ( n : v : "${ toVimL n } : ${ toVimL v } " ) x ) } }"
330
- else if builtins . isList x then "[${ lib . concatMapStringsSep ", " toVimL x } ]"
331
- else if builtins . isInt x || builtins . isFloat x then builtins . toString x
332
- else if builtins . isBool x then ( if x then "1" else "0" )
333
- else throw "turning ${ lib . generators . toPretty { } x } into a VimL thing not implemented yet" ;
334
-
335
- in assert builtins . hasAttr "vim-addon-manager" knownPlugins ;
336
- ''
337
- filetype indent plugin on | syn on
338
-
339
- let g:nix_plugin_locations = {}
340
- ${ lib . concatMapStrings ( plugin : ''
341
- let g:nix_plugin_locations['${ plugin . pname } '] = "${ plugin . rtp } "
342
- '' ) plugins }
343
- let g:nix_plugin_locations['vim-addon-manager'] = "${ knownPlugins . vim-addon-manager . rtp } "
344
-
345
- let g:vim_addon_manager = {}
346
-
347
- if exists('g:nix_plugin_locations')
348
- " nix managed config
349
-
350
- " override default function making VAM aware of plugin locations:
351
- fun! NixPluginLocation(name)
352
- let path = get(g:nix_plugin_locations, a:name, "")
353
- return path == "" ? vam#DefaultPluginDirFromName(a:name) : path
354
- endfun
355
- let g:vim_addon_manager.plugin_dir_by_name = 'NixPluginLocation'
356
- " tell Vim about VAM:
357
- let &rtp.=(empty(&rtp)?"":','). g:nix_plugin_locations['vim-addon-manager']
358
- else
359
- " standalone config
360
-
361
- let &rtp.=(empty(&rtp)?"":',').c.plugin_root_dir.'/vim-addon-manager'
362
- if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
363
- " checkout VAM
364
- execute '!git clone --depth=1 https://github.com/MarcWeber/vim-addon-manager '
365
- \ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
366
- endif
367
- endif
368
-
369
- " tell vam which plugins to load, and when:
370
- let l = []
371
- ${ lib . concatMapStrings ( p : "call add(l, ${ toVimL p } )\n " ) vam . pluginDictionaries }
372
- call vam#Scripts(l, {})
373
- '' ) ;
306
+ vamPackages . vam = {
307
+ start = plugins ;
308
+ } ;
309
+ in
310
+ nativeImpl vamPackages ;
374
311
375
312
entries = [
376
313
beforePlugins
377
- vamImpl
378
314
]
315
+ ++ lib . optional ( vam != null ) ( lib . warn "'vam' attribute is deprecated. Use 'packages' instead in your vim configuration" vamImpl )
379
316
++ lib . optional ( packages != null && packages != [ ] ) ( nativeImpl packages )
380
- ++ lib . optional ( pathogen != null ) pathogenImpl
317
+ ++ lib . optional ( pathogen != null ) ( lib . warn "'pathogen' attribute is deprecated. Use 'packages' instead in your vim configuration" pathogenImpl )
381
318
++ lib . optional ( plug != null ) plugImpl
382
319
++ [ customRC ] ;
383
320
@@ -468,37 +405,6 @@ rec {
468
405
469
406
vimWithRC = throw "vimWithRC was removed, please use vim.customize instead" ;
470
407
471
- pluginnames2Nix = { name , namefiles } : vim_configurable . customize {
472
- inherit name ;
473
- vimrcConfig . vam . knownPlugins = vimPlugins ;
474
- vimrcConfig . vam . pluginDictionaries = [ "vim2nix" ] ;
475
- vimrcConfig . customRC = ''
476
- " Yes - this is impure and will create the cache file and checkout vim-pi
477
- " into ~/.vim/vim-addons
478
- let g:vim_addon_manager.plugin_root_dir = "/tmp/vim2nix-".$USER
479
- if !isdirectory(g:vim_addon_manager.plugin_root_dir)
480
- call mkdir(g:vim_addon_manager.plugin_root_dir)
481
- else
482
- echom repeat("=", 80)
483
- echom "WARNING: reusing cache directory :".g:vim_addon_manager.plugin_root_dir
484
- echom repeat("=", 80)
485
- endif
486
- let opts = {}
487
- let opts.nix_prefetch_git = "${ nix-prefetch-git } /bin/nix-prefetch-git"
488
- let opts.nix_prefetch_hg = "${ nix-prefetch-hg } /bin/nix-prefetch-hg"
489
- let opts.cache_file = g:vim_addon_manager.plugin_root_dir.'/cache'
490
- let opts.plugin_dictionaries = []
491
- ${ lib . concatMapStrings ( file : "let opts.plugin_dictionaries += map(readfile(\" ${ file } \" ), 'eval(v:val)')\n " ) namefiles }
492
-
493
- " uncomment for debugging failures
494
- " let opts.try_catch = 0
495
-
496
- " add more files
497
- " let opts.plugin_dictionaries += map(.. other file )
498
- call nix#ExportPluginsForNix(opts)
499
- '' ;
500
- } ;
501
-
502
408
vimGenDocHook = callPackage ( { vim } :
503
409
makeSetupHook {
504
410
name = "vim-gen-doc-hook" ;
0 commit comments