Attempt to refactor config to be more maintainable

This commit is contained in:
2025-12-22 17:08:53 +00:00
parent 7125fd8858
commit baf431168a
13 changed files with 223 additions and 184 deletions

View File

@@ -1,15 +1,13 @@
return { -- General programming utilities go here
-- Tools for configuration and plugin development
{
"klen/nvim-config-local",
lazy = false, -- Load immediately to ensure it catches the initial working directory
return {
{ -- Autoformat
"stevearc/conform.nvim",
event = "VimEnter",
opts = {
config_files = { ".nvim.lua", ".nvimrc", ".exrc" },
hashfile = vim.fn.stdpath("data") .. "/config-local",
autocommands_create = true,
commands_create = true,
silent = false,
lookup_parents = true,
notify_on_error = false,
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
},
},
{
@@ -22,60 +20,6 @@ return { -- General programming utilities go here
},
},
},
-- Privilege escalation plugin
{ "lambdalisue/suda.vim", event = "VeryLazy" },
{
"folke/trouble.nvim",
cmd = { "Trouble" },
opts = {
modes = {
lsp = {
win = { position = "right" },
},
},
},
keys = require("config.keys").trouble,
},
{
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
event = "VimEnter",
dependencies = { "nvim-lua/plenary.nvim" },
keys = require("config.keys").todo_comments,
},
{
"lewis6991/gitsigns.nvim",
event = "VimEnter",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
})
end,
keys = require("config.keys").gitsigns,
},
{ -- Oil is a very nice buffer-based filetree editor
"stevearc/oil.nvim",
event = "VeryLazy",
opts = {},
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = require("config.keys").oil,
},
{ -- Harpoon, because i keep losing track of my markers
"theprimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("harpoon"):setup({})
end,
keys = require("config.keys").harpoon,
},
{ -- Package and devenv plugins
"danymat/neogen",
event = "VimEnter",
@@ -94,27 +38,37 @@ return { -- General programming utilities go here
end,
keys = require("config.keys").neogen,
},
{ -- Autoformat
"stevearc/conform.nvim",
event = "VimEnter",
opts = {
notify_on_error = false,
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
formatters_by_ft = {
lua = { "stylua" },
nix = { "alejandra" },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use a sub-list to tell conform to run *until* a formatter
-- is found.
-- javascript = { { "prettierd", "prettier" } },
},
{ -- A plugin to integrate tests is helpful, so i'm adding neotest
"nvim-neotest/neotest",
event = "VeryLazy",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
},
},
{ -- Tools for configuration and plugin development
"klen/nvim-config-local",
lazy = false, -- Load immediately to ensure it catches the initial working directory
opts = {
config_files = { ".nvim.lua", ".nvimrc", ".exrc" },
hashfile = vim.fn.stdpath("data") .. "/config-local",
autocommands_create = true,
commands_create = true,
silent = false,
lookup_parents = true,
},
},
{ -- Add Overseer as a task running tool
"stevearc/overseer.nvim",
event = "VeryLazy",
opts = {},
config = function()
require("overseer").setup()
end,
keys = require("config.keys").overseer,
},
{ -- Highlight, edit, and navigate code
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
@@ -132,30 +86,4 @@ return { -- General programming utilities go here
{ "nushell/tree-sitter-nu", build = ":TSUpdate nu" },
},
},
{ -- Undo tree
"mbbill/undotree",
event = "VeryLazy",
keys = require("config.keys").undotree,
},
{ -- Add Overseer as a task running tool
"stevearc/overseer.nvim",
event = "VeryLazy",
opts = {},
config = function()
require("overseer").setup()
end,
keys = require("config.keys").overseer,
},
{ -- A plugin to integrate tests is helpful, so i'm adding neotest
"nvim-neotest/neotest",
event = "VeryLazy",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
},
},
-- Rust tools like inlay hints are absolutely essential
{ "mrcjkb/rustaceanvim", version = "^6", lazy = false },
}

3
lua/plugins/command.lua Normal file
View File

@@ -0,0 +1,3 @@
return {
{ "lambdalisue/suda.vim", event = "VeryLazy" }, -- Privilege escalation plugin
}

108
lua/plugins/editor.lua Normal file
View File

@@ -0,0 +1,108 @@
return {
{
"lewis6991/gitsigns.nvim",
event = "VimEnter",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
})
end,
keys = require("config.keys").gitsigns,
},
{ -- Harpoon, because i keep losing track of my markers
"theprimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("harpoon"):setup({})
end,
keys = require("config.keys").harpoon,
},
{ -- Definitely need to add a plugin for quickly making notes in obsidian
"epwalsh/obsidian.nvim",
version = "*",
cmd = "Obsidian",
event = "VeryLazy",
cond = function()
return vim.fn.executable("obsidian") == 1
end,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
opts = function()
local target_path = vim.fn.expand("~/Documents/Work_Notes/")
local workspaces = {}
if vim.fn.isdirectory(target_path) == 1 then
table.insert(workspaces, {
name = "work",
path = target_path,
})
end
if #workspaces == 0 then
local fallback_path = vim.fn.stdpath("data") .. "/obsidian_fallback"
if vim.fn.isdirectory(fallback_path) == 0 then
vim.fn.mkdir(fallback_path, "p")
end
table.insert(workspaces, {
name = "fallback",
path = fallback_path,
})
vim.notify(
"Obsidian: 'Work_Notes' not found. Using fallback path.",
vim.log.levels.WARN
)
end
return {
workspaces = workspaces,
completion = {
min_chars = 2,
},
}
end,
},
{ -- Oil is a very nice buffer-based filetree editor
"stevearc/oil.nvim",
event = "VeryLazy",
opts = {},
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = require("config.keys").oil,
},
{
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
event = "VimEnter",
dependencies = { "nvim-lua/plenary.nvim" },
keys = require("config.keys").todo_comments,
},
{
"folke/trouble.nvim",
cmd = { "Trouble" },
opts = {
modes = {
lsp = {
win = { position = "right" },
},
},
},
keys = require("config.keys").trouble,
},
{ -- Undo tree
"mbbill/undotree",
event = "VeryLazy",
keys = require("config.keys").undotree,
},
}

View File

@@ -1,72 +0,0 @@
return { -- Non programming quality of life utilities go here
{ -- Definitely need to add a plugin for quickly making notes in obsidian
"epwalsh/obsidian.nvim",
version = "*",
cmd = "Obsidian",
event = "VeryLazy",
cond = function()
return vim.fn.executable("obsidian") == 1
end,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
opts = function()
local target_path = vim.fn.expand("~/Documents/Work_Notes/")
local workspaces = {}
if vim.fn.isdirectory(target_path) == 1 then
table.insert(workspaces, {
name = "work",
path = target_path,
})
end
if #workspaces == 0 then
local fallback_path = vim.fn.stdpath("data") .. "/obsidian_fallback"
if vim.fn.isdirectory(fallback_path) == 0 then
vim.fn.mkdir(fallback_path, "p")
end
table.insert(workspaces, {
name = "fallback",
path = fallback_path,
})
vim.notify(
"Obsidian: 'Work_Notes' not found. Using fallback path.",
vim.log.levels.WARN
)
end
return {
workspaces = workspaces,
completion = {
min_chars = 2,
},
}
end,
},
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {},
ft = "markdown",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"echasnovski/mini.nvim",
"nvim-tree/nvim-web-devicons",
},
---@module 'render-markdown'
---@type render.md.UserConfig
},
{ -- A cheatsheet will always be useful until im a bit more familiar with vim
"sudormrfbin/cheatsheet.nvim",
event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
},
},
}

View File

@@ -0,0 +1,3 @@
return {
{ "fladson/vim-kitty", ft = "kitty" },
}

10
lua/plugins/lang/lua.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
lua = { "stylua" },
},
},
},
}

View File

@@ -0,0 +1,14 @@
return {
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {},
ft = "markdown",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"echasnovski/mini.nvim",
"nvim-tree/nvim-web-devicons",
},
---@module 'render-markdown'
---@type render.md.UserConfig
},
}

10
lua/plugins/lang/nix.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
nix = { "alejandra" },
},
},
},
}

View File

@@ -0,0 +1,21 @@
return {
{
"benomahony/uv.nvim",
ft = { "python" },
dependencies = {
"folke/snacks.nvim",
"nvim-telescope/telescope.nvim",
},
opts = {
picker_integration = true,
},
},
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
python = { "ruff" },
},
},
},
}

View File

@@ -0,0 +1,4 @@
return {
-- Analysis and inlay hints are absolutely essential
{ "mrcjkb/rustaceanvim", version = "^6", lazy = false },
}

View File

@@ -0,0 +1,3 @@
return {
{ "scallop-lang/vim-scallop", ft = "scallop" },
}

View File

@@ -56,6 +56,4 @@ return {
})
end,
},
{ "fladson/vim-kitty", ft = "kitty" },
{ "scallop-lang/vim-scallop", ft = "scallop" },
}

View File

@@ -7,6 +7,15 @@ return { -- UI components and other visual elements are declared here
vim.cmd.colorscheme("tokyonight-night")
end,
},
{ -- A cheatsheet will always be useful until im a bit more familiar with vim
"sudormrfbin/cheatsheet.nvim",
event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
},
},
{ "MunifTanjim/nui.nvim", lazy = true },
{ -- Useful plugin to show you pending keybinds.
"folke/which-key.nvim",