Vim: Difference between revisions

Jopejoe1 (talk | contribs)
Marked this version for translation
Pigs (talk | contribs)
m link to neovim
(6 intermediate revisions by 3 users not shown)
Line 7: Line 7:


=== Basic Install === <!--T:3-->
=== Basic Install === <!--T:3-->
<!--T:73-->
On unstable:
</translate>
</translate>
<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix>
Line 21: Line 17:


</translate>
</translate>
<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix">
   programs.vim = {
   programs.vim = {
     enable = true;
     enable = true;
     package = pkgs.vim_configurable;
     package = pkgs.vim-full;
   };
   };
</syntaxhighlight>
<translate>
<!--T:75-->
On 24.05 or older:
</translate>
<syntaxhighlight lang="nix>
  environment.systemPackages = with pkgs; [ vim ];
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
Line 42: Line 29:


</translate>
</translate>
<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix">
   environment.systemPackages = with pkgs; [ vim_configurable ];
   environment.systemPackages = with pkgs; [ vim-full ];
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
Line 71: Line 58:


<!--T:11-->
<!--T:11-->
You can configure home-manager to install spelling files into your user directory by packaging individual spell files.  Here' an example for neovim and French:
You can configure home-manager to install spelling files into your user directory by packaging individual spell files.  Here' an example for [[neovim]] and French:


</translate>
</translate>
Line 154: Line 141:
}
}
</syntaxHighlight>
</syntaxHighlight>
<translate>
<!--T:80-->
On 24.05 or older:
</translate>
<syntaxHighlight lang="nix">
{ pkgs, ... }:
{
  environment.variables = { EDITOR = "vim";
  environment.systemPackages = with pkgs; [
    ((vim_configurable.override {  }).customize{
      name = "vim";
<translate>
      <!--T:81-->
# Install plugins for example for syntax highlighting of nix files
</translate>
      vimrcConfig.packages.myplugins = with pkgs.vimPlugins; {
        start = [ vim-nix vim-lastplace ];
        opt = [];
      };
      vimrcConfig.customRC = ''
<translate>
        <!--T:82-->
" your custom vimrc
</translate>
        set nocompatible
        set backspace=indent,eol,start
<translate>
        <!--T:83-->
" Turn on syntax highlighting by default
</translate>
        syntax on
        " ...
      '';
    }
  )];
}
</syntaxHighlight>
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
{ pkgs, ... }:
{ pkgs, ... }:
Line 369: Line 316:


<!--T:46-->
<!--T:46-->
As per the instructions found in https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/vim.section.md
Please see https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/vim.section.md.
 
<!--T:93-->
* First run <code>./update.py</code>.
 
<!--T:94-->
* Commit the changes with the commit message "vimPlugins: Update".
 
<!--T:95-->
* Add your plugin to ./vim-plugin-names (please try to maintain the list alphabetically sorted). You can customize the branch by appending for example <code>@main</code> to an entry (search the file for examples)
 
<!--T:96-->
* Run <code>./update.py</code> once again to generate the plugin's nix expression.
 
<!--T:97-->
* Commit your changes one more time, this time with the message formated as such: "vimPlugins.[plugin-name]: init at [version]".
 
<!--T:98-->
* 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>./update.py</code>. They will be included in the generated code.


==== Notes Regarding Plugins ==== <!--T:47-->
==== Notes Regarding Plugins ==== <!--T:47-->
Line 482: Line 411:


<!--T:59-->
<!--T:59-->
The following snippet will make a full featured python IDE.
The following snippet will make a full featured [[python]] IDE.


==== Using language client ==== <!--T:60-->
==== Using language client ==== <!--T:60-->
Line 544: Line 473:
<!--T:67-->
<!--T:67-->
A better alternative to youcompleteme for C/C++ is to use [https://github.com/cquery-project/cquery/ cquery] in combination with the [https://github.com/autozimu/LanguageClient-neovim LanguageClient-neovim]. It will also find in c header files when used in a nix-shell if you install cquery from nixpkgs as it uses a custom [https://github.com/NixOS/nixpkgs/commit/04f3b76dcec21f2fcba6b1b0afbb3ed224165050#diff-11cdfc0385b9e017089c1ac09c5b838e shell wrapper]
A better alternative to youcompleteme for C/C++ is to use [https://github.com/cquery-project/cquery/ cquery] in combination with the [https://github.com/autozimu/LanguageClient-neovim LanguageClient-neovim]. It will also find in c header files when used in a nix-shell if you install cquery from nixpkgs as it uses a custom [https://github.com/NixOS/nixpkgs/commit/04f3b76dcec21f2fcba6b1b0afbb3ed224165050#diff-11cdfc0385b9e017089c1ac09c5b838e shell wrapper]
== Python 3 support for vim == <!--T:68-->
<!--T:69-->
If you have defined your vim configuration in a `./my_vim.nix` file you can install vim with the python 3 support instead of python2 by overriding the python version like the following:
</translate>
<syntaxHighlight  lang="nix">
(pkgs.callPackage ./my_vim.nix {                                                                                                                                                         
      vim_configurable = vim_configurable.override { python = python3; };                                                                                                                   
})
</syntaxHighlight>
<translate>


== gvim and gview == <!--T:70-->
== gvim and gview == <!--T:70-->


<!--T:71-->
<!--T:71-->
<code>gvim</code> and <code>gview</code> may be installed using the <code>[https://search.nixos.org/packages/?query=vimHugeX vimHugeX]</code> attribute name (package name <code>[https://search.nixos.org/packages/?query=vim_configurable vim_configurable]</code>).
You can enable <code>guiSupport</code> to make <code>gvim</code> available, though this won't give you <code>gview</code>:


</translate>
</translate>
<syntaxhighlight lang=bash>
<syntaxhighlight lang="nix">
$ nix-env -iA nixos.vimHugeX
(pkgs.vim-full.customize {
</syntaxhighlight>
   guiSupport = true;
<translate>
})
 
<!--T:72-->
If you are using <code>vim_configurable.customize</code>, you can enable <code>wrapGui</code> to make <code>gvim</code> available, though this won't give you <code>gview</code>:
 
</translate>
<syntaxhighlight lang=nix>
vim_configured = pkgs.vim_configurable.customize {
   name = "vim";
  wrapGui = true;
};
</syntaxhighlight>
</syntaxhighlight>
<translate>
<translate>
Line 583: Line 489:
</translate>
</translate>
[[Category:Applications]]
[[Category:Applications]]
[[Category:CLI Applications]]
[[Category:Text Editor{{#translation:}}]]
[[Category:Text Editor{{#translation:}}]]