From cf48beb8e6ef51930c64fc1b9a0a9dbcfbe9d0fc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 18:26:38 +0300 Subject: [PATCH 1/2] feat: make visible borders optional --- modules/completion/nvim-cmp/config.nix | 5 +++-- modules/lsp/lspconfig/config.nix | 5 +++++ modules/ui/borders/borders.nix | 9 +++++++++ modules/ui/borders/default.nix | 5 +++++ modules/ui/default.nix | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 modules/ui/borders/borders.nix create mode 100644 modules/ui/borders/default.nix diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index 72c9a1ae..8ad73367 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -200,12 +200,13 @@ in { local cmp = require'cmp' cmp.setup({ + ${optionalString (config.vim.ui.borders.enable) '' + -- explicitly enabled by setting ui.borders.enable = true 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/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index 70485be6..cdcadc84 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -16,6 +16,11 @@ 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 = 'single'" + } ''; } { diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix new file mode 100644 index 00000000..b11d2cdd --- /dev/null +++ b/modules/ui/borders/borders.nix @@ -0,0 +1,9 @@ +{lib, ...}: let + inherit (lib) mkEnableOption mkOption; +in { + options.vim.ui.borders = { + enable = mkEnableOption "visible borders for most windows"; + + # TODO: make per-plugin borders configurable + }; +} diff --git a/modules/ui/borders/default.nix b/modules/ui/borders/default.nix new file mode 100644 index 00000000..526ac4e5 --- /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 980a04ab..757dd469 100644 --- a/modules/ui/default.nix +++ b/modules/ui/default.nix @@ -6,5 +6,6 @@ _: { ./smartcolumn ./colorizer ./illuminate + ./borders ]; } From d461cd903beaf5a571af21a7d0986eee7b09532e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 22:36:19 +0300 Subject: [PATCH 2/2] feat: add borders to lspsaga windows --- modules/lsp/lspsaga/config.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 3b7ea26a..8f84f1dc 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -39,7 +39,9 @@ in { vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere '' -- Enable lspsaga local saga = require 'lspsaga' - saga.init_lsp_saga() + saga.init_lsp_saga({ + border_style = 'single', + }) ''; }; }