add: nixvim bones; refactoring

This commit is contained in:
ooks-io 2024-02-02 17:07:36 +13:00
parent 546ece2d97
commit 885d9f952b
8 changed files with 232 additions and 33 deletions

View file

@ -8,6 +8,9 @@ in
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
./settings.nix
./keymapping.nix
./plugins
];
config = lib.mkIf cfg.enable {
@ -18,26 +21,12 @@ in
programs.nixvim = {
enable = true;
options = {
number = true;
};
globals = {
mapleader = " ";
updatetime = 200;
timeoutlen = 400;
};
plugins = {
lualine = {
enable = true;
};
which-key = {
enable = true;
};
indent-blankline = {
enable = true;
keyLabels = {
" " = "<space>";
};
};
};

View file

@ -0,0 +1,50 @@
{ config, lib, ... }:
let
cfg = config.desktop.console.editor.nvim;
in
{
config = lib.mkIf cfg.enable {
programs.nixvim = {
globals = {
mapleader = " ";
maplocalleader = " ";
};
keymaps = let
normal =
lib.mapAttrsToList
(key: action: {
mode = "n";
inherit action key;
})
{
"<Space>" = "<NOP>";
"esc" = ":noh<CR>";
"Y" = "$y";
};
visual =
lib.mapAttrsToList
(key: action: {
mode = "v";
inherit action key;
})
{
# better indenting
">" = ">gv";
"<" = "<gv";
"<TAB>" = ">gv";
"<S-TAB>" = "<gv";
# move selected line / block of text in visual mode
"K" = ":m '<-2<CR>gv=gv";
"J" = ":m '>+1<CR>gv=gv";
};
in
config.nixvim.helpers.keymaps.mkKeymaps
{options.silent = true;}
(normal ++ visual);
};
};
}

View file

@ -0,0 +1,23 @@
{ config, lib, ... }:
let
cfg = config.homeModules.console.editor.nvim.plugins;
in
{
config = lib.mkif cfg.lualine {
programs.nixvim.plugins.lualine = {
enable = true;
theme = "base16";
globalstatus = true;
sections = {
lualine_a = ["mode"];
lualine_b = ["branch"];
lualine_c = ["filename" "diff"];
lualine_x = ["diagnostics"];
lualine_y = ["fileformat"];
lualine_z = ["filetype"];
};
};
};
}

View file

@ -0,0 +1,60 @@
{ config, lib, ... }:
let
inherit (config.colorscheme) colors;
cfg = config.homeModules.console.editor.nvim;
in
{
config = lib.mkIf cfg.enable {
programs.nixvim = {
options = {
relativenumber = true;
number = true;
hidden = true;
mouse = "a";
mousemodel = "extend";
undofile = true;
swapfile = false;
incsearch = true;
ignorecase = true;
smartcase = true;
fileencoding = "utf-8";
termguicolors = true;
autoindent = true;
shiftwidth = 2;
smartindent = true;
expandtab = true;
updatetime = 100;
};
clipboard = {
register = "unnamedplus";
providers.wl-copy.enable = true;
};
colorschemes.base16 = {
enable = true;
colorscheme = config.colorscheme.slug;
customColorScheme = {
base00 = "#${colors.base00}";
base01 = "#${colors.base01}";
base02 = "#${colors.base02}";
base03 = "#${colors.base03}";
base04 = "#${colors.base04}";
base05 = "#${colors.base05}";
base06 = "#${colors.base06}";
base07 = "#${colors.base07}";
base08 = "#${colors.base08}";
base09 = "#${colors.base09}";
base0A = "#${colors.base0A}";
base0B = "#${colors.base0B}";
base0C = "#${colors.base0C}";
base0D = "#${colors.base0D}";
base0E = "#${colors.base0E}";
base0F = "#${colors.base0F}";
};
};
};
};
}