Vim: Difference between revisions

imported>Equirosa
No edit summary
imported>Leonardp
m added examples for global vim/nvim
Line 231: Line 231:
$ nix-env -iA nixos.vimHugeX
$ nix-env -iA nixos.vimHugeX
</syntaxhighlight>
</syntaxhighlight>
=== System wide vim/nvim configuration ===
If you want a system wide "baseline" configuration for vim/nvim here are two examples:
The vim example has python3 support as mentioned above.
<syntaxHighlight lang="nix">
{ pkgs, ... }:
{
  environment.variables = { EDITOR = "vim"; };
  environment.systemPackages = with pkgs; [
    ((vim_configurable.override { python = python3; }).customize{
      name = "vim";
      vimrcConfig.packages.myplugins = with pkgs.vimPlugins; {
        start = [ vim-nix vim-lastplace ];
        opt = [];
      };
      vimrcConfig.customRC = ''
        " your custom vimrc
        set nocompatible
        set backspace=indent,eol,start
        " ...
      '';
    }
  )];
}
</syntaxHighlight>
<syntaxHighlight lang="nix">
{ pkgs, ... }:
{
  environment.variables = { EDITOR = "vim"; };
  environment.systemPackages = with pkgs; [
    (neovim.override {
      vimAlias = true;
      configure = {
        packages.myPlugins = with pkgs.vimPlugins; {
          start = [ vim-lastplace vim-nix ];
          opt = [];
        };
        customRC = ''
          " your custom vimrc
          set nocompatible
          set backspace=indent,eol,start
          " ...
        '';
      };
    }
  )];
}
</syntaxHighlight>
import these in your <code>configuration.nix</code> and
<syntaxHighlight lang="nix">
{   
  imports =   
    [
      ./vim.nix
    ];
  # ...
}
</syntaxHighlight>