diff --git a/configuration.nix b/configuration.nix index 250fafd..515b715 100644 --- a/configuration.nix +++ b/configuration.nix @@ -185,6 +185,7 @@ inputs: let }; vim.ui = { + borders.enable = true; noice.enable = true; colorizer.enable = true; modes-nvim.enable = false; # the theme looks terrible with catppuccin diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index 52e8972..e7ab3ac 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -193,12 +193,14 @@ in { local cmp = require'cmp' cmp.setup({ + ${optionalString (config.vim.ui.borders.enable) '' + -- explicitly enabled by setting ui.borders.enable = true + -- TODO: try to get nvim-cmp to follow global border style window = { - -- TODO: at some point, those need to be optional - -- but first nvim cmp module needs to be detached from "cfg.autocomplete" completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, + ''} snippet = { expand = function(args) diff --git a/modules/lsp/lsp-signature/config.nix b/modules/lsp/lsp-signature/config.nix index 738dcb5..1e73476 100644 --- a/modules/lsp/lsp-signature/config.nix +++ b/modules/lsp/lsp-signature/config.nix @@ -14,7 +14,14 @@ in { vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere '' -- Enable lsp signature viewer - require("lsp_signature").setup() + require("lsp_signature").setup({ + ${optionalString (config.vim.ui.borders.plugins.lsp-signature.enable) '' + bind = true, -- This is mandatory, otherwise border config won't get registered. + handler_opts = { + border = "${config.vim.ui.borders.plugins.lsp-signature.style}" + } + ''} + }) ''; }; } diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index 70485be..e9d7b3c 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -16,6 +16,13 @@ in { vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' local lspconfig = require('lspconfig') + + ${ + # TODO: make border style configurable + optionalString (config.vim.ui.borders.enable) '' + require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' + '' + } ''; } { diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 3b7ea26..74b91fc 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -39,7 +39,11 @@ in { vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere '' -- Enable lspsaga local saga = require 'lspsaga' - saga.init_lsp_saga() + saga.init_lsp_saga({ + ${optionalString (config.vim.ui.borders.plugins.lspsaga.enable) '' + border_style = '${config.vim.ui.borders.plugins.lspsaga.style}', + ''} + }) ''; }; } diff --git a/modules/minimap/codewindow/config.nix b/modules/minimap/codewindow/config.nix index 1025e63..ac82829 100644 --- a/modules/minimap/codewindow/config.nix +++ b/modules/minimap/codewindow/config.nix @@ -27,7 +27,7 @@ in { vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere '' local codewindow = require('codewindow') codewindow.setup({ - exclude_filetypes = { 'NvimTree', 'orgagenda'}, + exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, }) ''; }; diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix new file mode 100644 index 0000000..179de44 --- /dev/null +++ b/modules/ui/borders/borders.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkOption mkEnableOption types; + + cfg = config.vim.ui.borders; + + defaultStyles = ["none" "single" "double" "rounded"]; +in { + options.vim.ui.borders = { + enable = mkEnableOption "visible borders for most windows"; + + globalStyle = mkOption { + type = types.enum defaultStyles; + default = "rounded"; + description = '' + global border style to use + ''; + }; + + # TODO: make per-plugin borders configurable + plugins = let + mkPluginStyleOption = name: { + enable = mkEnableOption "whether to enable borders for the ${name} plugin" // {default = cfg.enable;}; + + style = mkOption { + type = types.enum (defaultStyles ++ lib.optionals (name != "which-key") ["shadow"]); + default = cfg.globalStyle; + description = "border style to use for the ${name} plugin"; + }; + }; + in { + # despite not having it listed in example configuration, which-key does support the rounded type + # additionall, it supports a "shadow" type that is similar to none but is of higher contrast + which-key = mkPluginStyleOption "which-key"; + lspsaga = mkPluginStyleOption "lspsaga"; + nvim-cmp = mkPluginStyleOption "nvim-cmp"; + lsp-signature = mkPluginStyleOption "lsp-signature"; + }; + }; +} diff --git a/modules/ui/borders/default.nix b/modules/ui/borders/default.nix new file mode 100644 index 0000000..526ac4e --- /dev/null +++ b/modules/ui/borders/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./borders.nix + ]; +} diff --git a/modules/ui/default.nix b/modules/ui/default.nix index 980a04a..757dd46 100644 --- a/modules/ui/default.nix +++ b/modules/ui/default.nix @@ -6,5 +6,6 @@ _: { ./smartcolumn ./colorizer ./illuminate + ./borders ]; } diff --git a/modules/ui/noice/config.nix b/modules/ui/noice/config.nix index 705256b..d12ebf0 100644 --- a/modules/ui/noice/config.nix +++ b/modules/ui/noice/config.nix @@ -32,7 +32,7 @@ in { command_palette = true, -- position the cmdline and popupmenu together long_message_to_split = true, -- long messages will be sent to a split inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help + lsp_doc_border = ${boolToString (config.vim.ui.borders.enable)}, -- add a border to hover docs and signature help }, format = { diff --git a/modules/utility/binds/which-key/config.nix b/modules/utility/binds/which-key/config.nix index a5c1569..8b0fa6c 100644 --- a/modules/utility/binds/which-key/config.nix +++ b/modules/utility/binds/which-key/config.nix @@ -18,7 +18,13 @@ in { [""] = "SPACE", [""] = "RETURN", [""] = "TAB", - } + }, + + ${lib.optionalString (config.vim.ui.borders.plugins.which-key.enable) '' + window = { + border = "${config.vim.ui.borders.plugins.which-key.style}", + }, + ''} }) wk.register({