Neovim: Difference between revisions
Marked this version for translation |
m Make code comments translateble |
||
| Line 9: | Line 9: | ||
== Installation == <!--T:3--> | == Installation == <!--T:3--> | ||
==== Using nix-shell ==== | <!--T:4--> | ||
==== Using nix-shell ==== | |||
</translate> | </translate> | ||
| Line 17: | Line 18: | ||
<translate> | <translate> | ||
==== Using Global Configuration ==== | <!--T:5--> | ||
==== Using Global Configuration ==== | |||
</translate> | </translate> | ||
| Line 27: | Line 29: | ||
<translate> | <translate> | ||
After modifying your configuration, apply the changes by running: | After modifying your configuration, apply the changes by running: | ||
| Line 36: | Line 37: | ||
<translate> | <translate> | ||
==== Using Home Configuration ==== | <!--T:6--> | ||
==== Using Home Configuration ==== | |||
</translate> | </translate> | ||
| Line 46: | Line 48: | ||
<translate> | <translate> | ||
After updating your configuration, apply the changes by running: | After updating your configuration, apply the changes by running: | ||
| Line 57: | Line 58: | ||
== Configuration == <!--T:7--> | == Configuration == <!--T:7--> | ||
<!--T:8--> | |||
==== Basic ==== | |||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
<translate> | |||
# Global Configuration | # Global Configuration | ||
</translate> | |||
programs.neovim = { | programs.neovim = { | ||
enable = true; | enable = true; | ||
| Line 67: | Line 71: | ||
}; | }; | ||
<translate> | |||
# Home Configuration | # Home Configuration | ||
</translate> | |||
programs.neovim = { | programs.neovim = { | ||
enable = true; | enable = true; | ||
| Line 77: | Line 83: | ||
<translate> | <translate> | ||
<!--T:10--> | |||
==== Advanced ==== | |||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
<translate> | |||
# Global Configuration | # Global Configuration | ||
</translate> | |||
programs.neovim = { | programs.neovim = { | ||
enable = true; | enable = true; | ||
| Line 103: | Line 112: | ||
}; | }; | ||
<translate> | |||
# Home Configuration | # Home Configuration | ||
# You have to add the line below to set it as the default editor: | # You have to add the line below to set it as the default editor: | ||
</translate> | |||
environment.variables.EDITOR = "nvim"; | environment.variables.EDITOR = "nvim"; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 111: | Line 122: | ||
== Tips and Tricks == <!--T:12--> | == Tips and Tricks == <!--T:12--> | ||
==== Location of Options ==== | <!--T:13--> | ||
==== Location of Options ==== | |||
The home manager options are defined in the following [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.neovim.enable Home Manager Options Manual]. | The home manager options are defined in the following [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.neovim.enable Home Manager Options Manual]. | ||
| Line 119: | Line 130: | ||
The global options are listed on [https://mynixos.com/search?q=nixpkgs%2Foption%2Fprograms.neovim MyNixOS]. | The global options are listed on [https://mynixos.com/search?q=nixpkgs%2Foption%2Fprograms.neovim MyNixOS]. | ||
==== Neovim Nightly ==== | <!--T:15--> | ||
==== Neovim Nightly ==== | |||
Have a look at the [https://github.com/nix-community/neovim-nightly-overlay Neovim Nightly Overlay] to install the most recent current nightly version of Neovim. | Have a look at the [https://github.com/nix-community/neovim-nightly-overlay Neovim Nightly Overlay] to install the most recent current nightly version of Neovim. | ||
| Line 130: | Line 141: | ||
nix run "github:nix-community/neovim-nightly-overlay" | nix run "github:nix-community/neovim-nightly-overlay" | ||
==== Pre-Configured Configurations ==== | <!--T:18--> | ||
==== Pre-Configured Configurations ==== | |||
If you prefer not to configure your system manually, NixOS offers several predefined configurations and community-supported options. Here are a few of them: | If you prefer not to configure your system manually, NixOS offers several predefined configurations and community-supported options. Here are a few of them: | ||
| Line 138: | Line 149: | ||
* [https://www.lazyvim.org/ LazyVim] | * [https://www.lazyvim.org/ LazyVim] | ||
* [https://astronvim.com/ AstroVim] | * [https://astronvim.com/ AstroVim] | ||
* [https://nvchad.com/ NVChad] | * [https://nvchad.com/ NVChad] | ||
Another excellent option is [https://www.lunarvim.org/docs/installation LunarVim]. The development community describes it as "an IDE layer for Neovim with sane defaults." LunarVim includes an installer/updater for LSP modules and other features. It can be installed via the <code>lunarvim</code> package from <code>nixpkgs</code> and is started with the <code>lvim</code> command. | Another excellent option is [https://www.lunarvim.org/docs/installation LunarVim]. The development community describes it as "an IDE layer for Neovim with sane defaults." LunarVim includes an installer/updater for LSP modules and other features. It can be installed via the <code>lunarvim</code> package from <code>nixpkgs</code> and is started with the <code>lvim</code> command. | ||
| Line 150: | Line 158: | ||
The configuration for LunarVim is stored in <code>./config/lvim</code>. | The configuration for LunarVim is stored in <code>./config/lvim</code>. | ||
==== Plugin Management ==== | <!--T:21--> | ||
==== Plugin Management ==== | |||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
plugins = [ | plugins = [ | ||
<translate> | |||
# Example Plugin: nvim-tree-lua | # Example Plugin: nvim-tree-lua | ||
</translate> | |||
pkgs.vimPlugins.nvim-tree-lua | pkgs.vimPlugins.nvim-tree-lua | ||
<translate> | |||
# Example Plugin: vim-startify with configuration | # Example Plugin: vim-startify with configuration | ||
</translate> | |||
{ | { | ||
plugin = pkgs.vimPlugins.vim-startify; | plugin = pkgs.vimPlugins.vim-startify; | ||
| Line 164: | Line 177: | ||
} | } | ||
<translate> | |||
# Example Plugin: nvim-colorizer-lua with Lua config | # Example Plugin: nvim-colorizer-lua with Lua config | ||
# Due to how the runtimepath for Lua modules is processed, your configuration may require | # Due to how the runtimepath for Lua modules is processed, your configuration may require | ||
# packadd! plugin-name to require a module. A home-manager example: | # packadd! plugin-name to require a module. A home-manager example: | ||
</translate> | |||
{ | { | ||
plugin = pkgs.vimPlugins.nvim-colorizer-lua; | plugin = pkgs.vimPlugins.nvim-colorizer-lua; | ||
| Line 173: | Line 188: | ||
lua << END | lua << END | ||
require 'colorizer'.setup { | require 'colorizer'.setup { | ||
'*'; -- Highlight all files, but customize some others. | '*';<translate> -- Highlight all files, but customize some others.</translate> | ||
'!vim'; -- Exclude vim from highlighting. | '!vim';<translate> -- Exclude vim from highlighting.</translate> | ||
} | } | ||
END | END | ||
| Line 180: | Line 195: | ||
} | } | ||
<translate> | |||
# Example Plugin: nvim-treesitter with Lua config | # Example Plugin: nvim-treesitter with Lua config | ||
</translate> | |||
{ | { | ||
plugin = pkgs.vimPlugins.nvim-treesitter; | plugin = pkgs.vimPlugins.nvim-treesitter; | ||
| Line 188: | Line 205: | ||
require'nvim-treesitter.configs'.setup { | require'nvim-treesitter.configs'.setup { | ||
highlight = { | highlight = { | ||
enable = true, -- false will disable the whole extension | enable = true, <translate>-- false will disable the whole extension</translate> | ||
disable = {}, -- list of languages that will be disabled | disable = {}, <translate>-- list of languages that will be disabled</translate> | ||
}, | }, | ||
incremental_selection = { | incremental_selection = { | ||
| Line 217: | Line 234: | ||
} | } | ||
<translate> | |||
# Installing grammars for tree-sitter | # Installing grammars for tree-sitter | ||
# Option 1: Install all grammar packages | # Option 1: Install all grammar packages | ||
| Line 227: | Line 245: | ||
# Installing grammar packages through the built-in command can lead to errors. | # Installing grammar packages through the built-in command can lead to errors. | ||
# The following Neovim command will install syntax highlighting for the C programming language: :TSInstall c | # The following Neovim command will install syntax highlighting for the C programming language: :TSInstall c | ||
</translate> | |||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||