diff --git a/home-manager/common/software/cli/nixvim-base.nix b/home-manager/common/software/cli/nixvim-base.nix index 59deeb15..ec3561b2 100644 --- a/home-manager/common/software/cli/nixvim-base.nix +++ b/home-manager/common/software/cli/nixvim-base.nix @@ -1,244 +1,244 @@ { inputs, pkgs, lib, theme, ... }: { - imports = [ - inputs.nixvim.homeManagerModules.nixvim - ] ++ lib.optional (builtins.isString theme) ../../../../stylix/${theme}/home-manager/nixvim.nix; + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ] ++ lib.optional (builtins.isString theme) ../../../../stylix/${theme}/home-manager/nixvim.nix; - # https://github.com/nix-community/nixvim + # https://github.com/nix-community/nixvim - # Docs: - # https://nix-community.github.io/nixvim/ - programs.nixvim = { - enable = true; - viAlias = true; - vimAlias = true; + # Docs: + # https://nix-community.github.io/nixvim/ + programs.nixvim = { + enable = true; + viAlias = true; + vimAlias = true; - globals.mapleader = " "; - globals.maplocalleader = " "; + globals.mapleader = " "; + globals.maplocalleader = " "; - options = { - number = true; - shiftwidth = 2; - breakindent = true; - colorcolumn = "100"; - showmode = false; - termguicolors = true; - }; - - keymaps = let - map = mode: key: action: { mode = mode; key = key; action = action; }; - nmap = key: action: map [ "n" ] key action; - nvmap = key: action: map [ "n" "v" ] key action; - imap = key: action: map [ "i" ] key action; - desc = d: { options.desc = d; }; - silent = { options.silent = true; }; - expr = { options.expr = true; }; - in [ - # Unmap keys that aren't useful, or that we want to use for different things - (nvmap "" "" // silent) - (nvmap "" "" // silent) - (nvmap "s" "" // silent) - # Redo - (nmap "R" "") - # Copy and paste - (nvmap "y" "\"+y" // desc "Cop[y] to clipboard") - (nvmap "p" "\"+p" // desc "[P]aste from clipboard") - # Jump to start/end of line - (nvmap "H" "0") - (nvmap "L" "$") - # Navigate up and down word wrapped text as if it were not word wrapped - (nmap "k" "v:count == 0 ? 'gk' : 'k'" // silent // expr) - (nmap "j" "v:count == 0 ? 'gj' : 'j'" // silent // expr) - # Center cursor when jumping foward or back - (nmap "" "zz") - (nmap "" "zz") - - # Insert Mode - - # Normal Mode - # NVimTree - (nmap "n" "" // desc "[N]vimTree") - (nmap "nf" ":NvimTreeFocus" // desc "[F]ocus NvimTree") - (nmap "nt" ":NvimTreeToggle" // desc "[T]oggle NvimTree") - (nmap "ns" ":NvimTreeFindFile" // desc "[S]earch NvimTree") - (nmap "nc" ":NvimTreeClose" // desc "[C]lose NvimTree") - # ToggleTerm - (nmap "TT" ":ToggleTerm" // desc "[T]oggle Terminal") - # Fugitive - (nmap "gc" ":Git commit -a" // desc "[C]ommit" ) - (nmap "gp" ":Git push" // desc "Git [p]ush") - (nmap "gP" ":Git pull" // desc "[P]ull") - # Trouble - (nmap "tt" ":TroubleToggle" // desc "[T]oggle") - (nmap "tc" ":TroubleClose" // desc "[C]lose") - - # Window Management - (nmap "wh" ":wincmd h" // desc "Move left") - (nmap "wl" ":wincmd l" // desc "Move right") - (nmap "wj" ":wincmd j" // desc "Move down") - (nmap "wk" ":wincmd k" // desc "Move up") - (nmap "wn" ":wincmd w" // desc "Move to next") - (nmap "wN" ":wincmd p" // desc "Move to previous") - (nmap "wc" ":wincmd c" // desc "[C]lose active window") - (nmap "woh" ":wincmd n" // desc "Open [H]orizontal window") - (nmap "wov" ":wincmd v" // desc "Open [V]ertical window") - # resize window - (nmap "wrh" ":resize " // desc "Resize Horizontal") - (nmap "wrv" ":vertical resize " // desc "Resize Vertical") - # Buffer Management - (nmap "bn" ":bnext" // desc "Next buffer") - (nmap "bN" ":bNext" // desc "Previous buffer") - (nmap "bc" ":bdelete" // desc "[c]lose buffer") - ]; - - plugins = { - # auto bracket completion - nvim-autopairs.enable = true; - # Parser generator tool - treesitter.enable = true; - # Snippet engine for neovim - luasnip.enable = true; - # winbar that uses nvim-navic in order to get LSP context from your language server. - barbecue.enable = true; - # Nix language syntax highlighting / file type associations - nix.enable = true; - # Run nix develop / shell without exiting vim - nix-develop.enable = true; - # tab bar like Firefox or Chrome - bufferline.enable = true; - # Automatic indent - intellitab.enable = true; - # Highlight all entries of the currently selected word - illuminate.enable = true; - # sidebar file browser - nvim-tree.enable = true; - # Gutter information for git modifications - gitsigns.enable = true; - # Terminal in vim - toggleterm.enable = true; - # Rainbow matching {} [] () 's - rainbow-delimiters.enable = true; - # Colorize hex colors inline - nvim-colorizer.enable = true; - # git plugin for vim - fugitive.enable = true; - # Alerts / CodActions - trouble.enable = true; - - # Popup to show shortcuts - which-key = { - enable = true; - registrations = { - "b" = "Manage buffers..."; - "c" = "Colorscheme..."; - "g" = "Git Options..."; - "l" = "LSP Options..."; - "n" = "NvimTree..."; - "t" = "Trouble..."; - "T" = "ToggleTerm..."; - "w" = "Manage Windows..."; - "wo" = "Open New..."; - "wr" = "Resize..."; - }; - }; - - # Airline / Powerline alternative - lualine = { - enable = true; - componentSeparators = { - left = "«"; - right = "»"; - }; - }; - - telescope = { - enable = true; - extensions.fzf-native.enable = true; - keymaps = { - "" = { - action = "find_files"; - desc = "Search files by name"; - }; - "s" = { - action = "live_grep"; - desc = "Search by live grep"; - }; - "bl" = { - action = "buffers"; - desc = "[L]list open [B]uffers"; - }; - "h" = { - action = "help_tags"; - desc = "Search [H]elp"; - }; - "W" = { - action = "grep_string"; - desc = "Search for [W]ord under cursor"; - }; - "gs" = { - action = "git_status"; - desc = "Search [G]it [S]tatus"; - }; - "gl" = { - action = "git_commits"; - desc = "View [G]it [L]ogs"; - }; - "r" = { - action = "oldfiles"; - desc = "Search [R]ecently opened files by name"; - }; - "cs" = { - action = "colorscheme"; - desc = "Change [C]olor[s]cheme"; - }; - }; - }; - - nvim-cmp = { - enable = true; - autoEnableSources = true; - mapping = { - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.confirm({ select = true })"; - "" = { - action = "cmp.mapping.select_prev_item()"; - modes = [ - "i" - "s" - ]; - }; - "" = { - action = "cmp.mapping.select_next_item()"; - modes = [ - "i" - "s" - ]; - }; - }; - sources = [ - { name = "nvim_lua"; } - { name = "nvim_lsp"; } - { name = "path"; } - { name = "buffer"; } - ]; - }; - }; - - colorschemes = { - tokyonight.enable = true; - gruvbox.enable = true; - catppuccin.enable = true; - dracula.enable = true; - oxocarbon.enable = true; - - }; - extraPlugins = with pkgs.vimPlugins; [ - everforest - onehalf - rose-pine - melange-nvim - ]; + options = { + number = true; + shiftwidth = 2; + breakindent = true; + # colorcolumn = "100"; + showmode = false; }; + + keymaps = let + map = mode: key: action: { mode = mode; key = key; action = action; }; + nmap = key: action: map [ "n" ] key action; + nvmap = key: action: map [ "n" "v" ] key action; + imap = key: action: map [ "i" ] key action; + desc = d: { options.desc = d; }; + silent = { options.silent = true; }; + expr = { options.expr = true; }; + in [ + # Unmap keys that aren't useful, or that we want to use for different things + (nvmap "" "" // silent) + (nvmap "" "" // silent) + (nvmap "s" "" // silent) + # Redo + (nmap "R" "") + # Copy and paste + (nvmap "y" "\"+y" // desc "Cop[y] to clipboard") + (nvmap "p" "\"+p" // desc "[P]aste from clipboard") + # Jump to start/end of line + (nvmap "H" "0") + (nvmap "L" "$") + # Navigate up and down word wrapped text as if it were not word wrapped + (nmap "k" "v:count == 0 ? 'gk' : 'k'" // silent // expr) + (nmap "j" "v:count == 0 ? 'gj' : 'j'" // silent // expr) + # Center cursor when jumping foward or back + (nmap "" "zz") + (nmap "" "zz") + # Insert Mode + + # Normal Mode + # NVimTree + (nmap "n" "" // desc "[N]vimTree") + (nmap "nf" ":NvimTreeFocus" // desc "[F]ocus NvimTree") + (nmap "nt" ":NvimTreeToggle" // desc "[T]oggle NvimTree") + (nmap "ns" ":NvimTreeFindFile" // desc "[S]earch NvimTree") + (nmap "nc" ":NvimTreeClose" // desc "[C]lose NvimTree") + # ToggleTerm + (nmap "TT" ":ToggleTerm" // desc "[T]oggle Terminal") + # Fugitive + (nmap "gc" ":Git commit -a" // desc "[C]ommit" ) + (nmap "gp" ":Git push" // desc "Git [p]ush") + (nmap "gP" ":Git pull" // desc "[P]ull") + # Trouble + (nmap "tt" ":TroubleToggle" // desc "[T]oggle") + (nmap "tc" ":TroubleClose" // desc "[C]lose") + + # Window Management + (nmap "wh" ":wincmd h" // desc "Move left") + (nmap "wl" ":wincmd l" // desc "Move right") + (nmap "wj" ":wincmd j" // desc "Move down") + (nmap "wk" ":wincmd k" // desc "Move up") + (nmap "wn" ":wincmd w" // desc "Move to next") + (nmap "wN" ":wincmd p" // desc "Move to previous") + (nmap "wc" ":wincmd c" // desc "[C]lose active window") + (nmap "woh" ":wincmd n" // desc "Open [H]orizontal window") + (nmap "wov" ":wincmd v" // desc "Open [V]ertical window") + # resize window + (nmap "wrh" ":resize " // desc "Resize Horizontal") + (nmap "wrv" ":vertical resize " // desc "Resize Vertical") + # Buffer Management + (nmap "bn" ":bnext" // desc "Next buffer") + (nmap "bN" ":bNext" // desc "Previous buffer") + (nmap "bc" ":bdelete" // desc "[c]lose buffer") + ]; + + plugins = { + # auto bracket completion + nvim-autopairs.enable = true; + # Parser generator tool + treesitter.enable = true; + # Snippet engine for neovim + luasnip.enable = true; + # winbar that uses nvim-navic in order to get LSP context from your language server. + barbecue.enable = true; + # Nix language syntax highlighting / file type associations + nix.enable = true; + # Run nix develop / shell without exiting vim + nix-develop.enable = true; + # tab bar like Firefox or Chrome + bufferline.enable = true; + # Automatic indent + intellitab.enable = true; + # Highlight all entries of the currently selected word + illuminate.enable = true; + # sidebar file browser + nvim-tree.enable = true; + # Gutter information for git modifications + gitsigns.enable = true; + # Terminal in vim + toggleterm.enable = true; + # Rainbow matching {} [] () 's + rainbow-delimiters.enable = true; + # Colorize hex colors inline + nvim-colorizer.enable = true; + # git plugin for vim + fugitive.enable = true; + # Alerts / CodActions + trouble.enable = true; + # Indentation guides + indent-blankline.enable = true; + + # Popup to show shortcuts + which-key = { + enable = true; + registrations = { + "b" = "Manage buffers..."; + "c" = "Colorscheme..."; + "g" = "Git Options..."; + "l" = "LSP Options..."; + "n" = "NvimTree..."; + "t" = "Trouble..."; + "T" = "ToggleTerm..."; + "w" = "Manage Windows..."; + "wo" = "Open New..."; + "wr" = "Resize..."; + }; + }; + + # Airline / Powerline alternative + lualine = { + enable = true; + componentSeparators = { + left = "«"; + right = "»"; + }; + }; + + telescope = { + enable = true; + extensions.fzf-native.enable = true; + keymaps = { + "" = { + action = "find_files"; + desc = "Search files by name"; + }; + "s" = { + action = "live_grep"; + desc = "Search by live grep"; + }; + "bl" = { + action = "buffers"; + desc = "[L]list open [B]uffers"; + }; + "h" = { + action = "help_tags"; + desc = "Search [H]elp"; + }; + "W" = { + action = "grep_string"; + desc = "Search for [W]ord under cursor"; + }; + "gs" = { + action = "git_status"; + desc = "Search [G]it [S]tatus"; + }; + "gl" = { + action = "git_commits"; + desc = "View [G]it [L]ogs"; + }; + "r" = { + action = "oldfiles"; + desc = "Search [R]ecently opened files by name"; + }; + "cs" = { + action = "colorscheme"; + desc = "Change [C]olor[s]cheme"; + }; + }; + }; + + nvim-cmp = { + enable = true; + autoEnableSources = true; + mapping = { + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = { + action = "cmp.mapping.select_prev_item()"; + modes = [ + "i" + "s" + ]; + }; + "" = { + action = "cmp.mapping.select_next_item()"; + modes = [ + "i" + "s" + ]; + }; + }; + sources = [ + { name = "nvim_lua"; } + { name = "nvim_lsp"; } + { name = "path"; } + { name = "buffer"; } + ]; + }; + }; + + colorschemes = { + tokyonight.enable = true; + gruvbox.enable = true; + catppuccin.enable = true; + dracula.enable = true; + oxocarbon.enable = true; + + }; + extraPlugins = with pkgs.vimPlugins; [ + everforest + onehalf + rose-pine + melange-nvim + ]; + }; } diff --git a/home-manager/common/software/cli/starship.nix b/home-manager/common/software/cli/starship.nix index 9037491f..313f849d 100644 --- a/home-manager/common/software/cli/starship.nix +++ b/home-manager/common/software/cli/starship.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, stylix, ... }: +{ config, lib, ... }: let orangeColor = "#${config.lib.stylix.colors.base0C}"; yellowColor = "#${config.lib.stylix.colors.base0A}"; @@ -99,4 +99,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/shell.nix b/shell.nix index d3bc858f..1523d1eb 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ pkgs, sops-nix, deploy-rs, system, ... }: { +{ pkgs, sops-nix, ... }: { default = pkgs.mkShell { NIX_CONFIG = "experimental-features = nix-command flakes"; # imports all files ending in .asc/.gpg @@ -9,14 +9,11 @@ nativeBuildInputs = [ pkgs.nix - # pkgs.home-manager pkgs.git pkgs.vim - # pkgs.alejandra - # pkgs.nixfmt + pkgs.nixfmt pkgs.ssh-to-pgp (pkgs.callPackage sops-nix {}).sops-import-keys-hook - # deploy-rs.packages.${system}.deploy-rs ]; }; -} \ No newline at end of file +} diff --git a/stylix/green/home-manager/nixvim.nix b/stylix/green/home-manager/nixvim.nix index 009e3da1..8b4c069c 100644 --- a/stylix/green/home-manager/nixvim.nix +++ b/stylix/green/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "everforest"; -} \ No newline at end of file + programs.nixvim.colorscheme = lib.mkForce "everforest"; + stylix.targets.nixvim.enable = false; +} diff --git a/stylix/gruvbox/home-manager/nixvim.nix b/stylix/gruvbox/home-manager/nixvim.nix index 95635c83..f62fe493 100644 --- a/stylix/gruvbox/home-manager/nixvim.nix +++ b/stylix/gruvbox/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "gruvbox"; -} \ No newline at end of file + programs.nixvim.colorscheme = lib.mkForce "gruvbox"; + stylix.targets.nixvim.enable = false; +} diff --git a/stylix/sakura-day/home-manager/nixvim.nix b/stylix/sakura-day/home-manager/nixvim.nix index 78ac8a37..aebe2a23 100644 --- a/stylix/sakura-day/home-manager/nixvim.nix +++ b/stylix/sakura-day/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "rose-pine-dawn"; + programs.nixvim.colorscheme = lib.mkForce "rose-pine-dawn"; + stylix.targets.nixvim.enable = false; } diff --git a/stylix/sakura-night/home-manager/nixvim.nix b/stylix/sakura-night/home-manager/nixvim.nix index dd806348..37245b1c 100644 --- a/stylix/sakura-night/home-manager/nixvim.nix +++ b/stylix/sakura-night/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "rose-pine-moon"; + programs.nixvim.colorscheme = lib.mkForce "rose-pine-moon"; + stylix.targets.nixvim.enable = false; } diff --git a/stylix/stylix/default.nix b/stylix/stylix/default.nix index 694cc02a..73af4233 100644 --- a/stylix/stylix/default.nix +++ b/stylix/stylix/default.nix @@ -1,4 +1,4 @@ -{lib, inputs, pkgs, gpu, system, theme, ...}: { +{pkgs, ...}: { # Themes https://github.com/tinted-theming/base16-schemes stylix = { image = /etc/nixos/git/docs/icons/nixos/white.png; @@ -6,4 +6,4 @@ base16Scheme = "${pkgs.base16-schemes}/share/themes/atelier-cave.yaml"; autoEnable = true; }; -} \ No newline at end of file +} diff --git a/stylix/stylix/home-manager/nixvim.nix b/stylix/stylix/home-manager/nixvim.nix index 478dada1..f7e20acc 100644 --- a/stylix/stylix/home-manager/nixvim.nix +++ b/stylix/stylix/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "tokyonight-storm"; + programs.nixvim.colorscheme = lib.mkForce "tokyonight"; + stylix.targets.nixvim.enable = false; } diff --git a/stylix/tokyo-day/home-manager/nixvim.nix b/stylix/tokyo-day/home-manager/nixvim.nix index 1b946f9e..9287c8bf 100644 --- a/stylix/tokyo-day/home-manager/nixvim.nix +++ b/stylix/tokyo-day/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "tokyonight-day"; -} \ No newline at end of file + programs.nixvim.colorscheme = lib.mkForce "tokyonight-day"; + stylix.targets.nixvim.enable = false; +} diff --git a/stylix/tokyo-night/home-manager/nixvim.nix b/stylix/tokyo-night/home-manager/nixvim.nix index dc1b3311..a9fa3b3a 100644 --- a/stylix/tokyo-night/home-manager/nixvim.nix +++ b/stylix/tokyo-night/home-manager/nixvim.nix @@ -1,3 +1,4 @@ { lib, ... }: { - programs.nixvim.colorscheme = lib.mkForce "tokyonight-night"; -} \ No newline at end of file + programs.nixvim.colorscheme = lib.mkForce "tokyonight-night"; + stylix.targets.nixvim.enable = false; +}