Vim/ru: Difference between revisions
Updating to match new version of source page |
Created page with "Иногда вы не хотите изменять плагины, находящиес в upstream, для этого вы можете использовать <code>vimUtils.buildVimPlugin</code> для создания своего собственного плагина:" |
||
(29 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
== Установка == | == Установка == | ||
< | <span id="Basic_Install"></span> | ||
=== | === Начальная Установка === | ||
На unstable ветке: | |||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 17: | Line 14: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
или | |||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 28: | Line 23: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
На 24.05 или старше: | |||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 64: | Line 57: | ||
</div> | </div> | ||
< | <span id="Vim_Spell_Files"></span> | ||
=== Vim | === Файлы Правописания Vim === | ||
Вы можете настроить на установку файлов правописания в каталог пользователя через home-manager, упаковывая отдельные файлы правописания. Вот пример для neovim и французского языка: | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
Line 110: | Line 100: | ||
</div> | </div> | ||
< | <span id="System_wide_vim/nvim_configuration"></span> | ||
== | == Глобальная настройка vim/nvim == | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Line 118: | Line 107: | ||
</div> | </div> | ||
On unstable ветке: | |||
On unstable: | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
Line 143: | Line 130: | ||
set nocompatible | set nocompatible | ||
set backspace=indent,eol,start | set backspace=indent,eol,start | ||
" Включить подсветку синтаксиса по умолчанию | |||
syntax on | syntax on | ||
" ... | " ... | ||
Line 154: | Line 139: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
На 24.05 или старше: | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
Line 178: | Line 161: | ||
set nocompatible | set nocompatible | ||
set backspace=indent,eol,start | set backspace=indent,eol,start | ||
" Включить подсветку синтаксиса по умолчанию | |||
syntax on | syntax on | ||
" ... | " ... | ||
Line 214: | Line 195: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
импортируйте их в свой <code>configuration.nix</code> и | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
{ | { | ||
Line 227: | Line 206: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
< | <span id="Custom_setup_without_using_Home_Manager"></span> | ||
== | == Пользовательская настройка без использования Home Manager == | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Line 235: | Line 213: | ||
</div> | </div> | ||
Плагины Vim могут быть установлены с помощью Nix. Вы можете не использовать менеджеры плагинов и сделать все самостоятельно в <code>.nixpkgs/config</code>. | |||
Vim | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Line 247: | Line 223: | ||
</div> | </div> | ||
И в vim, и в neovim можно дополнительно включенить ваши любимые плагины и дополнительные библиотеки. Чтобы получить список всех доступных плагинов vim, выполните команду <code>nix search nixpkgs#vimPlugins</code>. | |||
Добавьте следующий код в ваш <code>~/.nixpkgs/config.nix</code> | |||
<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"; | ||
# добавьте сюда код из секции с примером | |||
# | |||
}; | }; | ||
myNeovim = neovim.override { | myNeovim = neovim.override { | ||
configure = { | configure = { | ||
customRC = '' | customRC = '' | ||
# здесь должна находится ваша пользовательская конфигурация! | |||
# | |||
''; | ''; | ||
packages.myVimPackage = with pkgs.vimPlugins; { | packages.myVimPackage = with pkgs.vimPlugins; { | ||
# смотрите примеры ниже чтобы узнать как использовать пользовательские пакеты | |||
# | |||
start = [ ]; | start = [ ]; | ||
opt = [ ]; | opt = [ ]; | ||
Line 291: | Line 257: | ||
=== Примеры === | === Примеры === | ||
< | <span id="Apply_custom_vimrc_configuration"></span> | ||
==== | ==== Добавить пользовательские настройка в вашу конфигурацию vimrc ==== | ||
<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"; | ||
# добавьте пользовательские строки в .vimrc, например, такие: | |||
# | |||
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 | ||
* | </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) | ||
* | </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: | ||
=== Добавьте новый пользовательский плагин в пользовательские пакеты === | === Добавьте новый пользовательский плагин в пользовательские пакеты === | ||
Иногда вы не хотите изменять плагины, находящиес в upstream, для этого вы можете использовать <code>vimUtils.buildVimPlugin</code> для создания своего собственного плагина: | |||
<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 | === 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 == | ||
Если вы определили конфигурацию vim в файле `./my_vim.nix`, вы можете установить vim с поддержкой python3 вместо python2, переопределив версию python, как показано ниже: | |||
<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:}}]] |