This commit is contained in:
2025-02-06 17:45:39 +02:00
commit a3f3abb460
84 changed files with 5567 additions and 0 deletions

207
config/ui/alpha.nix Normal file
View File

@ -0,0 +1,207 @@
{
lib,
config,
...
}: {
options = {
alpha.enable = lib.mkEnableOption "Enable alpha module";
};
config = lib.mkIf config.alpha.enable {
plugins.alpha = {
enable = true;
theme = null;
layout = let
padding = val: {
type = "padding";
inherit val;
};
in [
(padding 4)
{
opts = {
hl = "AlphaHeader";
position = "center";
};
type = "text";
val = [
" :::::: :::: ::: :::::::::: ::::::::: ::: ::: ::: ::: :::::::::: :::::: "
" :+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: "
" +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ "
" +#+ +#+ +:+ +#+ +#++:++# +#++:++#+ +#+ +:+ +#+ +#++:++#++: +#++:++# +#+ "
" +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ "
" #+# #+# #+#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# "
" ###### ### #### ########## ######### ######## ########## ### ### ########## ###### "
];
}
(padding 2)
{
type = "button";
val = " Find File";
on_press = {
__raw = "function() require('telescope.builtin').find_files() end";
};
opts = {
# hl = "comment";
keymap = [
"n"
"f"
":Telescope find_files <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "f";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = " New File";
on_press = {
__raw = "function() vim.cmd[[ene]] end";
};
opts = {
# hl = "comment";
keymap = [
"n"
"n"
":ene <BAR> startinsert <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "n";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = "󰈚 Recent Files";
on_press = {
__raw = "function() require('telescope.builtin').oldfiles() end";
};
opts = {
# hl = "comment";
keymap = [
"n"
"r"
":Telescope oldfiles <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "r";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = "󰈭 Find Word";
on_press = {
__raw = "function() require('telescope.builtin').live_grep() end";
};
opts = {
# hl = "comment";
keymap = [
"n"
"g"
":Telescope live_grep <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "g";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = " Restore Session";
on_press = {
__raw = "function() require('persistence').load() end";
};
opts = {
# hl = "comment";
keymap = [
"n"
"s"
":lua require('persistence').load()<cr>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "s";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = " Quit Neovim";
on_press = {
__raw = "function() vim.cmd[[qa]] end";
};
opts = {
# hl = "comment";
keymap = [
"n"
"q"
":qa<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "q";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
];
};
};
}

34
config/ui/barbecue.nix Normal file
View File

@ -0,0 +1,34 @@
{
lib,
config,
...
}: {
options = {
barbecue.enable = lib.mkEnableOption "Enable barbecue module";
};
config = lib.mkIf config.barbecue.enable {
plugins.barbecue = {
enable = true;
settings = {
create_autocmd = false;
theme = "auto";
};
};
extraConfigLua = ''
vim.api.nvim_create_autocmd({
"WinScrolled", -- or WinResized on NVIM-v0.9 and higher
"BufWinEnter",
"CursorHold",
"InsertLeave",
-- include this if you have set `show_modified` to `true`
"BufModifiedSet",
}, {
group = vim.api.nvim_create_augroup("barbecue.updater", {}),
callback = function()
require("barbecue.ui").update()
end,
})
'';
};
}

30
config/ui/default.nix Normal file
View File

@ -0,0 +1,30 @@
{
lib,
config,
...
}: {
imports = [
./alpha.nix
./barbecue.nix
./dressing-nvim.nix
./indent-blankline.nix
./noice.nix
./nui.nix
./notify.nix
./web-devicons.nix
];
options = {
ui.enable = lib.mkEnableOption "Enable ui module";
};
config = lib.mkIf config.ui.enable {
alpha.enable = lib.mkDefault true;
barbecue.enable = lib.mkDefault true;
dressing-nvim.enable = lib.mkDefault true;
indent-blankline.enable = lib.mkDefault true;
noice.enable = lib.mkDefault false;
notify.enable = lib.mkDefault true;
nui.enable = lib.mkDefault true;
web-devicons.enable = lib.mkDefault true;
};
}

181
config/ui/dressing-nvim.nix Normal file
View File

@ -0,0 +1,181 @@
{
lib,
config,
pkgs,
...
}: {
options = {
dressing-nvim.enable = lib.mkEnableOption "Enable dressing-nvim module";
};
config = lib.mkIf config.dressing-nvim.enable {
extraPlugins = with pkgs.vimPlugins; [
dressing-nvim
];
extraConfigLua = ''
require("dressing").setup({
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input",
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Can be 'left', 'right', or 'center'
title_pos = "left",
-- When true, <Esc> will close the modal
insert_only = true,
-- When true, input will start in insert mode.
start_in_insert = true,
-- These are passed to nvim_open_win
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
buf_options = {},
win_options = {
-- Disable line wrapping
wrap = false,
-- Indicator for when text exceeds window
list = true,
listchars = "precedes:,extends:",
-- Increase this for more context when text scrolls off the window
sidescrolloff = 0,
},
-- Set to `false` to disable
mappings = {
n = {
["<Esc>"] = "Close",
["<CR>"] = "Confirm",
},
i = {
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["<Up>"] = "HistoryPrev",
["<Down>"] = "HistoryNext",
},
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({...})
telescope = nil,
-- Options for fzf selector
fzf = {
window = {
width = 0.5,
height = 0.4,
},
},
-- Options for fzf-lua
fzf_lua = {
-- winopts = {
-- height = 0.5,
-- width = 0.5,
-- },
},
-- Options for nui Menu
nui = {
position = "50%",
size = nil,
relative = "editor",
border = {
style = "rounded",
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 0,
},
max_width = 80,
max_height = 40,
min_width = 40,
min_height = 10,
},
-- Options for built-in selector
builtin = {
-- Display numbers for options and set up keymaps
show_numbers = true,
-- These are passed to nvim_open_win
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
buf_options = {},
win_options = {
cursorline = true,
cursorlineopt = "both",
},
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
-- Set to `false` to disable
mappings = {
["<Esc>"] = "Close",
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
},
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
}) '';
};
}

View File

@ -0,0 +1,45 @@
{
lib,
config,
...
}: {
options = {
indent-blankline.enable = lib.mkEnableOption "Enable indent-blankline module";
};
config = lib.mkIf config.indent-blankline.enable {
plugins = {
indent-blankline = {
enable = true;
settings = {
indent = {
char = ""; # "│" or "▎"
};
scope = {
enabled = true;
show_start = true;
};
exclude = {
buftypes = [
"terminal"
"nofile"
];
filetypes = [
"help"
"alpha"
"dashboard"
"neo-tree"
"Trouble"
"trouble"
"lazy"
"mason"
"notify"
"toggleterm"
"lazyterm"
"nvterm"
];
};
};
};
};
};
}

59
config/ui/noice.nix Normal file
View File

@ -0,0 +1,59 @@
{
lib,
config,
...
}: {
options = {
noice.enable = lib.mkEnableOption "Enable noice module";
};
config = lib.mkIf config.noice.enable {
plugins.noice = {
enable = true;
notify = {
enabled = false;
};
messages = {
enabled = true; # Adds a padding-bottom to neovim statusline when set to false for some reason
};
lsp = {
message = {
enabled = true;
};
progress = {
enabled = false;
view = "mini";
};
};
popupmenu = {
enabled = true;
backend = "nui";
};
format = {
filter = {
pattern = [
":%s*%%s*s:%s*"
":%s*%%s*s!%s*"
":%s*%%s*s/%s*"
"%s*s:%s*"
":%s*s!%s*"
":%s*s/%s*"
];
icon = "";
lang = "regex";
};
replace = {
pattern = [
":%s*%%s*s:%w*:%s*"
":%s*%%s*s!%w*!%s*"
":%s*%%s*s/%w*/%s*"
"%s*s:%w*:%s*"
":%s*s!%w*!%s*"
":%s*s/%w*/%s*"
];
icon = "󱞪";
lang = "regex";
};
};
};
};
}

146
config/ui/notify.nix Normal file
View File

@ -0,0 +1,146 @@
{
lib,
config,
...
}: {
options = {
notify.enable = lib.mkEnableOption "Enable notify module";
};
config = lib.mkIf config.notify.enable {
plugins.notify = {
enable = true;
backgroundColour = "#000000";
fps = 60;
render = "default";
timeout = 500;
topDown = true;
};
keymaps = [
{
mode = "n";
key = "<leader>un";
action = ''
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
'';
options = {
desc = "Dismiss All Notifications";
};
}
];
extraConfigLua = ''
local notify = require("notify")
local function show_notification(message, level)
notify(message, level, { title = "conform.nvim" })
end
function ToggleLineNumber()
if vim.wo.number then
vim.wo.number = false
show_notification("Line numbers disabled", "info")
else
vim.wo.number = true
vim.wo.relativenumber = false
show_notification("Line numbers enabled", "info")
end
end
function ToggleRelativeLineNumber()
if vim.wo.relativenumber then
vim.wo.relativenumber = false
show_notification("Relative line numbers disabled", "info")
else
vim.wo.relativenumber = true
vim.wo.number = false
show_notification("Relative line numbers enabled", "info")
end
end
function ToggleWrap()
if vim.wo.wrap then
vim.wo.wrap = false
show_notification("Wrap disabled", "info")
else
vim.wo.wrap = true
vim.wo.number = false
show_notification("Wrap enabled", "info")
end
end
function ToggleInlayHints()
local is_enabled = vim.lsp.inlay_hint.is_enabled()
vim.lsp.inlay_hint.enable(not is_enabled)
if is_enabled then
show_notification("Inlay Hints disabled", "info")
else
show_notification("Inlay Hints enabled", "info")
end
end
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function()
local current_dir = vim.fn.getcwd()
local is_nixpkgs = current_dir:match("nixpkgs$")
if is_nixpkgs then
vim.b.disable_autoformat = true
show_notification("Autoformat-on-save disabled for nixpkgs", "info")
else
vim.b.disable_autoformat = false
end
end,
})
vim.api.nvim_create_user_command("FormatToggle", function(args)
local is_global = not args.bang
local current_dir = vim.fn.getcwd()
local is_nixpkgs = current_dir:match("nixpkgs$")
if is_global then
vim.g.disable_autoformat = not vim.g.disable_autoformat
if vim.g.disable_autoformat then
show_notification("Autoformat-on-save disabled globally", "info")
else
show_notification("Autoformat-on-save enabled globally", "info")
end
elseif is_nixpkgs then
vim.b.disable_autoformat = not vim.b.disable_autoformat
if vim.b.disable_autoformat then
show_notification("Autoformat-on-save disabled for nixpkgs", "info")
else
show_notification("Autoformat-on-save enabled for nixpkgs", "info")
end
else
vim.b.disable_autoformat = not vim.b.disable_autoformat
if vim.b.disable_autoformat then
show_notification("Autoformat-on-save disabled for this buffer", "info")
else
show_notification("Autoformat-on-save enabled for this buffer", "info")
end
end
end, {
desc = "Toggle autoformat-on-save",
bang = true,
})
local filtered_message = { "No information available" }
-- Override notify function to filter out messages
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(message, level, opts)
local merged_opts = vim.tbl_extend("force", {
on_open = function(win)
local buf = vim.api.nvim_win_get_buf(win)
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
end,
}, opts or {})
for _, msg in ipairs(filtered_message) do
if message == msg then
return
end
end
return notify(message, level, merged_opts)
end
'';
};
}

13
config/ui/nui.nix Normal file
View File

@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}: {
options = {
nui.enable = lib.mkEnableOption "Enable nui module";
};
config = lib.mkIf config.nui.enable {
extraPlugins = with pkgs.vimPlugins; [nui-nvim];
};
}

View File

@ -0,0 +1,14 @@
{
lib,
config,
...
}: {
options = {
web-devicons.enable = lib.mkEnableOption "Enable web-devicons module";
};
config = lib.mkIf config.web-devicons.enable {
plugins.web-devicons = {
enable = true;
};
};
}