neovim-flake/docs/home-manager.adoc

77 lines
1.7 KiB
Plaintext
Raw Normal View History

2023-02-06 19:58:09 +01:00
[[ch-hm-module]]
== Home Manager
The Home Manager module allows us to customize the different `vim` options. To use it, we first add the input flake.
[source,nix]
----
{
neovim-flake = {
url = github:notashelf/neovim-flake;
# you can override input nixpkgs
inputs.nixpkgs.follows = "nixpkgs";
};
}
----
Followed by importing the HM module.
[source,nix]
----
{
imports = [ neovim-flake.homeManagerModules.default ];
2023-02-06 19:58:09 +01:00
}
----
Then we should be able to use the given module. E.g.
[source,nix]
----
{
programs.neovim-flake = {
2023-02-06 19:58:09 +01:00
enable = true;
# your settings need to go into the settings attrset
2023-02-06 19:58:09 +01:00
settings = {
vim.viAlias = false;
vim.vimAlias = true;
vim.lsp = {
enable = true;
};
};
};
}
----
=== Custom vim plugins
It's possible to add custom vim plugins by using the startPlugins and lua DAG settings. First we install the plugin by adding it to startPlugins, I'll be using the nvim-surround plugin for example. This process should be very similar for nixos installations.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ];
};
};
}
----
Then we continue by requireing the plugin in lua using DAG settings. Please note that you're able to name this setting to however you want, in my situation I'll name it nvim-surround since that's the plugin that I'll be installing.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ];
luaConfigRC.nvim-surround = nvim-flake.lib.nvim.dag.entryAnywhere ''
require("nvim-surround").setup()
'';
};
};
}
----