Vim/ru: Difference between revisions

FuzzyBot (talk | contribs)
Updating to match new version of source page
Unabomberlive (talk | contribs)
Created page with "Иногда вы не хотите изменять плагины, находящиес в upstream, для этого вы можете использовать <code>vimUtils.buildVimPlugin</code> для создания своего собственного плагина:"
 
(29 intermediate revisions by 2 users not shown)
Line 5: Line 5:
== Установка ==
== Установка ==


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Basic_Install"></span>
=== Basic Install ===
=== Начальная Установка ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
На unstable ветке:
On unstable:
</div>


<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix>
Line 17: Line 14:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
или
or
</div>


<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix>
Line 28: Line 23:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
На 24.05 или старше:
On 24.05 or older:
</div>


<syntaxhighlight lang="nix>
<syntaxhighlight lang="nix>
Line 64: Line 57:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Vim_Spell_Files"></span>
=== Vim Spell Files ===
=== Файлы Правописания Vim ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Вы можете настроить на установку файлов правописания в каталог пользователя через home-manager, упаковывая отдельные файлы правописанияВот пример для neovim и французского языка:
You can configure home-manager to install spelling files into your user directory by packaging individual spell filesHere' an example for neovim and French:
</div>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 110: Line 100:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="System_wide_vim/nvim_configuration"></span>
== System wide vim/nvim configuration ==
== Глобальная настройка vim/nvim ==
</div>


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


<div lang="en" dir="ltr" class="mw-content-ltr">
On unstable ветке:
On unstable:
</div>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 143: Line 130:
         set nocompatible
         set nocompatible
         set backspace=indent,eol,start
         set backspace=indent,eol,start
         <div lang="en" dir="ltr" class="mw-content-ltr">
         " Включить подсветку синтаксиса по умолчанию
" Turn on syntax highlighting by default
</div>
         syntax on
         syntax on
         " ...
         " ...
Line 154: Line 139:
</syntaxHighlight>
</syntaxHighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
На 24.05 или старше:
On 24.05 or older:
</div>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 178: Line 161:
         set nocompatible
         set nocompatible
         set backspace=indent,eol,start
         set backspace=indent,eol,start
         <div lang="en" dir="ltr" class="mw-content-ltr">
         " Включить подсветку синтаксиса по умолчанию
" Turn on syntax highlighting by default
</div>
         syntax on
         syntax on
         " ...
         " ...
Line 214: Line 195:
</syntaxHighlight>
</syntaxHighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
импортируйте их в свой <code>configuration.nix</code> и
import these in your <code>configuration.nix</code> and
</div>
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
{     
{     
Line 227: Line 206:
</syntaxHighlight>
</syntaxHighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Custom_setup_without_using_Home_Manager"></span>
== Custom setup without using Home Manager ==
== Пользовательская настройка без использования Home Manager ==
</div>


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


<div lang="en" dir="ltr" class="mw-content-ltr">
Плагины Vim могут быть установлены с помощью Nix. Вы можете не использовать менеджеры плагинов и сделать все самостоятельно в <code>.nixpkgs/config</code>.
Vim plugins can be installed with the help of nix. You can omit using vim plugin managers and do everything in your <code>.nixpkgs/config</code>.
</div>


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


<div lang="en" dir="ltr" class="mw-content-ltr">
И в vim, и в neovim можно дополнительно включенить ваши любимые плагины и дополнительные библиотеки. Чтобы получить список всех доступных плагинов vim, выполните команду <code>nix search nixpkgs#vimPlugins</code>.
Both vim and neovim can be further configured to include your favorite plugins and additional libraries. To list all available vim plugins, run <code>nix search nixpkgs#vimPlugins</code>.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Добавьте следующий код в ваш <code>~/.nixpkgs/config.nix</code>
Add the following code to your <code>~/.nixpkgs/config.nix</code>:
</div>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 260: Line 232:
     myVim = vim_configurable.customize {
     myVim = vim_configurable.customize {
       name = "vim-with-plugins";
       name = "vim-with-plugins";
       <div lang="en" dir="ltr" class="mw-content-ltr">
       # добавьте сюда код из секции с примером
# add here code from the example section
</div>
     };
     };
     myNeovim = neovim.override {
     myNeovim = neovim.override {
       configure = {
       configure = {
         customRC = ''
         customRC = ''
           <div lang="en" dir="ltr" class="mw-content-ltr">
           # здесь должна находится ваша пользовательская конфигурация!
# here your custom configuration goes!
</div>
         '';
         '';
         packages.myVimPackage = with pkgs.vimPlugins; {
         packages.myVimPackage = with pkgs.vimPlugins; {
           <div lang="en" dir="ltr" class="mw-content-ltr">
           # смотрите примеры ниже чтобы узнать как использовать пользовательские пакеты
# see examples below how to use custom packages
</div>
           start = [ ];
           start = [ ];
           opt = [ ];
           opt = [ ];
Line 291: Line 257:
=== Примеры ===
=== Примеры ===


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Apply_custom_vimrc_configuration"></span>
==== Apply custom vimrc configuration ====
==== Добавить пользовательские настройка в вашу конфигурацию vimrc ====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 302: Line 267:
vim_configurable.customize {
vim_configurable.customize {
   name = "vim-with-plugins";
   name = "vim-with-plugins";
   <div lang="en" dir="ltr" class="mw-content-ltr">
   # добавьте пользовательские строки в .vimrc, например, такие:
# add custom .vimrc lines like this:
</div>
   vimrcConfig.customRC = ''
   vimrcConfig.customRC = ''
     set hidden
     set hidden
Line 367: Line 330:
<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
As per the instructions found in https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/vim.section.md
* First run <code>./update.py</code>.
</div>
 
* Сначала выполните <code>./update.py</code>.
 
<div lang="en" dir="ltr" class="mw-content-ltr">
* Commit the changes with the commit message "vimPlugins: Update".
* 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)
* 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)
* Run <code>./update.py</code> once again to generate the plugin's nix expression.
</div>
 
* Запустите <code>./update.py</code> еще раз, чтобы сгенерировать nix-выражение плагина.
 
<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]".
* 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.
* 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 385: Line 362:
=== Добавьте новый пользовательский плагин в пользовательские пакеты ===
=== Добавьте новый пользовательский плагин в пользовательские пакеты ===


<div lang="en" dir="ltr" class="mw-content-ltr">
Иногда вы не хотите изменять плагины, находящиес в upstream, для этого вы можете использовать <code>vimUtils.buildVimPlugin</code> для создания своего собственного плагина:
Sometimes you do not want to change upstream plugins, for this you can use  <code>vimUtils.buildVimPlugin</code> to create your own:
</div>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 468: Line 443:


<span id="Vim_as_a_Python_IDE"></span>
<span id="Vim_as_a_Python_IDE"></span>
=== Vim как Python IDE ===
=== Vim в качестве Python IDE ===


Следующий фрагмент создаст полнофункциональную IDE для python.
Следующий фрагмент создаст полнофункциональную IDE для python.
Line 517: Line 492:
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
* [https://github.com/jagajaga/my_configs/blob/master/.nixpkgs/common.nix Jagajaga’s config]
* [https://github.com/jagajaga/my_configs/blob/master/.nixpkgs/common.nix Jagajaga’s config]
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* [https://github.com/andrewrk/dotfiles/blob/master/.nixpkgs/config.nix andrewrk's config]
* [https://github.com/andrewrk/dotfiles/blob/master/.nixpkgs/config.nix andrewrk's config]
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* [https://github.com/wagnerf42/nixos-config/blob/master/config/my_vim.nix wagnerf42's config (good for rust language)]
* [https://github.com/wagnerf42/nixos-config/blob/master/config/my_vim.nix wagnerf42's config (good for rust language)]
</div>
</div>
Line 534: Line 515:
== Поддержка Python 3 для Vim ==
== Поддержка Python 3 для Vim ==


<div lang="en" dir="ltr" class="mw-content-ltr">
Если вы определили конфигурацию vim в файле `./my_vim.nix`, вы можете установить vim с поддержкой python3 вместо python2, переопределив версию python, как показано ниже:
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:
</div>


<syntaxHighlight  lang="nix">
<syntaxHighlight  lang="nix">
Line 564: Line 543:
   wrapGui = true;
   wrapGui = true;
};
};
</syntaxhighlight
</syntaxhighlight>


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