refactor(nvf): move core nvf config to a module
This commit is contained in:
parent
3e92ace989
commit
57a73bbcae
5 changed files with 118 additions and 84 deletions
|
@ -1,93 +1,10 @@
|
||||||
{ inputs, pkgs, ... }:
|
|
||||||
{
|
{
|
||||||
nix.settings.substituters = [ "https://nvf.cachix.org" ];
|
|
||||||
nix.settings.trusted-public-keys = [
|
|
||||||
"nvf.cachix.org-1:GMQWiUhZ6ux9D5CvFFMwnc2nFrUHTeGaXRlVBXo+naI="
|
|
||||||
];
|
|
||||||
|
|
||||||
home-manager.users.rafiq = {
|
home-manager.users.rafiq = {
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nvf.homeManagerModules.default
|
|
||||||
./nvf/input.nix
|
./nvf/input.nix
|
||||||
./nvf/languages.nix
|
./nvf/languages.nix
|
||||||
./nvf/ui.nix
|
./nvf/ui.nix
|
||||||
./nvf/utilities.nix
|
./nvf/utilities.nix
|
||||||
];
|
];
|
||||||
home.sessionVariables.EDITOR = "nvim";
|
|
||||||
programs.nvf = {
|
|
||||||
enable = true;
|
|
||||||
enableManpages = true;
|
|
||||||
settings.vim = {
|
|
||||||
viAlias = true;
|
|
||||||
vimAlias = true;
|
|
||||||
options = {
|
|
||||||
# Indentation
|
|
||||||
autoindent = true;
|
|
||||||
smartindent = true;
|
|
||||||
expandtab = true;
|
|
||||||
smarttab = true;
|
|
||||||
wrap = true;
|
|
||||||
shiftwidth = 2;
|
|
||||||
tabstop = 2;
|
|
||||||
foldlevel = 1000; # Open all folds by default
|
|
||||||
|
|
||||||
# Search
|
|
||||||
hlsearch = true;
|
|
||||||
ignorecase = true;
|
|
||||||
incsearch = true;
|
|
||||||
smartcase = true; # case-sensitive if search contains uppercase
|
|
||||||
|
|
||||||
# Visual
|
|
||||||
number = true;
|
|
||||||
cursorline = true;
|
|
||||||
visualbell = true;
|
|
||||||
termguicolors = true;
|
|
||||||
|
|
||||||
# Input
|
|
||||||
backspace = "indent,eol,start";
|
|
||||||
};
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
desc = "Open the file path under the cursor, making the file if it doesn't exist.";
|
|
||||||
key = "gf";
|
|
||||||
mode = "n";
|
|
||||||
action = ":cd %:p:h<CR>:e <cfile><CR>";
|
|
||||||
silent = true;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
desc = "Delete the previous word.";
|
|
||||||
key = "<C-BS>";
|
|
||||||
mode = "i";
|
|
||||||
action = "<C-W>";
|
|
||||||
silent = true;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
desc = "Open the filetree.";
|
|
||||||
key = "t";
|
|
||||||
mode = "n";
|
|
||||||
action = ":Yazi<CR>";
|
|
||||||
silent = true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
luaConfigRC.turn_off_inline_diagnostics =
|
|
||||||
# lua
|
|
||||||
''
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = false -- turn off inline diagnostics
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
extraPlugins = with pkgs.vimPlugins; {
|
|
||||||
yuck-vim = {
|
|
||||||
package = yuck-vim;
|
|
||||||
};
|
|
||||||
nvim-treesitter-parsers = {
|
|
||||||
package = nvim-treesitter-parsers.yuck;
|
|
||||||
};
|
|
||||||
nvim-parinfer = {
|
|
||||||
package = nvim-parinfer;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
nixosModules.enable = true;
|
nixosModules.enable = true;
|
||||||
nixosModules.hostname = hostname;
|
nixosModules.hostname = hostname;
|
||||||
nixosModules.mainUser = "rafiq";
|
nixosModules.mainUser = "rafiq";
|
||||||
hmModules.enable = true;
|
|
||||||
nix-config.enable = true;
|
nix-config.enable = true;
|
||||||
boot-config.enable = true;
|
boot-config.enable = true;
|
||||||
hardware-config.usbAutoMount = true;
|
hardware-config.usbAutoMount = true;
|
||||||
nw-config.backend = "networkmanager";
|
nw-config.backend = "networkmanager";
|
||||||
|
|
||||||
|
hmModules.enable = true;
|
||||||
|
hmModules.mainApps.editor = "nvf";
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
|
./programs/editor.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -32,6 +33,12 @@ in
|
||||||
example = "firefox";
|
example = "firefox";
|
||||||
description = "What browser is the default.";
|
description = "What browser is the default.";
|
||||||
};
|
};
|
||||||
|
editor = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "nvf";
|
||||||
|
example = "nvf";
|
||||||
|
description = "What editor is the default.";
|
||||||
|
};
|
||||||
launcher = lib.mkOption {
|
launcher = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "fuzzel";
|
default = "fuzzel";
|
||||||
|
|
29
modules/hm/programs/editor.nix
Normal file
29
modules/hm/programs/editor.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
username = config.nixosModules.mainUser;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = lib.mkIf (config.hmModules.mainApps.editor == "nvf") (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
nix.settings.substituters = [ "https://nvf.cachix.org" ];
|
||||||
|
nix.settings.trusted-public-keys = [
|
||||||
|
"nvf.cachix.org-1:GMQWiUhZ6ux9D5CvFFMwnc2nFrUHTeGaXRlVBXo+naI="
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users.${username} = {
|
||||||
|
imports = [
|
||||||
|
inputs.nvf.homeManagerModules.default
|
||||||
|
./nvf/core.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
79
modules/hm/programs/nvf/core.nix
Normal file
79
modules/hm/programs/nvf/core.nix
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.sessionVariables.EDITOR = "nvim";
|
||||||
|
programs.nvf = {
|
||||||
|
enable = true;
|
||||||
|
enableManpages = true;
|
||||||
|
settings.vim = {
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
options = {
|
||||||
|
# Indentation
|
||||||
|
autoindent = true;
|
||||||
|
smartindent = true;
|
||||||
|
expandtab = true;
|
||||||
|
smarttab = true;
|
||||||
|
wrap = true;
|
||||||
|
shiftwidth = 2;
|
||||||
|
tabstop = 2;
|
||||||
|
foldlevel = 1000; # Open all folds by default
|
||||||
|
|
||||||
|
# Search
|
||||||
|
hlsearch = true;
|
||||||
|
ignorecase = true;
|
||||||
|
incsearch = true;
|
||||||
|
smartcase = true; # case-sensitive if search contains uppercase
|
||||||
|
|
||||||
|
# Visual
|
||||||
|
number = true;
|
||||||
|
cursorline = true;
|
||||||
|
visualbell = true;
|
||||||
|
termguicolors = true;
|
||||||
|
|
||||||
|
# Input
|
||||||
|
backspace = "indent,eol,start";
|
||||||
|
};
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
desc = "Open the file path under the cursor, making the file if it doesn't exist.";
|
||||||
|
key = "gf";
|
||||||
|
mode = "n";
|
||||||
|
action = ":cd %:p:h<CR>:e <cfile><CR>";
|
||||||
|
silent = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Delete the previous word.";
|
||||||
|
key = "<C-BS>";
|
||||||
|
mode = "i";
|
||||||
|
action = "<C-W>";
|
||||||
|
silent = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Open the filetree.";
|
||||||
|
key = "t";
|
||||||
|
mode = "n";
|
||||||
|
action = ":Yazi<CR>";
|
||||||
|
silent = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
luaConfigRC.turn_off_inline_diagnostics =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false -- turn off inline diagnostics
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
extraPlugins = with pkgs.vimPlugins; {
|
||||||
|
yuck-vim = {
|
||||||
|
package = yuck-vim;
|
||||||
|
};
|
||||||
|
nvim-treesitter-parsers = {
|
||||||
|
package = nvim-treesitter-parsers.yuck;
|
||||||
|
};
|
||||||
|
nvim-parinfer = {
|
||||||
|
package = nvim-parinfer;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue