Vim/de: Difference between revisions

FuzzyBot (talk | contribs)
Updating to match new version of source page
FuzzyBot (talk | contribs)
Updating to match new version of source page
Line 8: Line 8:
<span id="Basic_Install"></span>
<span id="Basic_Install"></span>
=== Grundinstallation ===
=== Grundinstallation ===
Auf unstable:
<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix>
   programs.vim.enable = true;
   programs.vim.enable = true;
Line 17: Line 14:
oder
oder


<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix">
   programs.vim = {
   programs.vim = {
     enable = true;
     enable = true;
     package = pkgs.vim_configurable;
     package = pkgs.vim-full;
   };
   };
</syntaxhighlight>
Auf 24.05 oder älter:
<syntaxhighlight lang="nix>
  environment.systemPackages = with pkgs; [ vim ];
</syntaxhighlight>
</syntaxhighlight>


oder
oder


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


Line 60: Line 51:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
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:
</div>
</div>


Line 112: Line 103:
</div>
</div>


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
{ pkgs, ... }:
{ pkgs, ... }:
{
{
Line 118: Line 109:
     enable = true;
     enable = true;
     defaultEditor = true;
     defaultEditor = true;
     package = (pkgs.vim_configurable.override {  }).customize{
     package = (pkgs.vim-full.override {  }).customize{
       name = "vim";
       name = "vim";
       # Installiere Plugins wie zum Beispiel für Syntaxhervorhebung von Nix Dateien
       # Installiere Plugins wie zum Beispiel für Syntaxhervorhebung von Nix Dateien
Line 136: Line 127:
   };
   };
}
}
</syntaxHighlight>
</syntaxhighlight>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
On 24.05 or older:
</div>
 
<syntaxHighlight lang="nix">
{ pkgs, ... }:
{
  environment.variables = { EDITOR = "vim";
  environment.systemPackages = with pkgs; [
    ((vim_configurable.override {  }).customize{
      name = "vim";
      <div lang="en" dir="ltr" class="mw-content-ltr">
# Install plugins for example for syntax highlighting of nix files
</div>
      vimrcConfig.packages.myplugins = with pkgs.vimPlugins; {
        start = [ vim-nix vim-lastplace ];
        opt = [];
      };
      vimrcConfig.customRC = ''
        <div lang="en" dir="ltr" class="mw-content-ltr">
" your custom vimrc
</div>
        set nocompatible
        set backspace=indent,eol,start
        <div lang="en" dir="ltr" class="mw-content-ltr">
" Turn on syntax highlighting by default
</div>
        syntax on
        " ...
      '';
    }
  )];
}
</syntaxHighlight>
 
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
{ pkgs, ... }:
{ pkgs, ... }:
Line 239: Line 194:
</div>
</div>


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
{
{
   packageOverrides = pkgs: with pkgs; {
   packageOverrides = pkgs: with pkgs; {
     myVim = vim_configurable.customize {
     myVim = vim-full.customize {
       name = "vim-with-plugins";
       name = "vim-with-plugins";
       <div lang="en" dir="ltr" class="mw-content-ltr">
       <div lang="en" dir="ltr" class="mw-content-ltr">
Line 266: Line 221:
   };
   };
}
}
</syntaxHighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 284: Line 239:
</div>
</div>


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
vim_configurable.customize {
vim-full.customize {
   name = "vim-with-plugins";
   name = "vim-with-plugins";
   <div lang="en" dir="ltr" class="mw-content-ltr">
   <div lang="en" dir="ltr" class="mw-content-ltr">
Line 295: Line 250:
   '';
   '';
}
}
</syntaxHighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 305: Line 260:
</div>
</div>


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
vim_configurable.customize {
vim-full.customize {
   vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
   vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
     <div lang="en" dir="ltr" class="mw-content-ltr">
     <div lang="en" dir="ltr" class="mw-content-ltr">
Line 322: Line 277:
   }
   }
};
};
</syntaxHighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 354: Line 309:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
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.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* First run <code>./update.py</code>.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* Commit the changes with the commit message "vimPlugins: Update".
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* 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)
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* Run <code>./update.py</code> once again to generate the plugin's nix expression.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* Commit your changes one more time, this time with the message formated as such: "vimPlugins.[plugin-name]: init at [version]".
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* 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.
</div>
</div>


Line 397: Line 328:
</div>
</div>


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
let
let
   vim-better-whitespace = pkgs.vimUtils.buildVimPlugin {
   vim-better-whitespace = pkgs.vimUtils.buildVimPlugin {
Line 410: Line 341:
in {
in {
   users.users.<yourNickname>.packages = [
   users.users.<yourNickname>.packages = [
     (pkgs.vim_configurable.customize {
     (pkgs.vim-full.customize {
       vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
       vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
         start = [ vim-better-whitespace ];
         start = [ vim-better-whitespace ];
Line 417: Line 348:
   ];
   ];
};
};
</syntaxHighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 481: Line 412:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
The following snippet will make a full featured python IDE.
The following snippet will make a full featured [[python]] IDE.
</div>
</div>


Line 488: Line 419:
</div>
</div>


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
vim_configurable.customize {
vim-full.customize {
   vimrcConfig = {
   vimrcConfig = {
     customRC = ''
     customRC = ''
Line 507: Line 438:
     }
     }
};
};
</syntaxHighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 553: Line 484:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
== Python 3 support for vim ==
== gvim and gview ==
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
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:
You can enable <code>guiSupport</code> to make <code>gvim</code> available, though this won't give you <code>gview</code>:
</div>
</div>


<syntaxHighlight  lang="nix">
<syntaxhighlight lang="nix">
(pkgs.callPackage ./my_vim.nix {                                                                                                                                                        
(pkgs.vim-full.customize {
      vim_configurable = vim_configurable.override { python = python3; };                                                                                                                    
  guiSupport = true;
})
})
</syntaxHighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
== gvim and gview ==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<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>).
</div>
<syntaxhighlight lang=bash>
$ nix-env -iA nixos.vimHugeX
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
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>:
</div>
<syntaxhighlight lang=nix>
vim_configured = pkgs.vim_configurable.customize {
  name = "vim";
  wrapGui = true;
};
</syntaxhighlight>
</syntaxhighlight>


[[Category:Applications]]
[[Category:Applications]]
[[Category:CLI Applications]]
[[Category:Text Editor{{#translation:}}]]
[[Category:Text Editor{{#translation:}}]]