refactor: reorganize into packages for modular use

This commit is contained in:
mitchell 2026-06-18 19:12:02 -04:00
parent e33c60c7aa
commit fd32e1431c
57 changed files with 0 additions and 66 deletions

View file

@ -0,0 +1,37 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Set leader key before lazy setup
vim.g.mapleader = ","
-- Plugin specifications
require("lazy").setup({
install = { colorscheme = { "kanagawa" } },
spec = {
{ import = "plugins.ui" },
{ import = "plugins.editor" },
{ import = "plugins.lsp_completion" },
{ import = "plugins.navigation" },
{ import = "plugins.treesitter" },
{ import = "plugins.tools" },
},
})
-- Load core configurations
require("core.options")
require("core.keymaps")
require("core.autocmds")

View file

@ -0,0 +1,30 @@
{
"ale": { "branch": "master", "commit": "c59c0d1a573a7b2fe491f78af4f2033bde454753" },
"blink.cmp": { "branch": "main", "commit": "729d023bb9870a55e1b309a12d5c503fb800a7e8" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"codecompanion.nvim": { "branch": "main", "commit": "7d7957c26d33a97085d3a0c82eeb0147a0f51314" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"markview.nvim": { "branch": "main", "commit": "e27dee8b2a61f89ac3a06deae0264ad1d3f7b62c" },
"mini.diff": { "branch": "main", "commit": "9bccf260cdb9308223f47a29fb4cb91c817a9349" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lspconfig": { "branch": "master", "commit": "99d3a0f26bfe402f45257c1398287aef252cbe2d" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
"telescope.nvim": { "branch": "master", "commit": "7525ee9763f1f05ef39cd58cf04793884c2cec50" },
"tmuxline.vim": { "branch": "master", "commit": "4119c553923212cc67f4e135e6f946dc3ec0a4d6" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"vim-eunuch": { "branch": "master", "commit": "e86bb794a1c10a2edac130feb0ea590a00d03f1e" },
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
"vim-pencil": { "branch": "master", "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
}

View file

@ -0,0 +1,28 @@
-- lua/core/autocmds.lua
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
-- Fish filetype settings
augroup("FishSettings", { clear = true })
autocmd("FileType", {
pattern = "fish",
command = "setlocal tabstop=4",
group = "FishSettings",
})
-- Terminal settings
augroup("TerminalSettings", { clear = true })
autocmd("TermOpen", {
pattern = "*",
command = "setlocal nonumber norelativenumber",
group = "TerminalSettings",
})
-- Yaml settings
augroup("YamlSettings", { clear = true })
autocmd("FileType", {
pattern = "y*ml",
command = "setlocal foldenable foldlevel=1",
group = "YamlSettings",
})

View file

@ -0,0 +1,30 @@
-- lua/core/keymaps.lua
local map = vim.keymap.set
local map_opts_silent = { noremap = true, silent = true }
-- General Mappings
map("i", "jj", "<Esc>", { noremap = true, silent = true, desc = "Escape Insert Mode" })
-- map("t", "<Esc>", "<C-\\><C-n>", { noremap = true, silent = true, desc = "Escape Terminal Mode" })
map("v", "//", function()
vim.cmd("normal! y")
local sel = vim.fn.getreg('"')
local pattern = vim.fn.escape(sel, "/\\")
vim.fn.setreg("/", "\\V" .. pattern)
vim.cmd("normal! n")
end, { noremap = true, silent = true, desc = "Search for Visual Selection" })
-- LSP Diagnostic Mappings
local diag_opts = { silent = true, noremap = true }
map("n", "<leader>d", vim.diagnostic.open_float, diag_opts)
map("n", "[d", function()
vim.diagnostic.jump({ count = -1 })
end, diag_opts)
map("n", "]d", function()
vim.diagnostic.jump({ count = 1 })
end, diag_opts)
map("n", "<space>q", vim.diagnostic.setloclist, diag_opts)
-- Noice
map("n", "<leader>o", "<cmd>NoiceDismiss<cr>", { silent = true, noremap = true })
map("n", "<leader>O", "<cmd>NoiceDisable<cr>", { silent = true, noremap = true })

View file

@ -0,0 +1,28 @@
-- lua/core/options.lua
vim.opt.guifont = "JetBrainsMono Nerd Font:h13"
vim.opt.colorcolumn = "100"
vim.opt.cursorline = true
vim.opt.showmatch = true
vim.opt.number = true
vim.opt.showmode = false
vim.opt.background = "dark"
vim.opt.wrap = false
vim.opt.cmdheight = 1
vim.opt.shortmess:append("c")
vim.opt.termguicolors = true
vim.opt.mouse = "a"
vim.opt.mousemodel = "extend"
vim.opt.tabstop = 2
vim.opt.shiftwidth = 0
vim.opt.expandtab = true
vim.opt.textwidth = 100
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
if vim.g.neovide then
vim.g.neovide_scale_factor = 0.75
vim.g.neovide_transparency = 0.7
vim.g.neovide_cursor_vfx_mode = "sonicboom"
end

View file

@ -0,0 +1,105 @@
-- lua/plugins/editor.lua
return {
"tpope/vim-fugitive",
"tpope/vim-eunuch",
"tpope/vim-surround",
{
"w0rp/ale",
event = "VeryLazy",
keys = {
{ "<leader>f", "<cmd>ALEFix<cr>", desc = "ALE Fix", silent = true },
{ "<leader>a", "<cmd>ALEToggle<cr>", desc = "ALE Toggle", silent = true },
},
config = function()
vim.g.ale_linters_explicit = 1
vim.g.ale_completion_enabled = 0 -- Using blink.cmp for completion
vim.g.ale_linters = {
javascript = { "eslint", "stylelint", "biome" },
typescript = { "eslint", "stylelint", "biome" },
javascriptreact = { "eslint", "stylelint", "biome" },
typescriptreact = { "eslint", "stylelint", "biome" },
svelte = { "eslint" },
go = { "golint", "go vet" },
vue = { "eslint", "stylelint", "biome" },
make = { "checkmake" },
proto = { "protoc-gen-lint" },
dockerfile = { "hadolint" },
dart = { "dartanalyzer" },
fish = { "fish" },
vim = { "vint" },
elixir = { "credo" },
cs = { "OmniSharp" },
terraform = { "tflint" },
ruby = { "rubocop" },
css = { "stylelint", "biome" },
sh = { "shellcheck" },
python = { "ruff" },
}
vim.g.ale_fixers = {
go = { "goimports", "remove_trailing_lines", "trim_whitespace" },
graphql = { "prettier" },
javascript = { "prettier", "biome" },
typescript = { "prettier", "biome" },
javascriptreact = { "prettier", "biome" },
typescriptreact = { "prettier", "biome" },
svelte = { "prettier" },
vue = { "prettier", "biome" },
css = { "prettier", "biome" },
yaml = { "prettier", "biome" },
json = { "prettier", "biome" },
dart = { "dartfmt" },
html = { "prettier", "biome" },
markdown = { "prettier", "biome" },
make = { "remove_trailing_lines", "trim_whitespace" },
elixir = { "mix_format" },
terraform = { "terraform" },
ruby = { "rubocop" },
python = { "ruff", "ruff_format" },
lua = { "stylua" },
}
end,
},
{
"echasnovski/mini.diff",
version = false,
lazy = false,
opts = {},
keys = {
{
"<leader>i",
function()
require("mini.diff").toggle_overlay()
end,
desc = "Mini.diff overlay",
silent = true,
},
},
},
{
"reedes/vim-pencil",
cmd = { "HardPencil", "SoftPencil" },
config = function()
vim.g["pencil#map#suspend_af"] = "K"
end,
},
{
"folke/zen-mode.nvim",
opts = {
window = { backdrop = 0.95, options = { number = false } },
plugins = { twilight = { enabled = false } },
},
keys = {
{ "<leader>z", "<cmd>ZenMode<cr>", desc = "Zen Mode", silent = true },
},
},
{
"folke/twilight.nvim",
opts = {},
keys = {
{ "<leader>l", "<cmd>Twilight<cr>", desc = "Twilight", silent = true },
},
},
}

View file

@ -0,0 +1,70 @@
-- lua/plugins/lsp_completion.lua
return {
{
"saghen/blink.cmp",
dependencies = { "rafamadriz/friendly-snippets" },
version = "1.*",
opts = {},
opts_extend = { "sources.default" },
},
{
"neovim/nvim-lspconfig",
dependencies = { "saghen/blink.cmp" },
config = function()
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
local bufopts = { silent = true, buffer = bufnr }
vim.keymap.set("n", "<leader>h", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set("n", "<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set("n", "<leader>m", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<leader>F", function()
vim.lsp.buf.format({ async = true })
end, bufopts)
end
local capabilities = require("blink.cmp").get_lsp_capabilities()
local lsp_flags = { debounce_text_changes = 150 }
local vue_plugin_location = vim.fn.expand("$HOME/.bun/install/global/node_modules/@vue/typescript-plugin")
vim.lsp.config("ts_ls", {
on_attach = on_attach,
capabilities = capabilities,
flags = lsp_flags,
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact", "vue" },
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = vue_plugin_location,
languages = { "javascript", "typescript", "vue" },
},
},
},
})
vim.lsp.enable("ts_ls")
require("lspconfig").volar.setup({
on_attach = on_attach,
capabilities = capabilities,
})
local servers = { "elixirls", "gopls", "pylsp", "svelte" }
for _, server_name in ipairs(servers) do
vim.lsp.config(server_name, {
on_attach = on_attach,
capabilities = capabilities,
flags = lsp_flags,
})
vim.lsp.enable(server_name)
end
end,
},
}

View file

@ -0,0 +1,111 @@
-- lua/plugins/navigation.lua
return {
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
lazy = false,
opts = {},
keys = {
{
"<leader>nn",
"<cmd>Neotree left reveal_force_cwd<cr>",
desc = "Neo-tree Toggle Sidebar",
silent = true,
},
{
"<leader>nf",
"<cmd>Neotree float reveal_force_cwd<cr>",
desc = "Neo-tree Float",
silent = true,
},
},
},
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
},
opts = {},
keys = {
{ "<leader>t", "<cmd>Telescope<cr>", desc = "Telescope", silent = true },
{ "<leader>p", "<cmd>Telescope git_files<cr>", desc = "Telescope Git Files", silent = true },
{ "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Telescope Find Files", silent = true },
{ "<leader>s", "<cmd>Telescope treesitter<cr>", desc = "Telescope Treesitter", silent = true },
{ "<leader>gs", "<cmd>Telescope grep_string<cr>", desc = "Telescope Grep String", silent = true },
{ "<leader>gl", "<cmd>Telescope live_grep<cr>", desc = "Telescope Grep String", silent = true },
{ "<leader>gg", "<cmd>Telescope lsp_definitions<cr>", desc = "LSP Definitions", silent = true },
{ "<leader>gr", "<cmd>Telescope lsp_references<cr>", desc = "LSP References", silent = true },
{ "<leader>gi", "<cmd>Telescope lsp_implementations<cr>", desc = "LSP Implementations", silent = true },
{
"<leader>gd",
"<cmd>Telescope lsp_type_definitions<cr>",
desc = "LSP Type Definitions",
silent = true,
},
},
},
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
dependencies = {
"nvim-telescope/telescope.nvim",
},
config = function()
require("telescope").load_extension("fzf")
end,
},
{
"folke/flash.nvim",
event = "VeryLazy",
opts = {},
keys = {
{
"s",
mode = { "n", "x", "o" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"S",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
},
}

View file

@ -0,0 +1,114 @@
-- lua/plugins/tools.lua
return {
{
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"echasnovski/mini.diff",
},
opts = {
display = {
diff = { provider = "mini_diff" },
chat = {
show_settings = false,
window = { position = "right", opts = { number = false } },
},
},
rules = {
opts = {
chat = {
enabled = false,
},
},
},
interactions = {
chat = {
adapter = { name = "opencode", model = "llama.cpp/qwen3.6-35b-a3b-dev" },
-- opts = {
-- system_prompt = "",
-- },
-- tools = {
-- opts = {
-- system_prompt = {
-- enabled = true, -- Enable the tools system prompt?
-- replace_main_system_prompt = true, -- Replace the main system prompt with the tools system prompt?
-- },
-- },
-- },
},
inline = {
adapter = { name = "llama.cpp", model = "qwen3.6-35b-a3b-dev" },
},
cmd = {
adapter = { name = "llama.cpp", model = "qwen3.6-35b-a3b-dev" },
},
cli = {
agent = "opencode",
agents = {
opencode = {
cmd = "opencode",
args = {},
description = "OpenCode CLI",
},
},
opts = {
auto_insert = true, -- Enter insert mode when focusing the CLI terminal
reload = true, -- Reload buffers when an agent modifies files on disk
},
},
},
adapters = {
http = {
["llama.cpp"] = function()
return require("codecompanion.adapters").extend("openai_compatible", {
schema = {
model = {
default = "qwen3.6-35b-a3b-dev",
},
},
env = {
url = "http://127.0.0.1:8080", -- replace with your llama.cpp instance
api_key = "TERM",
chat_url = "/v1/chat/completions",
},
handlers = {
parse_message_meta = function(self, data)
local extra = data.extra
if extra and extra.reasoning_content then
data.output.reasoning = { content = extra.reasoning_content }
if data.output.content == "" then
data.output.content = nil
end
end
return data
end,
},
})
end,
},
},
},
keys = {
{ "<leader>cc", "<cmd>CodeCompanionChat<cr>", desc = "CodeCompanion Chat", silent = true },
{
"<leader>ca",
"<cmd>CodeCompanionChat Add<cr>",
mode = { "v" },
desc = "CodeCompanion Chat Add",
silent = true,
},
{ "<leader>cp", "<cmd>CodeCompanionActions<cr>", desc = "CodeCompanion Actions", silent = true },
{
"<leader>cl",
"<cmd>CodeCompanionCLI<cr>",
mode = { "n", "v" },
desc = "CodeCompanion CLI",
silent = true,
},
{ "<leader>ck", "<cmd>CodeCompanionCLI Ask<cr>", mode = { "n", "v" }, desc = "CodeCompanion CLI Ask" },
{ "<leader>ci", ":CodeCompanion<space>", mode = { "n", "v" }, desc = "CodeCompanion Inline" },
},
},
}

View file

@ -0,0 +1,51 @@
-- lua/plugins/treesitter.lua
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
lazy = false,
init = function()
local langs = {
"c",
"lua",
"vim",
"vimdoc",
"query",
"markdown",
"markdown_inline",
"regex",
"bash",
"fish",
"typescript",
"javascript",
"tsx",
"svelte",
"go",
"elixir",
"vue",
"hcl",
"terraform",
"yaml",
"json",
"java",
"kotlin",
"python",
}
require("nvim-treesitter").install(langs)
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.foldmethod = "expr"
vim.opt.foldenable = false
table.insert(langs, "javascriptreact")
table.insert(langs, "typescriptreact")
vim.api.nvim_create_autocmd("FileType", {
pattern = langs,
callback = function()
vim.treesitter.start()
end,
})
end,
},
}

View file

@ -0,0 +1,90 @@
-- lua/plugins/ui.lua
return {
"edkolev/tmuxline.vim",
{
"rebelot/kanagawa.nvim",
lazy = false,
priority = 1000,
opts = { transparent = not vim.g.neovide },
init = function()
vim.cmd([[colorscheme kanagawa]])
end,
},
{
"akinsho/bufferline.nvim",
event = "VeryLazy",
version = "*",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
options = {
separator_style = "slope",
offsets = {
{
filetype = "neo-tree",
text = "explorer",
highlight = "Directory",
separator = true,
},
},
},
},
keys = {
{ "<leader>j", "<cmd>BufferLinePick<cr>", desc = "BufferLinePick", silent = true },
{ "<leader>J", "<cmd>BufferLinePickClose<cr>", desc = "BufferLinePickClose", silent = true },
},
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
extensions = {
"neo-tree",
"symbols-outline",
},
},
},
{
"rcarriga/nvim-notify",
opts = {
background_colour = "#000000",
},
},
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" },
opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
},
views = {
notify = {
replace = true,
merge = true,
},
},
},
},
{
"OXY2DEV/markview.nvim",
lazy = false,
dependencies = { "saghen/blink.cmp" },
opts = {
preview = {
icon_provider = "devicons",
filetypes = { "markdown", "codecompanion" },
ignore_buftypes = {},
},
},
},
}