Vim: Difference between revisions
Use shorter syntax for setting xdg config files |
Use dedicated NixOS options instead of systemPackages |
||
| Line 7: | Line 7: | ||
=== Basic Install === <!--T:3--> | === Basic Install === <!--T:3--> | ||
On unstable: | |||
<syntaxhighlight lang="nix> | |||
programs.vim.enable = true; | |||
</syntaxhighlight> | |||
or | |||
<syntaxhighlight lang="nix> | |||
programs.vim = { | |||
enable = true; | |||
package = pkgs.vim_configurable; | |||
}; | |||
</syntaxhighlight> | |||
On 24.05 or older: | |||
<!--T:4--> | <!--T:4--> | ||
| Line 88: | Line 105: | ||
<!--T:19--> | <!--T:19--> | ||
If you want a system wide "baseline" configuration for vim/nvim here are two examples:. | If you want a system wide "baseline" configuration for vim/nvim here are two examples:. | ||
On unstable: | |||
<syntaxHighlight lang="nix"> | |||
{ pkgs, ... }: | |||
{ | |||
programs.vim = { | |||
enable = true; | |||
defaultEditor = true; | |||
package = (pkgs.vim_configurable.override { }).customize{ | |||
name = "vim"; | |||
# Install plugins for example for syntax highlighting of nix files | |||
vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { | |||
start = [ vim-nix vim-lastplace ]; | |||
opt = []; | |||
}; | |||
vimrcConfig.customRC = '' | |||
" your custom vimrc | |||
set nocompatible | |||
set backspace=indent,eol,start | |||
" Turn on syntax highlighting by default | |||
syntax on | |||
" ... | |||
''; | |||
}; | |||
}; | |||
} | |||
</syntaxHighlight> | |||
On 24.05 or older: | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
| Line 120: | Line 166: | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
{ | { | ||
programs.neovim = { | |||
enable = true; | |||
defaultEditor = true; | |||
vimAlias = true; | |||
configure = { | |||
customRC = '' | |||
" your custom vimrc | " your custom vimrc | ||
set nocompatible | set nocompatible | ||
| Line 132: | Line 177: | ||
" ... | " ... | ||
''; | ''; | ||
packages.myPlugins = with pkgs.vimPlugins; { | |||
start = [ vim-lastplace vim-nix ]; | |||
opt = []; | |||
}; | }; | ||
} | }; | ||
}; | |||
} | } | ||
</syntaxHighlight> | </syntaxHighlight> | ||