add: nixvim bones; refactoring
This commit is contained in:
		
							parent
							
								
									546ece2d97
								
							
						
					
					
						commit
						885d9f952b
					
				
					 8 changed files with 232 additions and 33 deletions
				
			
		
							
								
								
									
										30
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										30
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							|  | @ -213,11 +213,11 @@ | ||||||
|         "rust-overlay": "rust-overlay" |         "rust-overlay": "rust-overlay" | ||||||
|       }, |       }, | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1706459685, |         "lastModified": 1706565513, | ||||||
|         "narHash": "sha256-/OaxGhNJrBZcOBGKvEC7KFDShtMJOIpny5+N9G/qRkE=", |         "narHash": "sha256-eiiHgBdpluVFjjWaunP1GFEDYnCLq54CeCD7h1JP7jY=", | ||||||
|         "owner": "helix-editor", |         "owner": "helix-editor", | ||||||
|         "repo": "helix", |         "repo": "helix", | ||||||
|         "rev": "87a720c3a13ccc7245f5b0befc008db5bd039032", |         "rev": "cf4492174d0ee27bd3c73a5fa57fe3a26aa064be", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|  | @ -233,11 +233,11 @@ | ||||||
|         ] |         ] | ||||||
|       }, |       }, | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1706435589, |         "lastModified": 1706473109, | ||||||
|         "narHash": "sha256-yhEYJxMv5BkfmUuNe4QELKo+V5eq1pwhtVs6kEziHfE=", |         "narHash": "sha256-iyuAvpKTsq2u23Cr07RcV5XlfKExrG8gRpF75hf1uVc=", | ||||||
|         "owner": "nix-community", |         "owner": "nix-community", | ||||||
|         "repo": "home-manager", |         "repo": "home-manager", | ||||||
|         "rev": "4d54c29bce71f8c261513e0662cc573d30f3e33e", |         "rev": "d634c3abafa454551f2083b054cd95c3f287be61", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|  | @ -278,11 +278,11 @@ | ||||||
|         "xdph": "xdph" |         "xdph": "xdph" | ||||||
|       }, |       }, | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1706485369, |         "lastModified": 1706571425, | ||||||
|         "narHash": "sha256-FHojTmzX3SrAC+VXu+xdmTPwZtlSQ8KzRfq89c7DrN0=", |         "narHash": "sha256-VwVUPb5vuy4GGUx1XMhDMaKk9n8Gs5xUTG9CItoHL04=", | ||||||
|         "owner": "hyprwm", |         "owner": "hyprwm", | ||||||
|         "repo": "hyprland", |         "repo": "hyprland", | ||||||
|         "rev": "4b4bd90b1450cbfc01d9ac429363cc7cecd6be8b", |         "rev": "3ff59e7e1d859daa503b88ef125d087bc100abfe", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|  | @ -577,11 +577,11 @@ | ||||||
|     }, |     }, | ||||||
|     "nixpkgs_4": { |     "nixpkgs_4": { | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1706191920, |         "lastModified": 1706371002, | ||||||
|         "narHash": "sha256-eLihrZAPZX0R6RyM5fYAWeKVNuQPYjAkCUBr+JNvtdE=", |         "narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=", | ||||||
|         "owner": "nixos", |         "owner": "nixos", | ||||||
|         "repo": "nixpkgs", |         "repo": "nixpkgs", | ||||||
|         "rev": "ae5c332cbb5827f6b1f02572496b141021de335f", |         "rev": "c002c6aa977ad22c60398daaa9be52f2203d0006", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|  | @ -616,11 +616,11 @@ | ||||||
|         "pre-commit-hooks": "pre-commit-hooks" |         "pre-commit-hooks": "pre-commit-hooks" | ||||||
|       }, |       }, | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1706514457, |         "lastModified": 1706539542, | ||||||
|         "narHash": "sha256-rfdCFizftdKpkKzXB7HjopQAftHgNIyyTQPkuDgo5Os=", |         "narHash": "sha256-Zbd9/0iTDNwf6ePvKkISvSMK6S7kmfsPzyG5f57sVA8=", | ||||||
|         "owner": "nix-community", |         "owner": "nix-community", | ||||||
|         "repo": "nixvim", |         "repo": "nixvim", | ||||||
|         "rev": "395836480995d418b96df527ebded1bc4b3134f0", |         "rev": "37d124e94603f821b56072794c4800ad10252fd7", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|  |  | ||||||
|  | @ -10,7 +10,10 @@ | ||||||
| 
 | 
 | ||||||
|     nix-colors.url = "github:misterio77/nix-colors"; |     nix-colors.url = "github:misterio77/nix-colors"; | ||||||
| 
 | 
 | ||||||
|     nixvim.url = "github:nix-community/nixvim"; |     nixvim = { | ||||||
|  |       url = "github:nix-community/nixvim"; | ||||||
|  |       inputs.nixpkgs.follows = "nixpkgs"; | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|     firefox-addons = { |     firefox-addons = { | ||||||
|       url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; |       url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; | ||||||
|  |  | ||||||
|  | @ -8,6 +8,9 @@ in | ||||||
| { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     inputs.nixvim.homeManagerModules.nixvim |     inputs.nixvim.homeManagerModules.nixvim | ||||||
|  |     ./settings.nix | ||||||
|  |     ./keymapping.nix | ||||||
|  |     ./plugins | ||||||
|   ]; |   ]; | ||||||
|    |    | ||||||
|   config = lib.mkIf cfg.enable { |   config = lib.mkIf cfg.enable { | ||||||
|  | @ -18,26 +21,12 @@ in | ||||||
| 
 | 
 | ||||||
|     programs.nixvim = { |     programs.nixvim = { | ||||||
|       enable = true; |       enable = true; | ||||||
| 
 |  | ||||||
|       options = { |  | ||||||
|         number = true; |  | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       globals = { |  | ||||||
|         mapleader = " "; |  | ||||||
|         updatetime = 200; |  | ||||||
|         timeoutlen = 400; |  | ||||||
|       }; |  | ||||||
|        |  | ||||||
|       plugins = { |       plugins = { | ||||||
|         lualine = { |  | ||||||
|           enable = true; |  | ||||||
|         }; |  | ||||||
|         which-key = { |         which-key = { | ||||||
|           enable = true; |           enable = true; | ||||||
|  |           keyLabels = { | ||||||
|  |             " " = "<space>"; | ||||||
|           }; |           }; | ||||||
|         indent-blankline = { |  | ||||||
|           enable = true; |  | ||||||
|         }; |         }; | ||||||
|       };   |       };   | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										50
									
								
								home/modules/console/editor/nvim/keymappings.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								home/modules/console/editor/nvim/keymappings.nix
									
										
									
									
									
										Normal 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); | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										0
									
								
								home/modules/console/editor/nvim/plugins/indent.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								home/modules/console/editor/nvim/plugins/indent.nix
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										23
									
								
								home/modules/console/editor/nvim/plugins/lualine.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								home/modules/console/editor/nvim/plugins/lualine.nix
									
										
									
									
									
										Normal 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"]; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										60
									
								
								home/modules/console/editor/nvim/settings.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								home/modules/console/editor/nvim/settings.nix
									
										
									
									
									
										Normal 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}"; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										74
									
								
								theme.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								theme.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,74 @@ | ||||||
|  | 
 | ||||||
|  | { colorscheme }: { | ||||||
|  |   "${colorscheme.slug}" = { | ||||||
|  |     palette = builtins.mapAttrs (name: value: "#${value}") colorscheme.colors; # Add leading '#' | ||||||
|  |     "attributes" = "base09"; | ||||||
|  |     "comment" = { fg = "base03"; modifiers = [ "italic" ]; }; | ||||||
|  |     "constant" = "base09"; | ||||||
|  |     "constant.character.escape" = "base0C"; | ||||||
|  |     "constant.numeric" = "base09"; | ||||||
|  |     "constructor" = "base0D"; | ||||||
|  |     "debug" = "base03"; | ||||||
|  |     "diagnostic" = { modifiers = [ "underlined" ]; }; | ||||||
|  |     "diagnostic.error" = { underline = { style = "curl"; }; }; | ||||||
|  |     "diagnostic.hint" = { underline = { style = "curl"; }; }; | ||||||
|  |     "diagnostic.info" = { underline = { style = "curl"; }; }; | ||||||
|  |     "diagnostic.warning" = { underline = { style = "curl"; }; }; | ||||||
|  |     "diff.delta" = "base09"; | ||||||
|  |     "diff.minus" = "base08"; | ||||||
|  |     "diff.plus" = "base0B"; | ||||||
|  |     "error" = "base08"; | ||||||
|  |     "function" = "base0D"; | ||||||
|  |     "hint" = "base03"; | ||||||
|  |     "info" = "base0D"; | ||||||
|  |     "keyword" = "base0E"; | ||||||
|  |     "label" = "base0E"; | ||||||
|  |     "markup.bold" = { fg = "base0A"; modifiers = [ "bold" ]; }; | ||||||
|  |     "markup.heading" = "base0D"; | ||||||
|  |     "markup.italic" = { fg = "base0E"; modifiers = [ "italic" ]; }; | ||||||
|  |     "markup.link.text" = "base08"; | ||||||
|  |     "markup.link.url" = { fg = "base09"; modifiers = [ "underlined" ]; }; | ||||||
|  |     "markup.list" = "base08"; | ||||||
|  |     "markup.quote" = "base0C"; | ||||||
|  |     "markup.raw" = "base0B"; | ||||||
|  |     "markup.strikethrough" = { modifiers = [ "crossed_out" ]; }; | ||||||
|  |     "namespace" = "base0E"; | ||||||
|  |     "operator" = "base05"; | ||||||
|  |     "special" = "base0D"; | ||||||
|  |     "string" = "base0B"; | ||||||
|  |     "type" = "base0A"; | ||||||
|  |     "ui.background" = { bg = "base00"; }; | ||||||
|  |     "ui.bufferline" = { fg = "base04"; bg = "base00"; }; | ||||||
|  |     "ui.bufferline.active" = { fg = "base00"; bg = "base03"; modifiers = [ "bold" ]; }; | ||||||
|  |     "ui.cursor" = { fg = "base04"; modifiers = [ "reversed" ]; }; | ||||||
|  |     "ui.cursor.insert" = { fg = "base0A"; modifiers = [ "underlined" ]; }; | ||||||
|  |     "ui.cursor.match" = { fg = "base0A"; modifiers = [ "underlined" ]; }; | ||||||
|  |     "ui.cursor.select" = { fg = "base0A"; modifiers = [ "underlined" ]; }; | ||||||
|  |     "ui.cursorline.primary" = { fg = "base05"; bg = "base01"; }; | ||||||
|  |     "ui.gutter" = { bg = "base00"; }; | ||||||
|  |     "ui.help" = { fg = "base06"; bg = "base01"; }; | ||||||
|  |     "ui.linenr" = { fg = "base03"; bg = "base00"; }; | ||||||
|  |     "ui.linenr.selected" = { fg = "base04"; bg = "base01"; modifiers = [ "bold" ]; }; | ||||||
|  |     "ui.menu" = { fg = "base05"; bg = "base01"; }; | ||||||
|  |     "ui.menu.scroll" = { fg = "base03"; bg = "base01"; }; | ||||||
|  |     "ui.menu.selected" = { fg = "base01"; bg = "base04"; }; | ||||||
|  |     "ui.popup" = { bg = "base01"; }; | ||||||
|  |     "ui.selection" = { bg = "base02"; }; | ||||||
|  |     "ui.selection.primary" = { bg = "base02"; }; | ||||||
|  |     "ui.statusline" = { fg = "base0B"; bg = "base02"; }; | ||||||
|  |     "ui.statusline.inactive" = { bg = "base01"; fg = "base02"; }; | ||||||
|  |     "ui.statusline.insert" = { fg = "base00"; bg = "base0B"; }; | ||||||
|  |     "ui.statusline.normal" = { fg = "base00"; bg = "base04"; }; | ||||||
|  |     "ui.statusline.select" = { fg = "base00"; bg = "base0E"; }; | ||||||
|  |     "ui.text" = "base05"; | ||||||
|  |     "ui.text.focus" = "base05"; | ||||||
|  |     "ui.virtual.indent-guide" = { fg = "base03"; }; | ||||||
|  |     "ui.virtual.ruler" = { bg = "base01"; }; | ||||||
|  |     "ui.virtual.whitespace" = { fg = "base01"; }; | ||||||
|  |     "ui.window" = { bg = "base01"; }; | ||||||
|  |     "variable" = "base08"; | ||||||
|  |     "variable.other.member" = "base08"; | ||||||
|  |     "warning" = "base09"; | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue