Vim: Difference between revisions

imported>Fadenb
m Using VAM as manager: whitespace removal
imported>Makefu
Line 94: Line 94:
* Generate via <code>nix-shell -p vimPlugins.pluginnames2nix --command "vim-plugin-names-to-nix"</code>
* Generate via <code>nix-shell -p vimPlugins.pluginnames2nix --command "vim-plugin-names-to-nix"</code>
* If you need to add additional code/patches to the generated code, add those lines to <code>pkgs/misc/vim-plugins/vim2nix/additional-nix-code</code> and rerun <code>vim-plugin-names-to-nix</code>. They will be included in the generated code.
* If you need to add additional code/patches to the generated code, add those lines to <code>pkgs/misc/vim-plugins/vim2nix/additional-nix-code</code> and rerun <code>vim-plugin-names-to-nix</code>. They will be included in the generated code.
= Add a new custom plugin to the users packages  =
Sometimes you do not want to change upstream plugins, for this you can use  <code>vimrcConfig.vam.knownPlugins</code> and <code>vimrcConfig.vam.pluginDirectories</code> like this:
<syntaxHighlight lang="nix">
let
  customPlugins.vim-better-whitespace = pkgs.vimUtils.buildVimPlugin {
    name = "vim-better-whitespace";
    src = pkgs.fetchFromGitHub {
      owner = "ntpeters";
      repo = "vim-better-whitespace";
      rev = "984c8da518799a6bfb8214e1acdcfd10f5f1eed7";
      sha256 = "10l01a8xaivz6n01x6hzfx7gd0igd0wcf9ril0sllqzbq7yx2bbk";
    };
  };
in {
  users.users.<yourNickname>.packages = [
    (pkgs.vim_configurable.customize {
      name = "vim";
      vimrcConfig.vam.knownPlugins = pkgs.vimPlugins // customPlugins;
      vimrcConfig.vam.pluginDictionaries = [
        { names = "vim-better-whitespace" ]; } ]
    })
};
</syntaxHighlight>


= Real life examples =
= Real life examples =