Vim/ja: Difference between revisions
Updating to match new version of source page |
Haruki7049 (talk | contribs) Created page with "以下のコードを<code>~/.nixpkgs/config.nix</code>に追加してください:" |
||
(21 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
=== ベーシックインストール === | === ベーシックインストール === | ||
unstableでは: | |||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 18: | Line 16: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
もしくは | |||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 29: | Line 25: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
24.05かそれよりも古い場合は: | |||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 46: | Line 40: | ||
=== Home Managerを使用した例 === | === Home Managerを使用した例 === | ||
Vimは[[Special:MyLanguage/Home Manager|Home Manager]]を使用して簡単にセットアップ出来ます。以下は最低限の一例です: | Vimは[[Special:MyLanguage/Home Manager|Home Manager]]を使用して簡単にセットアップ出来ます。以下は最低限の一例です: | ||
<syntaxhighlight lang="nix> | <syntaxhighlight lang="nix> | ||
Line 119: | Line 101: | ||
</div> | </div> | ||
< | <span id="System_wide_vim/nvim_configuration"></span> | ||
== | == システム全体でのvim/nvim設定 == | ||
vim/nvimのシステム全体の"ベースライン"設定が必要な場合は、次の二つの例を参照してください: | |||
unstableでは: | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
Line 139: | Line 116: | ||
package = (pkgs.vim_configurable.override { }).customize{ | package = (pkgs.vim_configurable.override { }).customize{ | ||
name = "vim"; | name = "vim"; | ||
# 例として、Nixファイルのシンタックスハイライト表示用のプラグインをインストールする | |||
# | |||
vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { | vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { | ||
start = [ vim-nix vim-lastplace ]; | start = [ vim-nix vim-lastplace ]; | ||
Line 147: | Line 122: | ||
}; | }; | ||
vimrcConfig.customRC = '' | vimrcConfig.customRC = '' | ||
" 自分のカスタムvimrc | |||
set nocompatible | set nocompatible | ||
set backspace=indent,eol,start | set backspace=indent,eol,start | ||
" シンタックスハイライトをデフォルトでオンにする | |||
syntax on | syntax on | ||
" ... | " ... | ||
Line 163: | Line 134: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
24.05かそれよりも古い場合は | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
Line 174: | Line 143: | ||
((vim_configurable.override { }).customize{ | ((vim_configurable.override { }).customize{ | ||
name = "vim"; | name = "vim"; | ||
# 例としてNixファイルのシンタックスハイライト表示用のプラグインをインストールする | |||
# | |||
vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { | vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { | ||
start = [ vim-nix vim-lastplace ]; | start = [ vim-nix vim-lastplace ]; | ||
Line 182: | Line 149: | ||
}; | }; | ||
vimrcConfig.customRC = '' | vimrcConfig.customRC = '' | ||
" 自分のカスタムvimrc | |||
set nocompatible | set nocompatible | ||
set backspace=indent,eol,start | set backspace=indent,eol,start | ||
" シンタックスハイライトをデフォルトでオンにする | |||
syntax on | syntax on | ||
" ... | " ... | ||
Line 207: | Line 170: | ||
configure = { | configure = { | ||
customRC = '' | customRC = '' | ||
" 自分のカスタムvimrc | |||
set nocompatible | set nocompatible | ||
set backspace=indent,eol,start | set backspace=indent,eol,start | ||
Line 223: | Line 184: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
これらのファイルを自分の<code>configuration.nix</code>でインポートする | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
{ | { | ||
Line 236: | Line 195: | ||
</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 244: | Line 202: | ||
</div> | </div> | ||
Vimプラグインはnixの助けを借りてインストールすることができます。vimプラグインマネージャーを使用せず、すべて<code>.nixpkgs/config</code>で行うことができます。 | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Line 252: | Line 208: | ||
</div> | </div> | ||
< | <span id="Customizations"></span> | ||
=== | === カスタマイズする === | ||
vimもneovimも、あなたの好きなプラグインや追加ライブラリを含むようにさらに設定することができます。利用可能な全ての vim プラグインをリストアップするには、<code>nix search nixpkgs#vimPlugins</code>を実行してください。 | |||
以下のコードを<code>~/.nixpkgs/config.nix</code>に追加してください: | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
Line 380: | Line 331: | ||
<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> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
* First run <code>./update.py</code>. | * 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". | * 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> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
* Run <code>./update.py</code> once again to generate the plugin's nix expression. | * 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]". | * 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 537: | Line 506: | ||
<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 588: | Line 563: | ||
wrapGui = true; | wrapGui = true; | ||
}; | }; | ||
</syntaxhighlight | </syntaxhighlight> | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Text Editor{{#translation:}}]] | [[Category:Text Editor{{#translation:}}]] |