diff --git a/modules/hm/programs/editors/neovim.nix b/modules/hm/programs/editors/neovim.nix index 3b78413..dfb6e2d 100644 --- a/modules/hm/programs/editors/neovim.nix +++ b/modules/hm/programs/editors/neovim.nix @@ -4,225 +4,230 @@ pkgs, osConfig, ... -}: { +}: let + styleCfg = osConfig.local.style; +in { imports = [inputs.nvf.homeManagerModules.default]; config = lib.mkIf osConfig.local.profiles.desktop.enable { programs.nvf = { enable = true; - settings.vim = { - viAlias = true; - vimAlias = true; - enableLuaLoader = true; - preventJunkFiles = true; - useSystemClipboard = true; - options = { - tabstop = 4; - autoindent = false; - }; + settings.vim = lib.mkMerge [ + { + viAlias = true; + vimAlias = true; + enableLuaLoader = true; + preventJunkFiles = true; + useSystemClipboard = true; + options = { + tabstop = 4; + autoindent = false; + }; - luaConfigPost = '' - vim.opt.formatoptions:remove('c') - vim.opt.formatoptions:remove('r') - vim.opt.formatoptions:remove('o') - ''; + luaConfigPost = '' + vim.opt.formatoptions:remove('c') + vim.opt.formatoptions:remove('r') + vim.opt.formatoptions:remove('o') + ''; - maps = { - normal = { - "m" = { - silent = true; - action = "make"; - }; # Same as nnoremap m make - "t" = { - silent = true; - action = "Neotree toggle"; + maps = { + normal = { + "m" = { + silent = true; + action = "make"; + }; # Same as nnoremap m make + "t" = { + silent = true; + action = "Neotree toggle"; + }; }; }; - }; - theme = lib.mkDefault { - enable = true; - name = "catppuccin"; - style = "macchiato"; - }; + ui = { + noice.enable = true; + }; + notify.nvim-notify.enable = true; - ui = { - noice.enable = true; - }; - notify.nvim-notify.enable = true; + statusline = { + lualine = { + enable = true; + theme = "auto"; + componentSeparator = { + left = ""; + }; + sectionSeparator = { + left = ""; + right = ""; + }; - statusline = { - lualine = { + activeSection = { + a = [ + '' + { + "mode", + separator = { right = "" }, + right_padding = 2 + } + '' + ]; + b = [ + '' + { + "branch", + icon = '', + separator = { right = "" } + } + '' + ]; + c = [ + '' + "filename" + '' + ]; + x = [ + '' + { + "diagnostics", + sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp', 'coc'}, + symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '}, + colored = true, + update_in_insert = false, + always_visible = false, + diagnostics_color = { + color_error = { fg = 'red' }, + color_warn = { fg = 'yellow' }, + color_info = { fg = 'cyan' }, + }, + } + '' + '' + "filetype" + '' + ]; + y = [ + '' + { + "progress", + separator = { left = "" }, + } + '' + '' + '' + ]; + z = [ + '' + { + "location", + separator = { left = "" }, + left_padding = 2 + } + '' + '' + { + "fileformat", + color = {fg='black'}, + symbols = { + unix = '', -- e712 + dos = '', -- e70f + mac = '', -- e711 + }, + } + '' + ]; + }; + + inactiveSection = { + a = [ + '' + "filename" + '' + ]; + z = [ + '' + "location" + '' + ]; + }; + }; + }; + + git.enable = true; + + utility = { + vim-wakatime.enable = true; + surround.enable = true; + motion.leap = { + enable = true; + }; + }; + + lsp = { enable = true; - theme = "auto"; - componentSeparator = { - left = ""; - }; - sectionSeparator = { - left = ""; - right = ""; - }; - - activeSection = { - a = [ - '' - { - "mode", - separator = { right = "" }, - right_padding = 2 - } - '' - ]; - b = [ - '' - { - "branch", - icon = '', - separator = { right = "" } - } - '' - ]; - c = [ - '' - "filename" - '' - ]; - x = [ - '' - { - "diagnostics", - sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp', 'coc'}, - symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '}, - colored = true, - update_in_insert = false, - always_visible = false, - diagnostics_color = { - color_error = { fg = 'red' }, - color_warn = { fg = 'yellow' }, - color_info = { fg = 'cyan' }, - }, - } - '' - '' - "filetype" - '' - ]; - y = [ - '' - { - "progress", - separator = { left = "" }, - } - '' - '' - '' - ]; - z = [ - '' - { - "location", - separator = { left = "" }, - left_padding = 2 - } - '' - '' - { - "fileformat", - color = {fg='black'}, - symbols = { - unix = '', -- e712 - dos = '', -- e70f - mac = '', -- e711 - }, - } - '' - ]; - }; - - inactiveSection = { - a = [ - '' - "filename" - '' - ]; - z = [ - '' - "location" - '' - ]; + lspSignature.enable = true; + lspconfig.enable = true; + formatOnSave = true; + mappings = { + addWorkspaceFolder = "wa"; + codeAction = "a"; + goToDeclaration = "gD"; + goToDefinition = "gd"; + hover = "K"; + listImplementations = "gi"; + listReferences = "gr"; + listWorkspaceFolders = "wl"; + nextDiagnostic = "k"; + previousDiagnostic = "j"; + openDiagnosticFloat = "e"; + removeWorkspaceFolder = "wr"; + renameSymbol = "r"; + signatureHelp = ""; }; }; - }; - git.enable = true; - - utility = { - vim-wakatime.enable = true; - surround.enable = true; - motion.leap = { + autocomplete.nvim-cmp = { enable = true; }; - }; - lsp = { - enable = true; - lspSignature.enable = true; - lspconfig.enable = true; - formatOnSave = true; - mappings = { - addWorkspaceFolder = "wa"; - codeAction = "a"; - goToDeclaration = "gD"; - goToDefinition = "gd"; - hover = "K"; - listImplementations = "gi"; - listReferences = "gr"; - listWorkspaceFolders = "wl"; - nextDiagnostic = "k"; - previousDiagnostic = "j"; - openDiagnosticFloat = "e"; - removeWorkspaceFolder = "wr"; - renameSymbol = "r"; - signatureHelp = ""; + autopairs.nvim-autopairs.enable = true; + + languages = { + enableExtraDiagnostics = true; + enableFormat = true; + enableLSP = true; + enableTreesitter = true; + + nix.enable = true; + clang.enable = true; + python.enable = true; + ts.enable = true; + css.enable = true; + typst.enable = true; }; - }; - autocomplete.nvim-cmp = { - enable = true; - }; + treesitter = { + enable = true; + fold = true; + context.enable = true; + grammars = [ + pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix + pkgs.vimPlugins.nvim-treesitter.builtGrammars.c + pkgs.vimPlugins.nvim-treesitter.builtGrammars.python + ]; + }; - autopairs.nvim-autopairs.enable = true; + binds.whichKey.enable = true; + filetree.neo-tree.enable = true; - languages = { - enableExtraDiagnostics = true; - enableFormat = true; - enableLSP = true; - enableTreesitter = true; - - nix.enable = true; - clang.enable = true; - python.enable = true; - ts.enable = true; - css.enable = true; - typst.enable = true; - }; - - treesitter = { - enable = true; - fold = true; - context.enable = true; - grammars = [ - pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix - pkgs.vimPlugins.nvim-treesitter.builtGrammars.c - pkgs.vimPlugins.nvim-treesitter.builtGrammars.python - ]; - }; - - binds.whichKey.enable = true; - filetree.neo-tree.enable = true; - - telescope.enable = true; - }; + telescope.enable = true; + } + (lib.mkIf styleCfg.enable { + theme = { + enable = true; + name = "base16"; + base16-colors = styleCfg.scheme.palette; + }; + }) + ]; }; programs.neovide = { diff --git a/modules/nix/style/modules/nvf.nix b/modules/nix/style/modules/nvf.nix deleted file mode 100644 index 93be707..0000000 --- a/modules/nix/style/modules/nvf.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - ... -}: let - cfg = config.local.style; -in { - config.home-manager.sharedModules = lib.mkIf cfg.enable [ - { - programs.nvf.settings.vim.theme = { - enable = true; - name = "base16"; - base16-colors = cfg.scheme.palette; - }; - } - ]; -}