refactor: modified nixvim configuration to use bundled format with minimal config

This commit is contained in:
Ceferino Patino 2025-10-20 16:22:07 -05:00
commit 26af2d22c1
Signed by: c4patino
SSH key fingerprint: SHA256:9fQ9TsujGrdNNi76mnsu63v7dS5JOmHRZEqBOl49OR8
37 changed files with 1839 additions and 1361 deletions

51
config/bundles/common.nix Normal file
View file

@ -0,0 +1,51 @@
{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace enabled;
base = "${namespace}.bundles.common";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "common bundle";
};
config = mkIf cfg.enable {
${namespace} = {
languages = {
cmp = enabled;
conform = enabled;
dap = enabled;
luasnip = enabled;
treesitter = enabled;
};
navigation = {
harpoon = enabled;
nvim-tree = enabled;
telescope = enabled;
};
ui = {
alpha = enabled;
fidget = enabled;
indent-blankline = enabled;
lualine = enabled;
noice = enabled;
nvim-notify = enabled;
};
utils = {
lazygit = enabled;
todo-comments = enabled;
toggleterm = enabled;
undotree = enabled;
which-key = enabled;
zenmode = enabled;
};
};
};
}

View file

@ -0,0 +1,5 @@
{...} @ inputs: {
imports = [
(import ./common.nix inputs)
];
}

View file

@ -1,9 +1,11 @@
{
{...} @ inputs: {
imports = [
./languages
./navigation
./ui
./utils
(import ./bundles inputs)
(import ./languages inputs)
(import ./navigation inputs)
(import ./ui inputs)
(import ./utils inputs)
./autocmds.nix
./mappings.nix

View file

@ -1,55 +1,70 @@
{
plugins = {
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{name = "nvim_lsp";}
{name = "luasnip";}
{name = "path";}
{name = "buffer";}
];
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
};
performance = {
debounce = 60;
fetching_timeout = 200;
max_view_entries = 30;
};
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
};
documentation = {
border = "rounded";
};
};
formatting = {
fields = ["kind" "abbr" "menu"];
expandable_indicator = true;
};
};
};
cmp_luasnip.enable = true;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.languages.cmp";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "nvim-cmp";
};
extraConfigLua = ''
kind_icons = {
config = mkIf cfg.enable {
plugins = {
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{name = "nvim_lsp";}
{name = "luasnip";}
{name = "path";}
{name = "buffer";}
];
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
};
performance = {
debounce = 60;
fetching_timeout = 200;
max_view_entries = 30;
};
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
};
documentation = {
border = "rounded";
};
};
formatting = {
fields = ["kind" "abbr" "menu"];
expandable_indicator = true;
};
};
};
cmp_luasnip.enable = true;
};
extraConfigLua = ''
kind_icons = {
Text = "󰊄",
Method = "",
Function = "󰡱",
@ -75,33 +90,34 @@
Event = "",
Operator = "",
TypeParameter = "",
}
}
local cmp = require'cmp'
local cmp = require'cmp'
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({'/', "?" }, {
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({'/', "?" }, {
sources = {
{ name = 'buffer' }
{ name = 'buffer' }
}
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' },
{ name = 'cmp_git' },
}, {
{ name = 'buffer' },
{ name = 'buffer' },
})
})
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
{ name = 'path' }
}, {
{ name = 'cmdline' }
{ name = 'cmdline' }
}),
})
'';
})
'';
};
}

View file

@ -1,104 +1,119 @@
{lib, ...}: let
{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
inherit (lib.nixvim.utils) listToUnkeyedAttrs;
base = "${namespace}.languages.conform";
cfg = getAttrByNamespace config base;
in {
keymaps = [
{
mode = "n";
key = "<leader>ff";
action = "<cmd>FormatToggle<cr>";
options = {
silent = true;
desc = "Conform Toggle autoformat";
};
}
{
mode = ["n" "v"];
key = "<leader>f";
action = "<cmd>lua require('conform').format({ lsp_format = \"fallback\" })<cr>";
options = {
silent = true;
desc = "Conform Format";
};
}
];
options = mkOptionsWithNamespace base {
enable = mkEnableOption "conform";
};
plugins.conform-nvim = {
enable = true;
settings = {
notify_on_error = true;
default_format_opts = {
lsp_format = "fallback";
};
formatters_by_ft = let
mkFormatList = formatters:
listToUnkeyedAttrs formatters
// {
stop_after_first = true;
};
in {
astro = mkFormatList ["prettierd" "prettier"];
cabal = mkFormatList ["ormolu"];
haskell = mkFormatList ["ormolu"];
java = mkFormatList ["google-java-format"];
javascript = mkFormatList ["prettierd" "prettier"];
javascriptreact = mkFormatList ["prettierd" "prettier"];
lua = mkFormatList ["stylua"];
nix = mkFormatList ["alejandra"];
racket = mkFormatList ["raco_fmt"];
typescript = mkFormatList ["prettierd" "prettier"];
typescriptreact = mkFormatList ["prettierd" "prettier"];
};
formatters = {
raco_fmt = {
command = "raco";
args = ["fmt"];
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>ff";
action = "<cmd>FormatToggle<cr>";
options = {
silent = true;
desc = "Conform Toggle autoformat";
};
nix_fmt = {
command = "nix";
args = ["fmt"];
}
{
mode = ["n" "v"];
key = "<leader>f";
action = "<cmd>lua require('conform').format({ lsp_format = \"fallback\" })<cr>";
options = {
silent = true;
desc = "Conform Format";
};
}
];
plugins.conform-nvim = {
enable = true;
settings = {
notify_on_error = true;
default_format_opts = {
lsp_format = "fallback";
};
formatters_by_ft = let
mkFormatList = formatters:
listToUnkeyedAttrs formatters
// {
stop_after_first = true;
};
in {
astro = mkFormatList ["prettierd" "prettier"];
cabal = mkFormatList ["ormolu"];
haskell = mkFormatList ["ormolu"];
java = mkFormatList ["google-java-format"];
javascript = mkFormatList ["prettierd" "prettier"];
javascriptreact = mkFormatList ["prettierd" "prettier"];
lua = mkFormatList ["stylua"];
nix = mkFormatList ["alejandra"];
racket = mkFormatList ["raco_fmt"];
typescript = mkFormatList ["prettierd" "prettier"];
typescriptreact = mkFormatList ["prettierd" "prettier"];
};
formatters = {
raco_fmt = {
command = "raco";
args = ["fmt"];
};
nix_fmt = {
command = "nix";
args = ["fmt"];
};
};
};
};
};
extraConfigLua = ''
local conform = require("conform")
local notify = require("notify")
extraConfigLua = ''
local conform = require("conform")
local notify = require("notify")
conform.setup({
conform.setup({
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { lsp_format = "fallback" }
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { lsp_format = "fallback" }
end,
})
})
local function show_notification(message, level)
local function show_notification(message, level)
notify(message, level, { title = "conform.nvim" })
end
end
vim.api.nvim_create_user_command("FormatToggle", function(args)
vim.api.nvim_create_user_command("FormatToggle", function(args)
local is_global = not args.bang
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
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
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
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 })
'';
end, { desc = "Toggle autoformat-on-save", bang = true })
'';
};
}

View file

@ -1,362 +1,379 @@
{pkgs, ...}: {
keymaps = [
{
mode = "n";
key = "<leader>db";
action.__raw = "function() require('dap').toggle_breakpoint() end";
options = {
silent = true;
desc = "Toggle Breakpoint";
};
}
{
mode = "n";
key = "<leader>dB";
action.__raw = "function() require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) end";
options = {
silent = true;
desc = "Toggle Conditional Breakpoint";
};
}
{
mode = "n";
key = "<leader>dc";
action.__raw = "function() require('dap').continue() end";
options = {
silent = true;
desc = "Continue";
};
}
{
mode = "n";
key = "<leader>da";
action.__raw = "function() require('dap').continue({ before = get_args }) end";
options = {
silent = true;
desc = "Run with Args";
};
}
{
mode = "n";
key = "<leader>dC";
action.__raw = "function() require('dap').run_to_cursor() end";
options = {
silent = true;
desc = "Run to cursor";
};
}
{
mode = "n";
key = "<leader>dg";
action.__raw = "function() require('dap').goto_() end";
options = {
silent = true;
desc = "Go to line (no execute)";
};
}
{
mode = "n";
key = "<leader>di";
action.__raw = "function() require('dap').step_into() end";
options = {
silent = true;
desc = "Step into";
};
}
{
mode = "n";
key = "<leader>dj";
action.__raw = "function() require('dap').down() end";
options = {
silent = true;
desc = "Down";
};
}
{
mode = "n";
key = "<leader>dk";
action.__raw = "function() require('dap').up() end";
options = {
silent = true;
desc = "Up";
};
}
{
mode = "n";
key = "<leader>dl";
action.__raw = "function() require('dap').run_last() end";
options = {
silent = true;
desc = "Run Last";
};
}
{
mode = "n";
key = "<leader>do";
action.__raw = "function() require('dap').step_out() end";
options = {
silent = true;
desc = "Step Out";
};
}
{
mode = "n";
key = "<leader>dO";
action.__raw = "function() require('dap').step_over() end";
options = {
silent = true;
desc = "Step Over";
};
}
{
mode = "n";
key = "<leader>dp";
action.__raw = "function() require('dap').pause() end";
options = {
silent = true;
desc = "Pause";
};
}
{
mode = "n";
key = "<leader>dr";
action.__raw = "function() require('dap').repl.toggle() end";
options = {
silent = true;
desc = "Toggle REPL";
};
}
{
mode = "n";
key = "<leader>ds";
action.__raw = "function() require('dap').session() end";
options = {
silent = true;
desc = "Session";
};
}
{
mode = "n";
key = "<leader>dt";
action.__raw = "function() require('dap').terminate() end";
options = {
silent = true;
desc = "Terminate";
};
}
{
mode = "n";
key = "<leader>du";
action.__raw = "function() require('dapui').toggle() end";
options = {
silent = true;
desc = "Dap UI";
};
}
{
mode = ["n" "v"];
key = "<leader>de";
action.__raw = "function() require('dapui').eval() end";
options = {
silent = true;
desc = "Eval";
};
}
];
{
config,
lib,
namespace,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.languages.dap";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "dap";
};
plugins = {
dap = {
enable = true;
adapters = {
servers = {
codelldb = {
port = 13000;
executable = {
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
args = ["--port" "13000"];
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>db";
action.__raw = "function() require('dap').toggle_breakpoint() end";
options = {
silent = true;
desc = "Toggle Breakpoint";
};
}
{
mode = "n";
key = "<leader>dB";
action.__raw = "function() require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) end";
options = {
silent = true;
desc = "Toggle Conditional Breakpoint";
};
}
{
mode = "n";
key = "<leader>dc";
action.__raw = "function() require('dap').continue() end";
options = {
silent = true;
desc = "Continue";
};
}
{
mode = "n";
key = "<leader>da";
action.__raw = "function() require('dap').continue({ before = get_args }) end";
options = {
silent = true;
desc = "Run with Args";
};
}
{
mode = "n";
key = "<leader>dC";
action.__raw = "function() require('dap').run_to_cursor() end";
options = {
silent = true;
desc = "Run to cursor";
};
}
{
mode = "n";
key = "<leader>dg";
action.__raw = "function() require('dap').goto_() end";
options = {
silent = true;
desc = "Go to line (no execute)";
};
}
{
mode = "n";
key = "<leader>di";
action.__raw = "function() require('dap').step_into() end";
options = {
silent = true;
desc = "Step into";
};
}
{
mode = "n";
key = "<leader>dj";
action.__raw = "function() require('dap').down() end";
options = {
silent = true;
desc = "Down";
};
}
{
mode = "n";
key = "<leader>dk";
action.__raw = "function() require('dap').up() end";
options = {
silent = true;
desc = "Up";
};
}
{
mode = "n";
key = "<leader>dl";
action.__raw = "function() require('dap').run_last() end";
options = {
silent = true;
desc = "Run Last";
};
}
{
mode = "n";
key = "<leader>do";
action.__raw = "function() require('dap').step_out() end";
options = {
silent = true;
desc = "Step Out";
};
}
{
mode = "n";
key = "<leader>dO";
action.__raw = "function() require('dap').step_over() end";
options = {
silent = true;
desc = "Step Over";
};
}
{
mode = "n";
key = "<leader>dp";
action.__raw = "function() require('dap').pause() end";
options = {
silent = true;
desc = "Pause";
};
}
{
mode = "n";
key = "<leader>dr";
action.__raw = "function() require('dap').repl.toggle() end";
options = {
silent = true;
desc = "Toggle REPL";
};
}
{
mode = "n";
key = "<leader>ds";
action.__raw = "function() require('dap').session() end";
options = {
silent = true;
desc = "Session";
};
}
{
mode = "n";
key = "<leader>dt";
action.__raw = "function() require('dap').terminate() end";
options = {
silent = true;
desc = "Terminate";
};
}
{
mode = "n";
key = "<leader>du";
action.__raw = "function() require('dapui').toggle() end";
options = {
silent = true;
desc = "Dap UI";
};
}
{
mode = ["n" "v"];
key = "<leader>de";
action.__raw = "function() require('dapui').eval() end";
options = {
silent = true;
desc = "Eval";
};
}
];
plugins = {
dap = {
enable = true;
adapters = {
servers = {
codelldb = {
port = 13000;
executable = {
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
args = ["--port" "13000"];
};
};
};
go = {
port = 38697;
executable = {
command = "${pkgs.delve}/bin/dlv";
args = ["dap" "-l" "127.0.0.1:38697"];
go = {
port = 38697;
executable = {
command = "${pkgs.delve}/bin/dlv";
args = ["dap" "-l" "127.0.0.1:38697"];
};
};
};
pwa-node = {
port = 9229;
executable = {
command = "${pkgs.vscode-js-debug}/bin/js-debug";
args = ["9229" "127.0.0.1"];
pwa-node = {
port = 9229;
executable = {
command = "${pkgs.vscode-js-debug}/bin/js-debug";
args = ["9229" "127.0.0.1"];
};
};
};
};
};
configurations = let
exeConfigs = [
{
type = "codelldb";
request = "launch";
name = "exe";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
{
type = "codelldb";
request = "launch";
name = "exe:args";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end '';
cwd.__raw = ''function() return vim.fn.getcwd() end '';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
}
{
type = "codelldb";
request = "attach";
name = "attach";
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
];
configurations = let
exeConfigs = [
{
type = "codelldb";
request = "launch";
name = "exe";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
{
type = "codelldb";
request = "launch";
name = "exe:args";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end '';
cwd.__raw = ''function() return vim.fn.getcwd() end '';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
}
{
type = "codelldb";
request = "attach";
name = "attach";
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
];
webConfigs = [
{
type = "pwa-node";
request = "launch";
name = "current";
program = "\${file}";
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
{
type = "pwa-node";
request = "launch";
name = "current:args";
program = "\${file}";
cwd.__raw = ''function() return vim.fn.getcwd() end'';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
}
{
type = "pwa-node";
request = "launch";
name = "file";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
{
type = "pwa-node";
request = "launch";
name = "file:args";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
}
{
type = "pwa-node";
request = "attach";
name = "attach";
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
];
in {
python = let
findPython = ''
function()
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
return cwd .. "/venv/bin/python"
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
return cwd .. "/.venv/bin/python"
else
return "python3"
end
end
'';
in [
{
type = "python";
request = "launch";
name = "module";
module.__raw = ''function() return vim.fn.input("Module: ") end '';
pythonPath.__raw = findPython;
}
{
type = "python";
request = "launch";
name = "module:args";
module.__raw = ''function() return vim.fn.input("Module: ") end '';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
pythonPath.__raw = findPython;
}
];
c = exeConfigs;
cpp = exeConfigs;
rust = exeConfigs;
zig = exeConfigs;
go = [
{
type = "go";
request = "launch";
name = "file";
program = "\${file}";
outputMode = "remote";
}
{
type = "go";
request = "launch";
name = "file:args";
program = "\${file}";
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
outputMode = "remote";
}
{
type = "go";
mode = "remote";
request = "attach";
name = "attach";
connect.__raw = ''
webConfigs = [
{
type = "pwa-node";
request = "launch";
name = "current";
program = "\${file}";
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
{
type = "pwa-node";
request = "launch";
name = "current:args";
program = "\${file}";
cwd.__raw = ''function() return vim.fn.getcwd() end'';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
}
{
type = "pwa-node";
request = "launch";
name = "file";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
{
type = "pwa-node";
request = "launch";
name = "file:args";
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
}
{
type = "pwa-node";
request = "attach";
name = "attach";
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
];
in {
python = let
findPython = ''
function()
local input = vim.fn.input("Host: ")
local host, port = string.match(input, "([^:]+):(%d+)")
return { host = host, port = tonumber(port) }
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
return cwd .. "/venv/bin/python"
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
return cwd .. "/.venv/bin/python"
else
return "python3"
end
end
'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
];
in [
{
type = "python";
request = "launch";
name = "module";
module.__raw = ''function() return vim.fn.input("Module: ") end '';
pythonPath.__raw = findPython;
}
{
type = "python";
request = "launch";
name = "module:args";
module.__raw = ''function() return vim.fn.input("Module: ") end '';
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
pythonPath.__raw = findPython;
}
];
c = exeConfigs;
cpp = exeConfigs;
rust = exeConfigs;
zig = exeConfigs;
go = [
{
type = "go";
request = "launch";
name = "file";
program = "\${file}";
outputMode = "remote";
}
{
type = "go";
request = "launch";
name = "file:args";
program = "\${file}";
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
outputMode = "remote";
}
{
type = "go";
mode = "remote";
request = "attach";
name = "attach";
connect.__raw = ''
function()
local input = vim.fn.input("Host: ")
local host, port = string.match(input, "([^:]+):(%d+)")
return { host = host, port = tonumber(port) }
end
'';
cwd.__raw = ''function() return vim.fn.getcwd() end'';
}
];
javascript = webConfigs;
javascriptreact = webConfigs;
typescript = webConfigs;
typescriptreact = webConfigs;
};
signs = {
dapBreakpoint = {
text = "";
texthl = "DapBreakpoint";
javascript = webConfigs;
javascriptreact = webConfigs;
typescript = webConfigs;
typescriptreact = webConfigs;
};
dapBreakpointCondition = {
text = "";
texthl = "DapBreakpointCondition";
};
dapLogPoint = {
text = "";
texthl = "DapLogPoint";
signs = {
dapBreakpoint = {
text = "";
texthl = "DapBreakpoint";
};
dapBreakpointCondition = {
text = "";
texthl = "DapBreakpointCondition";
};
dapLogPoint = {
text = "";
texthl = "DapLogPoint";
};
};
};
};
dap-ui = {
enable = true;
dap-ui = {
enable = true;
settings.floating.mappings = {
close = ["<Esc>" "q"];
settings.floating.mappings = {
close = ["<Esc>" "q"];
};
};
};
dap-python.enable = true;
dap-lldb = {
enable = true;
settings.codelldb_path = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
dap-python.enable = true;
dap-lldb = {
enable = true;
settings.codelldb_path = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
};
};
};
}

View file

@ -1,13 +1,12 @@
{
{...} @ inputs: {
imports = [
./cmp.nix
./conform.nix
./dap.nix
./lsp.nix
./lspkind.nix
./lspsaga.nix
./luasnip.nix
./treesitter.nix
(import ./lsp inputs)
(import ./cmp.nix inputs)
(import ./conform.nix inputs)
(import ./dap.nix inputs)
(import ./luasnip.nix inputs)
(import ./treesitter.nix inputs)
];
plugins = {

View file

@ -1,64 +0,0 @@
{pkgs, ...}: {
plugins = {
lsp = {
enable = true;
capabilities = "offsetEncoding = 'utf-16'";
servers = {
astro.enable = true;
clangd.enable = true;
csharp_ls.enable = true;
gopls.enable = true;
hls = {
enable = true;
installGhc = false;
package = pkgs.haskell-language-server.override {supportedGhcVersions = ["98" "910"];};
};
jdtls.enable = true;
lua_ls.enable = true;
nixd.enable = true;
pylsp = {
enable = true;
settings.configurationSources = "pycodestyle";
settings = {
plugins = {
pyflakes.enabled = true;
mccabe.enabled = true;
pycodestyle.enabled = true;
pydocstyle.enabled = true;
yapf.enabled = true;
};
};
};
sqls.enable = true;
zls.enable = true;
};
};
rustaceanvim.enable = true;
typescript-tools.enable = true;
};
extraConfigLua = ''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border;
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border;
}
)
vim.diagnostic.config {
float = { border=_border };
virtual_text = true;
};
require('lspconfig.ui.windows').default_options = {
border = _border;
}
'';
}

View file

@ -0,0 +1,86 @@
{
config,
lib,
namespace,
pkgs,
...
} @ inputs: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.languages.lsp";
cfg = getAttrByNamespace config base;
in {
imports = [
(import ./lspkind.nix inputs)
(import ./lspsaga.nix inputs)
];
options = mkOptionsWithNamespace base {
enable = mkEnableOption "lsp";
};
config = mkIf cfg.enable {
plugins = {
lsp = {
enable = true;
capabilities = "offsetEncoding = 'utf-16'";
servers = {
astro.enable = true;
clangd.enable = true;
csharp_ls.enable = true;
gopls.enable = true;
hls = {
enable = true;
installGhc = false;
package = pkgs.haskell-language-server.override {supportedGhcVersions = ["98" "910"];};
};
jdtls.enable = true;
lua_ls.enable = true;
nixd.enable = true;
pylsp = {
enable = true;
settings.configurationSources = "pycodestyle";
settings = {
plugins = {
pyflakes.enabled = true;
mccabe.enabled = true;
pycodestyle.enabled = true;
pydocstyle.enabled = true;
yapf.enabled = true;
};
};
};
sqls.enable = true;
zls.enable = true;
};
};
rustaceanvim.enable = true;
typescript-tools.enable = true;
};
extraConfigLua = ''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border;
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border;
}
)
vim.diagnostic.config {
float = { border=_border };
virtual_text = true;
};
require('lspconfig.ui.windows').default_options = {
border = _border;
}
'';
};
}

View file

@ -0,0 +1,20 @@
{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) getAttrByNamespace;
cfg = getAttrByNamespace config "${namespace}.languages.lsp";
in {
config = mkIf cfg.enable {
plugins.lspkind = {
enable = true;
extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};
};
};
}

155
config/languages/lsp/lspsaga.nix Executable file
View file

@ -0,0 +1,155 @@
{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) getAttrByNamespace;
cfg = getAttrByNamespace config "${namespace}.languages.lsp";
in {
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "gd";
action = "<cmd>Lspsaga finder def<cr>";
options = {
desc = "Goto Definition";
silent = true;
};
}
{
mode = "n";
key = "gr";
action = "<cmd>Lspsaga finder ref<cr>";
options = {
desc = "Goto References";
silent = true;
};
}
{
mode = "n";
key = "gI";
action = "<cmd>Lspsaga finder imp<cr>";
options = {
desc = "Goto Implementation";
silent = true;
};
}
{
mode = "n";
key = "gT";
action = "<cmd>Lspsaga peek_type_definition<cr>";
options = {
desc = "Type Definition";
silent = true;
};
}
{
mode = "n";
key = "K";
action = "<cmd>Lspsaga hover_doc<cr>";
options = {
desc = "Hover";
silent = true;
};
}
{
mode = "n";
key = "<leader>cw";
action = "<cmd>Lspsaga outline<cr>";
options = {
desc = "Outline";
silent = true;
};
}
{
mode = "n";
key = "<leader>cr";
action = "<cmd>Lspsaga rename<cr>";
options = {
desc = "Rename";
silent = true;
};
}
{
mode = "n";
key = "<leader>ca";
action = "<cmd>Lspsaga code_action<cr>";
options = {
desc = "Code Action";
silent = true;
};
}
];
plugins.lspsaga = {
enable = true;
beacon = {
enable = true;
};
ui = {
border = "rounded";
codeAction = "💡";
};
hover = {
openCmd = "!floorp";
openLink = "gx";
};
diagnostic = {
borderFollow = true;
diagnosticOnlyCurrent = false;
showCodeAction = true;
};
symbolInWinbar = {
enable = true;
};
codeAction = {
extendGitSigns = false;
showServerName = true;
onlyInCursor = true;
numShortcut = true;
keys = {
exec = "<cr>";
quit = ["<Esc>" "q"];
};
};
lightbulb = {
enable = false;
sign = false;
virtualText = true;
};
implement.enable = false;
rename = {
autoSave = false;
keys = {
exec = "<cr>";
quit = ["<C-k>" "<Esc>"];
select = "x";
};
};
outline = {
autoClose = true;
autoPreview = true;
closeAfterJump = true;
layout = "normal";
winPosition = "right";
keys = {
jump = "e";
quit = "q";
toggleOrJump = "o";
};
};
scrollPreview = {
scrollDown = "<C-f>";
scrollUp = "<C-b>";
};
};
};
}

View file

@ -1,9 +0,0 @@
{
plugins.lspkind = {
enable = true;
extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};
};
}

View file

@ -1,144 +0,0 @@
{
keymaps = [
{
mode = "n";
key = "gd";
action = "<cmd>Lspsaga finder def<cr>";
options = {
desc = "Goto Definition";
silent = true;
};
}
{
mode = "n";
key = "gr";
action = "<cmd>Lspsaga finder ref<cr>";
options = {
desc = "Goto References";
silent = true;
};
}
{
mode = "n";
key = "gI";
action = "<cmd>Lspsaga finder imp<cr>";
options = {
desc = "Goto Implementation";
silent = true;
};
}
{
mode = "n";
key = "gT";
action = "<cmd>Lspsaga peek_type_definition<cr>";
options = {
desc = "Type Definition";
silent = true;
};
}
{
mode = "n";
key = "K";
action = "<cmd>Lspsaga hover_doc<cr>";
options = {
desc = "Hover";
silent = true;
};
}
{
mode = "n";
key = "<leader>cw";
action = "<cmd>Lspsaga outline<cr>";
options = {
desc = "Outline";
silent = true;
};
}
{
mode = "n";
key = "<leader>cr";
action = "<cmd>Lspsaga rename<cr>";
options = {
desc = "Rename";
silent = true;
};
}
{
mode = "n";
key = "<leader>ca";
action = "<cmd>Lspsaga code_action<cr>";
options = {
desc = "Code Action";
silent = true;
};
}
];
plugins.lspsaga = {
enable = true;
beacon = {
enable = true;
};
ui = {
border = "rounded";
codeAction = "💡";
};
hover = {
openCmd = "!floorp";
openLink = "gx";
};
diagnostic = {
borderFollow = true;
diagnosticOnlyCurrent = false;
showCodeAction = true;
};
symbolInWinbar = {
enable = true;
};
codeAction = {
extendGitSigns = false;
showServerName = true;
onlyInCursor = true;
numShortcut = true;
keys = {
exec = "<cr>";
quit = ["<Esc>" "q"];
};
};
lightbulb = {
enable = false;
sign = false;
virtualText = true;
};
implement.enable = false;
rename = {
autoSave = false;
keys = {
exec = "<cr>";
quit = ["<C-k>" "<Esc>"];
select = "x";
};
};
outline = {
autoClose = true;
autoPreview = true;
closeAfterJump = true;
layout = "normal";
winPosition = "right";
keys = {
jump = "e";
quit = "q";
toggleOrJump = "o";
};
};
scrollPreview = {
scrollDown = "<C-f>";
scrollUp = "<C-b>";
};
};
}

View file

@ -1,123 +1,137 @@
{
plugins.luasnip = {
enable = true;
# Basic LuaSnip settings
settings = {
history = true;
updateevents = "TextChanged,TextChangedI";
enable_autosnippets = true;
};
config,
lib,
namespace,
...
}: let
inherit (builtins) readDir;
inherit (lib) mkIf mkEnableOption filter match attrNames concatStringsSep;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.languages.luasnip";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "luasnip";
};
# Add keymaps for snippet navigation
keymaps = [
{
mode = "i";
key = "<C-k>";
action = "<cmd>lua require('luasnip').expand_or_jump()<CR>";
options.desc = "Snippets Expand or jump forward";
}
{
mode = "i";
key = "<C-j>";
action = "<cmd>lua require('luasnip').jump(-1)<CR>";
options.desc = "Snippets Jump backward";
}
{
mode = "i";
key = "<C-l>";
action = "<cmd>lua require('luasnip').change_choice(1)<CR>";
options.desc = "Snippets Cycle choices";
}
];
config = mkIf cfg.enable {
plugins.luasnip = {
enable = true;
# Core snippet configuration and definitions
# Uses unified snippets config from ../snippets/default.nix for all LuaSnip setup.
# Use the unified snippets config for LuaSnip
extraConfigLua = let
snippetDir = ../languages/snippets;
snippetFiles =
builtins.filter
(name: builtins.match ".*\\.nix$" name != null)
(builtins.attrNames (builtins.readDir snippetDir));
snippetConfigs = map (file: (import (snippetDir + "/${file}")).extraConfigLua) snippetFiles;
allSnippets = builtins.concatStringsSep "\n" snippetConfigs;
in ''
-- Get comment string for current filetype
local function get_comment_string()
local comment_string = vim.bo.commentstring
if not comment_string or comment_string == "" then
return "-- %s" -- Default to Lua style comments
# Basic LuaSnip settings
settings = {
history = true;
updateevents = "TextChanged,TextChangedI";
enable_autosnippets = true;
};
};
# Add keymaps for snippet navigation
keymaps = [
{
mode = "i";
key = "<C-k>";
action = "<cmd>lua require('luasnip').expand_or_jump()<CR>";
options.desc = "Snippets Expand or jump forward";
}
{
mode = "i";
key = "<C-j>";
action = "<cmd>lua require('luasnip').jump(-1)<CR>";
options.desc = "Snippets Jump backward";
}
{
mode = "i";
key = "<C-l>";
action = "<cmd>lua require('luasnip').change_choice(1)<CR>";
options.desc = "Snippets Cycle choices";
}
];
extraConfigLua = let
snippets =
readDir ../languages/snippets
|> attrNames
|> filter (name: match ".*\\.nix$" name != null)
|> map (name: ../languages/snippets + "/${name}")
|> map (file: (import file).extraConfigLua)
|> concatStringsSep "\n";
in ''
-- Get comment string for current filetype
local function get_comment_string()
local comment_string = vim.bo.commentstring
if not comment_string or comment_string == "" then
return "-- %s" -- Default to Lua style comments
end
return comment_string
end
return comment_string
end
-- Get visual selection
local function get_visual_selection()
local visual_modes = {
v = true,
V = true,
["\22"] = true -- CTRL+V
-- Get visual selection
local function get_visual_selection()
local visual_modes = {
v = true,
V = true,
["\22"] = true -- CTRL+V
}
if not visual_modes[vim.api.nvim_get_mode().mode] then
return ""
end
local _, ls, cs = unpack(vim.fn.getpos("v"))
local _, le, ce = unpack(vim.fn.getpos("."))
-- Normalize positions
if ls > le or (ls == le and cs > ce) then
ls, le = le, ls
cs, ce = ce, cs
end
local lines = vim.api.nvim_buf_get_lines(0, ls - 1, le, false)
if #lines == 0 then
return ""
end
-- Adjust for partial lines
lines[1] = string.sub(lines[1], cs, -1)
if #lines > 1 then
lines[#lines] = string.sub(lines[#lines], 1, ce)
else
lines[1] = string.sub(lines[1], 1, ce - cs + 1)
end
return table.concat(lines, "\n")
end
-- Format date in various ways
local function date_format(format)
return os.date(format)
end
-- Capture groups from regex matches
local function capture_match(match, group)
if match and #match > group then
return match[group + 1]
end
return ""
end
-- Check if the current buffer is a test file
local function is_test_file()
local filename = vim.fn.expand("%:t")
return string.match(filename, "[tT]est") ~= nil or string.match(filename, "_test") ~= nil or string.match(filename, "spec") ~= nil
end
-- Make these functions available to snippets
_G.snippet_utils = {
get_comment_string = get_comment_string,
get_visual_selection = get_visual_selection,
date_format = date_format,
capture_match = capture_match,
is_test_file = is_test_file
}
if not visual_modes[vim.api.nvim_get_mode().mode] then
return ""
end
local _, ls, cs = unpack(vim.fn.getpos("v"))
local _, le, ce = unpack(vim.fn.getpos("."))
-- Normalize positions
if ls > le or (ls == le and cs > ce) then
ls, le = le, ls
cs, ce = ce, cs
end
local lines = vim.api.nvim_buf_get_lines(0, ls - 1, le, false)
if #lines == 0 then
return ""
end
-- Adjust for partial lines
lines[1] = string.sub(lines[1], cs, -1)
if #lines > 1 then
lines[#lines] = string.sub(lines[#lines], 1, ce)
else
lines[1] = string.sub(lines[1], 1, ce - cs + 1)
end
return table.concat(lines, "\n")
end
-- Format date in various ways
local function date_format(format)
return os.date(format)
end
-- Capture groups from regex matches
local function capture_match(match, group)
if match and #match > group then
return match[group + 1]
end
return ""
end
-- Check if the current buffer is a test file
local function is_test_file()
local filename = vim.fn.expand("%:t")
return string.match(filename, "[tT]est") ~= nil or string.match(filename, "_test") ~= nil or string.match(filename, "spec") ~= nil
end
-- Make these functions available to snippets
_G.snippet_utils = {
get_comment_string = get_comment_string,
get_visual_selection = get_visual_selection,
date_format = date_format,
capture_match = capture_match,
is_test_file = is_test_file
}
${allSnippets}
'';
${snippets}
'';
};
}

View file

@ -1,9 +1,25 @@
{
plugins.treesitter = {
enable = true;
folding = true;
settings.highlight = {
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.languages.treesitter";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "treesitter";
};
config = mkIf cfg.enable {
plugins.treesitter = {
enable = true;
folding = true;
settings.highlight = {
enable = true;
};
};
};
}

View file

@ -1,7 +1,7 @@
{
{...} @ inputs: {
imports = [
./harpoon.nix
./nvim-tree.nix
./telescope.nix
(import ./harpoon.nix inputs)
(import ./nvim-tree.nix inputs)
(import ./telescope.nix inputs)
];
}

View file

@ -1,44 +1,60 @@
{
keymaps = [
{
mode = "n";
key = "<leader>a";
action.__raw = "function() require'harpoon':list():add() end";
}
{
mode = "n";
key = "<C-e>";
action.__raw = "function() require'harpoon'.ui:toggle_quick_menu(require'harpoon':list()) end";
}
{
mode = "n";
key = "<C-j>";
action.__raw = "function() require'harpoon':list():select(1) end";
}
{
mode = "n";
key = "<C-k>";
action.__raw = "function() require'harpoon':list():select(2) end";
}
{
mode = "n";
key = "<C-l>";
action.__raw = "function() require'harpoon':list():select(3) end";
}
{
mode = "n";
key = "<C-;>";
action.__raw = "function() require'harpoon':list():select(4) end";
}
];
plugins.harpoon = {
enable = true;
enableTelescope = true;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.navigation.harpoon";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "harpoon";
};
extraConfigLua = ''
local harpoon = require("harpoon")
harpoon:setup({ settings = { save_on_toggle = true }})
'';
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>a";
action.__raw = "function() require'harpoon':list():add() end";
}
{
mode = "n";
key = "<C-e>";
action.__raw = "function() require'harpoon'.ui:toggle_quick_menu(require'harpoon':list()) end";
}
{
mode = "n";
key = "<C-j>";
action.__raw = "function() require'harpoon':list():select(1) end";
}
{
mode = "n";
key = "<C-k>";
action.__raw = "function() require'harpoon':list():select(2) end";
}
{
mode = "n";
key = "<C-l>";
action.__raw = "function() require'harpoon':list():select(3) end";
}
{
mode = "n";
key = "<C-;>";
action.__raw = "function() require'harpoon':list():select(4) end";
}
];
plugins.harpoon = {
enable = true;
enableTelescope = true;
};
extraConfigLua = ''
local harpoon = require("harpoon")
harpoon:setup({ settings = { save_on_toggle = true }})
'';
};
}

View file

@ -1,75 +1,91 @@
{
keymaps = [
{
mode = "n";
key = "<leader>pv";
action = "<cmd>NvimTreeToggle<cr>";
options.desc = "Toggle NvimTree";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.navigation.nvim-tree";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "nvim-tree";
};
plugins.web-devicons.enable = true;
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>pv";
action = "<cmd>NvimTreeToggle<cr>";
options.desc = "Toggle NvimTree";
}
];
plugins.nvim-tree = {
enable = true;
plugins.web-devicons.enable = true;
disableNetrw = true;
hijackNetrw = true;
hijackCursor = true;
hijackUnnamedBufferWhenOpening = true;
syncRootWithCwd = true;
updateFocusedFile.enable = true;
sortBy = "case_sensitive";
filters = {
custom = ["__pycache__"];
exclude = [];
};
git = {
plugins.nvim-tree = {
enable = true;
ignore = true;
};
view = {
side = "right";
width = 60;
number = true;
relativenumber = true;
preserveWindowProportions = true;
};
disableNetrw = true;
hijackNetrw = true;
hijackCursor = true;
hijackUnnamedBufferWhenOpening = true;
syncRootWithCwd = true;
renderer = {
rootFolderLabel = false;
indentWidth = 2;
highlightGit = true;
indentMarkers.enable = true;
updateFocusedFile.enable = true;
groupEmpty = true;
sortBy = "case_sensitive";
icons.glyphs = {
default = "󰈚";
symlink = "";
folder = {
default = "";
empty = "";
emptyOpen = "";
open = "";
symlink = "";
symlinkOpen = "";
arrowOpen = "";
arrowClosed = "";
};
git = {
unstaged = "";
staged = "";
unmerged = "";
renamed = "";
untracked = "";
deleted = "";
ignored = "";
filters = {
custom = ["__pycache__"];
exclude = [];
};
git = {
enable = true;
ignore = true;
};
view = {
side = "right";
width = 60;
number = true;
relativenumber = true;
preserveWindowProportions = true;
};
renderer = {
rootFolderLabel = false;
indentWidth = 2;
highlightGit = true;
indentMarkers.enable = true;
groupEmpty = true;
icons.glyphs = {
default = "󰈚";
symlink = "";
folder = {
default = "";
empty = "";
emptyOpen = "";
open = "";
symlink = "";
symlinkOpen = "";
arrowOpen = "";
arrowClosed = "";
};
git = {
unstaged = "";
staged = "";
unmerged = "";
renamed = "";
untracked = "";
deleted = "";
ignored = "";
};
};
};
};

View file

@ -1,91 +1,107 @@
{
keymaps = [
{
mode = "n";
key = "<leader>pws";
action.__raw = ''
function()
local word = vim.fn.expand("<cword>")
require('telescope.builtin').grep_string({ search = word })
end
'';
options.desc = "Telescope Live grep word under cursor";
}
{
mode = "n";
key = "<leader>pWs";
action.__raw = ''
function()
local word = vim.fn.expand("cWORD")
require('telescope.builtin').grep_string({ search = word })
end
'';
options.desc = "Telecope Live grep WORD under cursor";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.navigation.telescope";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "telescope";
};
plugins.telescope = {
keymaps = {
"<leader>pf" = {
action = "find_files";
options.desc = "Telescope Find project files";
};
"<leader>pa" = {
action = "find_files follow=true no_ignore=true hidden=true";
options.desc = "Telescope Find all files";
};
"<leader>pz" = {
action = "current_buffer_fuzzy_find";
options.desc = "Telescope Find in buffer";
};
"<leader>ps" = {
action = "live_grep";
options.desc = "Telescope Live grep";
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>pws";
action.__raw = ''
function()
local word = vim.fn.expand("<cword>")
require('telescope.builtin').grep_string({ search = word })
end
'';
options.desc = "Telescope Live grep word under cursor";
}
{
mode = "n";
key = "<leader>pWs";
action.__raw = ''
function()
local word = vim.fn.expand("cWORD")
require('telescope.builtin').grep_string({ search = word })
end
'';
options.desc = "Telecope Live grep WORD under cursor";
}
];
plugins.telescope = {
keymaps = {
"<leader>pf" = {
action = "find_files";
options.desc = "Telescope Find project files";
};
"<leader>pa" = {
action = "find_files follow=true no_ignore=true hidden=true";
options.desc = "Telescope Find all files";
};
"<leader>pz" = {
action = "current_buffer_fuzzy_find";
options.desc = "Telescope Find in buffer";
};
"<leader>ps" = {
action = "live_grep";
options.desc = "Telescope Live grep";
};
"ws" = {
action = "lsp_document_symbols ignore_symbols='variable'";
options.desc = "Telescope LSP Document symbols";
};
"<leader>tt" = {
action = "diagnostics";
options.desc = "Telescope Diagnostics";
};
"<leader>tf" = {
action = "diagnostics bufnr=0";
options.desc = "Telescope Diagnostics in buffer";
};
"<leader>:" = {
action = "command_history";
options.desc = "Telescope Command history";
};
};
"ws" = {
action = "lsp_document_symbols ignore_symbols='variable'";
options.desc = "Telescope LSP Document symbols";
enable = true;
extensions = {
fzf-native.enable = true;
ui-select.settings.specific_opts.codeactions = true;
undo.enable = true;
};
"<leader>tt" = {
action = "diagnostics";
options.desc = "Telescope Diagnostics";
};
"<leader>tf" = {
action = "diagnostics bufnr=0";
options.desc = "Telescope Diagnostics in buffer";
};
settings = {
defaults = {
prompt_prefix = " ";
selection_caret = " ";
entry_prefix = " ";
"<leader>:" = {
action = "command_history";
options.desc = "Telescope Command history";
};
};
sorting_strategy = "ascending";
layout_config = {
horizontal = {
prompt_position = "top";
preview_width = 0.65;
};
enable = true;
extensions = {
fzf-native.enable = true;
ui-select.settings.specific_opts.codeactions = true;
undo.enable = true;
};
settings = {
defaults = {
prompt_prefix = " ";
selection_caret = " ";
entry_prefix = " ";
sorting_strategy = "ascending";
layout_config = {
horizontal = {
prompt_position = "top";
preview_width = 0.65;
width = 0.75;
height = 0.80;
};
width = 0.75;
height = 0.80;
};
};
};

View file

@ -1,74 +1,94 @@
{
plugins.alpha = {
enable = true;
theme = null;
layout = let
mkPadding = val: {
type = "padding";
inherit val;
};
mkButton = label: shortcut: command: {
type = "button";
val = label;
on_press.__raw = ''
function()
local key = vim.api.nvim_replace_termcodes("${shortcut}", true, false, true)
vim.api.nvim_feedkeys(key, "n", false)
end
'';
opts = {
keymap = [
"n"
shortcut
command
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = shortcut;
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
};
in [
(mkPadding 4)
{
opts = {
hl = "AlphaHeader";
position = "center";
};
type = "text";
val = [
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" git@github.com:c4patino "
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.ui.alpha";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "alpha";
};
config = mkIf cfg.enable {
plugins = {
persistence.enable = true;
alpha = {
enable = true;
theme = null;
layout = let
mkPadding = val: {
type = "padding";
inherit val;
};
mkButton = label: shortcut: command: {
type = "button";
val = label;
on_press.__raw = ''
function()
local key = vim.api.nvim_replace_termcodes("${shortcut}", true, false, true)
vim.api.nvim_feedkeys(key, "n", false)
end
'';
opts = {
keymap = [
"n"
shortcut
command
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = shortcut;
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
};
in [
(mkPadding 4)
{
opts = {
hl = "AlphaHeader";
position = "center";
};
type = "text";
val = [
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" git@github.com:c4patino "
];
}
(mkPadding 2)
(mkButton " Find File" "f" "<CMD>Telescope find_files<CR>")
(mkPadding 1)
(mkButton " New File" "n" "<CMD>ene <BAR> startinsert<CR>")
(mkPadding 1)
(mkButton "󰈚 Recent Files" "r" "<CMD>Telescope oldfiles<CR>")
(mkPadding 1)
(mkButton "󰈭 Find Word" "g" "<CMD>Telescope live_grep<CR>")
(mkPadding 1)
(mkButton " Restore Session" "s" "<CMD>lua require('persistence').load()<CR>")
(mkPadding 1)
(mkButton " Quit Neovim" "q" "<CMD>qa<CR>")
];
}
(mkPadding 2)
(mkButton " Find File" "f" "<CMD>Telescope find_files<CR>")
(mkPadding 1)
(mkButton " New File" "n" "<CMD>ene <BAR> startinsert<CR>")
(mkPadding 1)
(mkButton "󰈚 Recent Files" "r" "<CMD>Telescope oldfiles<CR>")
(mkPadding 1)
(mkButton "󰈭 Find Word" "g" "<CMD>Telescope live_grep<CR>")
(mkPadding 1)
(mkButton " Restore Session" "s" "<CMD>lua require('persistence').load()<CR>")
(mkPadding 1)
(mkButton " Quit Neovim" "q" "<CMD>qa<CR>")
];
};
};
};
}

View file

@ -1,11 +1,11 @@
{pkgs, ...}: {
{pkgs, ...} @ inputs: {
imports = [
./alpha.nix
./fidget.nix
./indent-blankline.nix
./lualine.nix
./noice.nix
./nvim-notify.nix
(import ./alpha.nix inputs)
(import ./fidget.nix inputs)
(import ./indent-blankline.nix inputs)
(import ./lualine.nix inputs)
(import ./noice.nix inputs)
(import ./nvim-notify.nix inputs)
];
colorschemes.tokyonight = {

View file

@ -1,96 +1,112 @@
{
plugins.fidget = {
enable = true;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.ui.fidget";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "fidget";
};
settings = {
logger = {
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
float_precision = 0.01; # Limit the number of decimals displayed for floats
};
progress = {
poll_rate = 0; # How and when to poll for progress messages
suppress_on_insert = true; # Suppress new messages while in insert mode
ignore_done_already = false; # Ignore new tasks that are already complete
ignore_empty_message = false; # Ignore new tasks that don't contain a message
# Clear notification group when LSP server detaches
clear_on_detach = ''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
'';
# How to get a progress message's notification group key
notification_group = ''
function(msg) return msg.lsp_client.name end
'';
ignore = []; # List of LSP servers to ignore
lsp = {
progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
};
display = {
render_limit = 16; # How many LSP messages to show at once
done_ttl = 3; # How long a message should persist after completion
done_icon = ""; # Icon shown when all LSP progress tasks are complete
done_style = "Constant"; # Highlight group for completed LSP tasks
progress_ttl.__raw = "math.huge"; # How long a message should persist when in progress
progress_icon = {
pattern = "dots";
period = 1;
}; # Icon shown when LSP progress tasks are in progress
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
group_style = "Title"; # Highlight group for group name (LSP server name)
icon_style = "Question"; # Highlight group for group icons
priority = 30; # Ordering priority for LSP notification group
skip_history = true; # Whether progress notifications should be omitted from history
format_message = ''
require ("fidget.progress.display").default_format_message
''; # How to format a progress message
format_annote = ''
function (msg) return msg.title end
''; # How to format a progress annotation
format_group_name = ''
function (group) return tostring (group) end
''; # How to format a progress notification group's name
overrides = {
rust_analyzer = {
name = "rust-analyzer";
};
}; # Override options from the default notification config
};
};
notification = {
poll_rate = 10; # How frequently to update and render notifications
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
history_size = 128; # Number of removed messages to retain in history
override_vim_notify = true;
config = mkIf cfg.enable {
plugins.fidget = {
enable = true;
redirect.__raw = ''
function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
settings = {
logger = {
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
float_precision = 0.01; # Limit the number of decimals displayed for floats
};
progress = {
poll_rate = 0; # How and when to poll for progress messages
suppress_on_insert = true; # Suppress new messages while in insert mode
ignore_done_already = false; # Ignore new tasks that are already complete
ignore_empty_message = false; # Ignore new tasks that don't contain a message
# Clear notification group when LSP server detaches
clear_on_detach = ''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
end
'';
configs.default.__raw = "require('fidget.notification').default_config";
window = {
normal_hl = "Comment";
winblend = 0;
border = "none"; # none, single, double, rounded, solid, shadow
zindex = 45;
max_width = 0;
max_height = 0;
x_padding = 1;
y_padding = 0;
align = "bottom";
relative = "editor";
'';
# How to get a progress message's notification group key
notification_group = ''
function(msg) return msg.lsp_client.name end
'';
ignore = []; # List of LSP servers to ignore
lsp = {
progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
};
display = {
render_limit = 16; # How many LSP messages to show at once
done_ttl = 3; # How long a message should persist after completion
done_icon = ""; # Icon shown when all LSP progress tasks are complete
done_style = "Constant"; # Highlight group for completed LSP tasks
progress_ttl.__raw = "math.huge"; # How long a message should persist when in progress
progress_icon = {
pattern = "dots";
period = 1;
}; # Icon shown when LSP progress tasks are in progress
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
group_style = "Title"; # Highlight group for group name (LSP server name)
icon_style = "Question"; # Highlight group for group icons
priority = 30; # Ordering priority for LSP notification group
skip_history = true; # Whether progress notifications should be omitted from history
format_message = ''
require ("fidget.progress.display").default_format_message
''; # How to format a progress message
format_annote = ''
function (msg) return msg.title end
''; # How to format a progress annotation
format_group_name = ''
function (group) return tostring (group) end
''; # How to format a progress notification group's name
overrides = {
rust_analyzer = {
name = "rust-analyzer";
};
}; # Override options from the default notification config
};
};
view = {
stack_upwards = true; # Display notification items from bottom to top
icon_separator = " "; # Separator between group name and icon
group_separator = "---"; # Separator between notification groups
group_separator_hl = "Comment"; # Highlight group used for group separator
notification = {
poll_rate = 10; # How frequently to update and render notifications
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
history_size = 128; # Number of removed messages to retain in history
override_vim_notify = true;
redirect.__raw = ''
function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end
'';
configs.default.__raw = "require('fidget.notification').default_config";
window = {
normal_hl = "Comment";
winblend = 0;
border = "none"; # none, single, double, rounded, solid, shadow
zindex = 45;
max_width = 0;
max_height = 0;
x_padding = 1;
y_padding = 0;
align = "bottom";
relative = "editor";
};
view = {
stack_upwards = true; # Display notification items from bottom to top
icon_separator = " "; # Separator between group name and icon
group_separator = "---"; # Separator between notification groups
group_separator_hl = "Comment"; # Highlight group used for group separator
};
};
};
};

View file

@ -1,6 +1,22 @@
{
plugins.indent-blankline = {
enable = true;
settings.scope.enabled = false;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.ui.indent-blankline";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "indent-blankline";
};
config = mkIf cfg.enable {
plugins.indent-blankline = {
enable = true;
settings.scope.enabled = false;
};
};
}

View file

@ -1,50 +1,66 @@
{
plugins.lualine = {
enable = true;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.ui.lualine";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "lualine";
};
settings = {
options = {
globalstatus = true;
always_divide_middle = true;
theme = "auto";
ignore_focus = ["nvim-tree"];
config = mkIf cfg.enable {
plugins.lualine = {
enable = true;
component_separators = {
left = "|";
right = "|";
settings = {
options = {
globalstatus = true;
always_divide_middle = true;
theme = "auto";
ignore_focus = ["nvim-tree"];
component_separators = {
left = "|";
right = "|";
};
};
};
extensions = ["fzf"];
extensions = ["fzf"];
sections = {
lualine_a = ["mode"];
lualine_b = [
{
__unkeyed = "branch";
icon = "";
icons_enabled = true;
}
"diff"
"diagnostics"
];
lualine_c = [
"filename"
{
__raw = ''
function()
local rec = vim.fn.reg_recording()
if rec ~= "" then
return " @" .. rec
end
return ""
end
'';
}
];
lualine_x = ["filetype"];
lualine_y = ["location"];
lualine_z = [''" " .. os.date("%R")''];
sections = {
lualine_a = ["mode"];
lualine_b = [
{
__unkeyed = "branch";
icon = "";
icons_enabled = true;
}
"diff"
"diagnostics"
];
lualine_c = [
"filename"
{
__raw = ''
function()
local rec = vim.fn.reg_recording()
if rec ~= "" then
return " @" .. rec
end
return ""
end
'';
}
];
lualine_x = ["filetype"];
lualine_y = ["location"];
lualine_z = [''" " .. os.date("%R")''];
};
};
};
};

View file

@ -1,33 +1,49 @@
{
plugins.noice = {
enable = true;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.ui.noice";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "noice";
};
settings = {
notify.enabled = false;
messages.enabled = true;
config = mkIf cfg.enable {
plugins.noice = {
enable = true;
lsp = {
message.enabled = true;
progress = {
enabled = false;
view = "mini";
settings = {
notify.enabled = false;
messages.enabled = true;
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";
popupmenu = {
enabled = true;
backend = "nui";
};
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";
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";
};
};
};
};

View file

@ -1,47 +1,63 @@
{
keymaps = [
{
mode = "n";
key = "<leader>un";
action = ''
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
'';
options = {desc = "Dismiss All Notifications";};
}
];
plugins.notify = {
enable = true;
settings = {
background_color = "#000000";
fps = 60;
render = "default";
timeout = 500;
top_down = false;
};
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.ui.nvim-notify";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "nvim-notify";
};
extraConfigLua = ''
local notify = require("notify")
local filtered_message = { "No information available" }
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>un";
action = ''
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
'';
options = {desc = "Dismiss All Notifications";};
}
];
-- 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 {})
plugins.notify = {
enable = true;
for _, msg in ipairs(filtered_message) do
if message == msg then
return
end
end
return notify(message, level, merged_opts)
end
'';
settings = {
background_color = "#000000";
fps = 60;
render = "default";
timeout = 500;
top_down = false;
};
};
extraConfigLua = ''
local notify = require("notify")
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
'';
};
}

View file

@ -1,16 +1,12 @@
{
{...} @ inputs: {
imports = [
./lazygit.nix
./obsidian.nix
./todo-comments.nix
./toggleterm.nix
./undotree.nix
./vimtex.nix
./zenmode.nix
(import ./lazygit.nix inputs)
(import ./obsidian.nix inputs)
(import ./todo-comments.nix inputs)
(import ./toggleterm.nix inputs)
(import ./undotree.nix inputs)
(import ./vimtex.nix inputs)
(import ./which-key.nix inputs)
(import ./zenmode.nix inputs)
];
plugins = {
persistence.enable = true;
which-key.enable = true;
};
}

View file

@ -1,14 +1,30 @@
{
keymaps = [
{
mode = "n";
key = "<leader>gg";
action = "<cmd>LazyGit<cr>";
options.desc = "LazyGit Toggle window";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.lazygit";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "lazygit";
};
plugins = {
lazygit.enable = true;
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>gg";
action = "<cmd>LazyGit<cr>";
options.desc = "LazyGit Toggle window";
}
];
plugins = {
lazygit.enable = true;
};
};
}

View file

@ -1,14 +1,30 @@
{
plugins = {
obsidian = {
enable = true;
settings = {
workspaces = [
{
name = "obsidian";
path = "~/Documents/obsidian";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.obsidian";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "obsidian";
};
config = mkIf cfg.enable {
plugins = {
obsidian = {
enable = true;
settings = {
workspaces = [
{
name = "obsidian";
path = "~/Documents/obsidian";
}
];
};
};
};
};

View file

@ -1,14 +1,30 @@
{
keymaps = [
{
mode = "n";
key = "<leader>tc";
action = "<cmd>TodoTelescope<cr>";
options.desc = "Telescope Find todo comments";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.todo-comments";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "todo-comments";
};
plugins = {
todo-comments.enable = true;
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>tc";
action = "<cmd>TodoTelescope<cr>";
options.desc = "Telescope Find todo comments";
}
];
plugins = {
todo-comments.enable = true;
};
};
}

View file

@ -1,14 +1,30 @@
{
plugins.toggleterm = {
enable = true;
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.toggleterm";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "toggleterm";
};
settings = {
open_mapping = "[[<A-i>]]";
config = mkIf cfg.enable {
plugins.toggleterm = {
enable = true;
direction = "float";
settings = {
open_mapping = "[[<A-i>]]";
float_opts.border = "curved";
winbar.enabled = true;
direction = "float";
float_opts.border = "curved";
winbar.enabled = true;
};
};
};
}

View file

@ -1,20 +1,36 @@
{
keymaps = [
{
mode = "n";
key = "<leader>u";
action = "<cmd>UndotreeToggle<cr>";
options.desc = "Undotree Toggle window";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.undotree";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "undotree";
};
plugins.undotree = {
enable = true;
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>u";
action = "<cmd>UndotreeToggle<cr>";
options.desc = "Undotree Toggle window";
}
];
settings = {
WindowLayout = 4;
DiffpaneHeight = 15;
SplitWidth = 40;
plugins.undotree = {
enable = true;
settings = {
WindowLayout = 4;
DiffpaneHeight = 15;
SplitWidth = 40;
};
};
};
}

View file

@ -1,10 +1,27 @@
{pkgs, ...}: {
plugins.vimtex = {
enable = true;
texlivePackage = pkgs.texliveFull;
{
config,
lib,
namespace,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.vimtex";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "vimtex";
};
settings = {
view_method = "zathura";
config = mkIf cfg.enable {
plugins.vimtex = {
enable = true;
texlivePackage = pkgs.texliveFull;
settings = {
view_method = "zathura";
};
};
};
}

View file

@ -0,0 +1,21 @@
{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.which-key";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "which-key";
};
config = mkIf cfg.enable {
plugins = {
which-key.enable = true;
};
};
}

View file

@ -1,14 +1,30 @@
{
keymaps = [
{
mode = "n";
key = "<leader>zz";
action = "<cmd>ZenMode<cr>";
}
];
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
base = "${namespace}.utils.zenmode";
cfg = getAttrByNamespace config base;
in {
options = mkOptionsWithNamespace base {
enable = mkEnableOption "zenmode";
};
plugins.zen-mode = {
enable = true;
settings.window.width = 150;
config = mkIf cfg.enable {
keymaps = [
{
mode = "n";
key = "<leader>zz";
action = "<cmd>ZenMode<cr>";
}
];
plugins.zen-mode = {
enable = true;
settings.window.width = 150;
};
};
}

View file

@ -19,22 +19,6 @@
system: let
namespace = "yumevim";
pkgs = import nixpkgs {inherit system;};
mergedLib = pkgs.lib.extend (final: prev: {${namespace} = import ./lib {lib = pkgs.lib;};});
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs;
module = import ./config;
extraSpecialArgs = {
lib = mergedLib.extend nixvim.lib.overlay;
namespace = namespace;
};
};
nvim = nixvim'.makeNixvimWithModule nixvimModule;
treefmtConfig = {...}: {
projectRootFile = "flake.nix";
programs = {
@ -42,13 +26,50 @@
};
};
treefmtEval = treefmt-nix.lib.evalModule pkgs (treefmtConfig {inherit pkgs;});
in {
checks = {
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
treefmt = treefmtEval.config.build.check self;
pkgs = import nixpkgs {inherit system;};
mergedLib = pkgs.lib.extend (final: prev: {${namespace} = import ./lib {lib = pkgs.lib;};});
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
mkNixvimProfile = custom: {
module = {
imports = [./config];
${namespace} = pkgs.lib.mkMerge [
{
bundles.common.enable = true;
}
custom
];
};
extraSpecialArgs = {
inherit namespace pkgs;
lib = mergedLib.extend nixvim.lib.overlay;
};
};
packages.default = nvim;
minimal = mkNixvimProfile {};
full = mkNixvimProfile {
languages = {
lsp.enable = true;
};
utils = {
obsidian.enable = true;
};
};
in {
checks = {
treefmt = treefmtEval.config.build.check self;
minimal = nixvimLib.check.mkTestDerivationFromNixvimModule minimal;
};
packages = {
default = nixvim'.makeNixvimWithModule minimal;
full = nixvim'.makeNixvimWithModule full;
};
}
);
}