Move nvim config into nvim/ subdirectory
Prepare repo structure for storing multiple dotfile configs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
19
nvim/lua/plugins/bufferline.lua
Normal file
19
nvim/lua/plugins/bufferline.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
lazy = false,
|
||||
opts = {
|
||||
options = {
|
||||
diagnostics = "nvim_lsp",
|
||||
offsets = {
|
||||
{ filetype = "neo-tree", text = "Explorer", separator = true },
|
||||
},
|
||||
show_close_icon = false,
|
||||
separator_style = "thin",
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>bp", "<cmd>BufferLineTogglePin<cr>", desc = "Pin buffer" },
|
||||
{ "<leader>bo", "<cmd>BufferLineCloseOthers<cr>", desc = "Close other buffers" },
|
||||
},
|
||||
}
|
||||
55
nvim/lua/plugins/cmp.lua
Normal file
55
nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
}
|
||||
8
nvim/lua/plugins/colorscheme.lua
Normal file
8
nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"p00f/alabaster.nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.o.background = "light"
|
||||
vim.cmd.colorscheme("alabaster")
|
||||
end,
|
||||
}
|
||||
65
nvim/lua/plugins/editor.lua
Normal file
65
nvim/lua/plugins/editor.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
return {
|
||||
-- Autopairs
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Comment toggling
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
keys = {
|
||||
{ "gcc", mode = "n", desc = "Toggle comment" },
|
||||
{ "gc", mode = "v", desc = "Toggle comment" },
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- TODO comments
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>ft", "<cmd>TodoTelescope<cr>", desc = "Find TODOs" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Which-key: shows keybinding hints
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- File explorer
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>n", "<cmd>Neotree toggle<cr>", desc = "Toggle file explorer" },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true,
|
||||
hide_dotfiles = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Crates.nvim for Cargo.toml
|
||||
{
|
||||
"saecki/crates.nvim",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
28
nvim/lua/plugins/git.lua
Normal file
28
nvim/lua/plugins/git.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
local map = function(mode, l, r, desc)
|
||||
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
map("n", "]h", gs.next_hunk, "Next hunk")
|
||||
map("n", "[h", gs.prev_hunk, "Previous hunk")
|
||||
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
|
||||
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
|
||||
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
|
||||
map("n", "<leader>hb", function() gs.blame_line({ full = true }) end, "Blame line")
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
keys = {
|
||||
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
},
|
||||
}
|
||||
57
nvim/lua/plugins/lsp.lua
Normal file
57
nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"ts_ls",
|
||||
"clangd",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- LSP keymaps on attach
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(ev)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set("n", keys, func, { buffer = ev.buf, desc = desc })
|
||||
end
|
||||
map("gd", vim.lsp.buf.definition, "Go to definition")
|
||||
map("gD", vim.lsp.buf.declaration, "Go to declaration")
|
||||
map("gr", vim.lsp.buf.references, "Go to references")
|
||||
map("gi", vim.lsp.buf.implementation, "Go to implementation")
|
||||
map("K", vim.lsp.buf.hover, "Hover documentation")
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "Code action")
|
||||
map("<leader>rn", vim.lsp.buf.rename, "Rename symbol")
|
||||
map("<leader>fs", "<cmd>Telescope lsp_document_symbols<cr>", "Document symbols")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Configure servers using vim.lsp.config (Neovim 0.11+)
|
||||
vim.lsp.config("ts_ls", { capabilities = capabilities })
|
||||
vim.lsp.config("clangd", { capabilities = capabilities })
|
||||
vim.lsp.config("zls", { capabilities = capabilities })
|
||||
|
||||
-- Enable servers
|
||||
vim.lsp.enable({ "ts_ls", "clangd", "zls" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- Rust gets its own dedicated plugin
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^5",
|
||||
lazy = false,
|
||||
},
|
||||
}
|
||||
19
nvim/lua/plugins/lualine.lua
Normal file
19
nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
options = {
|
||||
theme = "auto",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { { "filename", path = 1 } },
|
||||
lualine_x = { "encoding", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
}
|
||||
10
nvim/lua/plugins/session.lua
Normal file
10
nvim/lua/plugins/session.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre",
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>qs", function() require("persistence").load() end, desc = "Restore session" },
|
||||
{ "<leader>ql", function() require("persistence").load({ last = true }) end, desc = "Restore last session" },
|
||||
{ "<leader>qd", function() require("persistence").stop() end, desc = "Stop session saving" },
|
||||
},
|
||||
}
|
||||
25
nvim/lua/plugins/telescope.lua
Normal file
25
nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" },
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help tags" },
|
||||
{ "<leader>fd", "<cmd>Telescope diagnostics<cr>", desc = "Diagnostics" },
|
||||
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent files" },
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
file_ignore_patterns = { "node_modules", ".git/", "target/" },
|
||||
},
|
||||
})
|
||||
telescope.load_extension("fzf")
|
||||
end,
|
||||
}
|
||||
5
nvim/lua/plugins/treesitter.lua
Normal file
5
nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
lazy = false,
|
||||
}
|
||||
Reference in New Issue
Block a user