mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-12 22:05:58 +01:00
Merge pull request #105 from NotAShelf/feature/window-borders
This commit is contained in:
commit
b95687940d
11 changed files with 83 additions and 7 deletions
|
@ -185,6 +185,7 @@ inputs: let
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.ui = {
|
vim.ui = {
|
||||||
|
borders.enable = true;
|
||||||
noice.enable = true;
|
noice.enable = true;
|
||||||
colorizer.enable = true;
|
colorizer.enable = true;
|
||||||
modes-nvim.enable = false; # the theme looks terrible with catppuccin
|
modes-nvim.enable = false; # the theme looks terrible with catppuccin
|
||||||
|
|
|
@ -193,12 +193,14 @@ in {
|
||||||
|
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
cmp.setup({
|
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 = {
|
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(),
|
completion = cmp.config.window.bordered(),
|
||||||
documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
},
|
},
|
||||||
|
''}
|
||||||
|
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
|
|
|
@ -14,7 +14,14 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere ''
|
||||||
-- Enable lsp signature viewer
|
-- 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}"
|
||||||
|
}
|
||||||
|
''}
|
||||||
|
})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,13 @@ in {
|
||||||
|
|
||||||
vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] ''
|
vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] ''
|
||||||
local lspconfig = require('lspconfig')
|
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}'
|
||||||
|
''
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,11 @@ in {
|
||||||
vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere ''
|
||||||
-- Enable lspsaga
|
-- Enable lspsaga
|
||||||
local saga = require '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}',
|
||||||
|
''}
|
||||||
|
})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ in {
|
||||||
vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere ''
|
||||||
local codewindow = require('codewindow')
|
local codewindow = require('codewindow')
|
||||||
codewindow.setup({
|
codewindow.setup({
|
||||||
exclude_filetypes = { 'NvimTree', 'orgagenda'},
|
exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'},
|
||||||
})
|
})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
43
modules/ui/borders/borders.nix
Normal file
43
modules/ui/borders/borders.nix
Normal file
|
@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
5
modules/ui/borders/default.nix
Normal file
5
modules/ui/borders/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./borders.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -6,5 +6,6 @@ _: {
|
||||||
./smartcolumn
|
./smartcolumn
|
||||||
./colorizer
|
./colorizer
|
||||||
./illuminate
|
./illuminate
|
||||||
|
./borders
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ in {
|
||||||
command_palette = true, -- position the cmdline and popupmenu together
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
long_message_to_split = true, -- long messages will be sent to a split
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
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 = {
|
format = {
|
||||||
|
|
|
@ -18,7 +18,13 @@ in {
|
||||||
["<leader>"] = "SPACE",
|
["<leader>"] = "SPACE",
|
||||||
["<cr>"] = "RETURN",
|
["<cr>"] = "RETURN",
|
||||||
["<tab>"] = "TAB",
|
["<tab>"] = "TAB",
|
||||||
}
|
},
|
||||||
|
|
||||||
|
${lib.optionalString (config.vim.ui.borders.plugins.which-key.enable) ''
|
||||||
|
window = {
|
||||||
|
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
||||||
|
},
|
||||||
|
''}
|
||||||
})
|
})
|
||||||
|
|
||||||
wk.register({
|
wk.register({
|
||||||
|
|
Loading…
Reference in a new issue