From cf48beb8e6ef51930c64fc1b9a0a9dbcfbe9d0fc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 18:26:38 +0300 Subject: [PATCH] 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 72c9a1a..8ad7336 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 70485be..cdcadc8 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 0000000..b11d2cd --- /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 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 ]; }