mirror of
https://github.com/mitchell/dotfiles.git
synced 2025-12-17 12:27:22 +00:00
Breakup Neovim config into Lua modules
This commit is contained in:
parent
3179a5b48d
commit
1517f56c86
11 changed files with 662 additions and 584 deletions
105
.config/nvim/lua/plugins/editor.lua
Normal file
105
.config/nvim/lua/plugins/editor.lua
Normal 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 = { "pylint" },
|
||||
}
|
||||
|
||||
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 = { "black" },
|
||||
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 },
|
||||
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 },
|
||||
},
|
||||
},
|
||||
}
|
||||
70
.config/nvim/lua/plugins/lsp_completion.lua
Normal file
70
.config/nvim/lua/plugins/lsp_completion.lua
Normal 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,
|
||||
},
|
||||
}
|
||||
111
.config/nvim/lua/plugins/navigation.lua
Normal file
111
.config/nvim/lua/plugins/navigation.lua
Normal 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 toggle 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",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
69
.config/nvim/lua/plugins/tools.lua
Normal file
69
.config/nvim/lua/plugins/tools.lua
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
-- 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 = true } },
|
||||
strategies = {
|
||||
chat = { adapter = "gemini_deep" },
|
||||
inline = { adapter = "openai" },
|
||||
cmd = { adapter = "openai_mini" },
|
||||
},
|
||||
adapters = {
|
||||
anthro = function()
|
||||
return require("codecompanion.adapters").extend("anthropic", {
|
||||
schema = {
|
||||
model = { default = "claude-3-7-sonnet-20250219" },
|
||||
extended_thinking = { default = false },
|
||||
},
|
||||
})
|
||||
end,
|
||||
anthro_deep = function()
|
||||
return require("codecompanion.adapters").extend("anthropic", {
|
||||
schema = {
|
||||
model = { default = "claude-3-7-sonnet-20250219" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
gemini = function()
|
||||
return require("codecompanion.adapters").extend("gemini", {
|
||||
schema = {
|
||||
model = { default = "gemini-2.5-flash-preview-04-17" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
gemini_deep = function()
|
||||
return require("codecompanion.adapters").extend("gemini", {
|
||||
schema = {
|
||||
model = { default = "gemini-2.5-pro-preview-05-06" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
openai_mini = function()
|
||||
return require("codecompanion.adapters").extend("openai", {
|
||||
schema = {
|
||||
model = { default = "gpt-4.1-mini" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
openai_deep = function()
|
||||
return require("codecompanion.adapters").extend("openai", {
|
||||
schema = {
|
||||
model = { default = "o4-mini-2025-04-16" },
|
||||
reasoning_effort = { default = "high" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>c", "<cmd>CodeCompanionChat<cr>", desc = "CodeCompanion Chat", silent = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
60
.config/nvim/lua/plugins/treesitter.lua
Normal file
60
.config/nvim/lua/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
-- lua/plugins/treesitter.lua
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"cpp",
|
||||
"lua",
|
||||
"vim",
|
||||
"regex",
|
||||
"bash",
|
||||
"fish",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"tsx",
|
||||
"go",
|
||||
"elixir",
|
||||
"vue",
|
||||
"groovy",
|
||||
"java",
|
||||
"objc",
|
||||
"swift",
|
||||
"hcl",
|
||||
"terraform",
|
||||
"yaml",
|
||||
"json",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
auto_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "gnn",
|
||||
node_incremental = "grn",
|
||||
scope_incremental = "grc",
|
||||
node_decremental = "grm",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.opt.foldenable = false
|
||||
end,
|
||||
config = function(plugin, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
90
.config/nvim/lua/plugins/ui.lua
Normal file
90
.config/nvim/lua/plugins/ui.lua
Normal 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 = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue