From 8dccb59bacef6ae1abc2725955aa3296c6160d2a Mon Sep 17 00:00:00 2001 From: "Wael M. Nasreddine" Date: Mon, 6 Jan 2020 14:47:44 -0800 Subject: [PATCH] vim-plugins: honor the plugin manager re filetype and syntax Currently, all the filetype and syntax are enabled *after* all the plugins has already been loaded. Whilst this is the case for Pathogen, it's not recommended when using VAM. This commit applies the recommendation for: - VAM[0]: The filetype and syntax are enabled *before* the plugins are loaded. - Pathogen[1]: The filetype and syntax are enabled *after* the plugins are loaded. - Plug[2]: The filetype and syntax are automatically enabled. [0]: https://github.com/MarcWeber/vim-addon-manager/tree/d9e865f3c2de5d9b7eabbc976f606cf1b89e29ea#recommended-setup [1]: https://github.com/tpope/vim-pathogen/blob/a553410f1bdb9000fbc764069f3a5ec3454a02bc/README.markdown#runtime-path-manipulation [2]: https://github.com/junegunn/vim-plug/blob/2f5f74e5e67f657e9fdac54891a76721bcd3ead3/README.md#usage --- pkgs/misc/vim-plugins/vim-utils.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix index 3b91a17e925..16c14b32218 100644 --- a/pkgs/misc/vim-plugins/vim-utils.nix +++ b/pkgs/misc/vim-plugins/vim-utils.nix @@ -208,6 +208,8 @@ let '' let &rtp.=(empty(&rtp)?"":',')."${vimPlugins.pathogen.rtp}" execute pathogen#infect('${pluginsEnv}/{}') + + filetype indent plugin on | syn on ''); /* vim-plug is an extremely popular vim plugin manager. @@ -259,6 +261,8 @@ let in assert builtins.hasAttr "vim-addon-manager" knownPlugins; '' + filetype indent plugin on | syn on + let g:nix_plugin_locations = {} ${lib.concatMapStrings (plugin: '' let g:nix_plugin_locations['${plugin.pname}'] = "${plugin.rtp}" @@ -329,10 +333,12 @@ let set packpath-=~/.vim/after set packpath+=${packDir packages} set packpath+=~/.vim/after + + filetype indent plugin on | syn on ''); in writeText "vimrc" '' - " minimal setup, generated by NIX + " configuration generated by NIX set nocompatible ${vamImpl} @@ -340,8 +346,6 @@ let ${plugImpl} ${nativeImpl} - filetype indent plugin on | syn on - ${customRC} '';