diff --git a/after/ftplugin/go.lua b/after/ftplugin/go.lua new file mode 100644 index 0000000..345d732 --- /dev/null +++ b/after/ftplugin/go.lua @@ -0,0 +1,2 @@ +vim.opt_local.expandtab = false +vim.opt_local.tabstop = 4 diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua new file mode 100644 index 0000000..3aec42b --- /dev/null +++ b/after/ftplugin/lua.lua @@ -0,0 +1,2 @@ +vim.opt_local.tabstop = 4 +vim.opt_local.shiftwidth = 4 diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 0000000..ca04c23 --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,3 @@ +vim.opt_local.wrap = true +vim.opt_local.textwidth = 80 +vim.opt_local.conceallevel = 2 diff --git a/after/ftplugin/python.lua b/after/ftplugin/python.lua new file mode 100644 index 0000000..e499672 --- /dev/null +++ b/after/ftplugin/python.lua @@ -0,0 +1,2 @@ +vim.opt_local.makeprg = "python %" +vim.opt_local.colorcolumn = "88" diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua new file mode 100644 index 0000000..187581e --- /dev/null +++ b/after/ftplugin/rust.lua @@ -0,0 +1,2 @@ +vim.opt_local.makeprg = "cargo run" +vim.opt_local.colorcolumn = "100" diff --git a/init.lua b/init.lua index af708e9..ea1678c 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,24 @@ +-- Set leader keys before lazy +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- Global mapping helpers +_G.map = function(mode, lhs, rhs, opts) + opts = opts or {} + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) +end + +_G.bmap = function(buf, mode, lhs, rhs, opts) + opts = opts or {} + opts.buffer = buf + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) +end + -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +if not vim.uv.fs_stat(lazypath) then vim.fn.system({ "git", "clone", @@ -12,55 +30,6 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) --- Basic settings -vim.g.mapleader = " " -vim.g.maplocalleader = "," - --- NvChad base46 cache path (must be before lazy setup) -vim.g.base46_cache = vim.fn.stdpath("data") .. "/base46_cache/" - --- Essential vim options -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.tabstop = 2 -vim.opt.shiftwidth = 2 -vim.opt.expandtab = true -vim.opt.smartindent = true -vim.opt.wrap = true -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undodir = os.getenv("HOME") .. "/.config/nvim/undodir" -vim.opt.undofile = true -vim.opt.hlsearch = false -vim.opt.incsearch = true -vim.opt.termguicolors = true -vim.opt.scrolloff = 8 -vim.opt.signcolumn = "yes" -vim.opt.updatetime = 250 -vim.opt.colorcolumn = "" -vim.opt.mouse = "a" -vim.opt.ignorecase = true -vim.opt.smartcase = true -vim.opt.splitbelow = true -vim.opt.splitright = true -vim.opt.cursorline = true -vim.opt.clipboard = "unnamedplus" -vim.opt.showmode = false -- Disable built-in mode display -vim.opt.shortmess:append("S") -- Disable native search count display -vim.opt.ruler = false -- Disable native ruler (NvChad statusline shows position) -vim.opt.cmdheight = 0 -- Hide command line when not in use -vim.opt.laststatus = 3 -- Global statusline at the very bottom -vim.opt.fillchars = { vert = "│", fold = "─", foldsep = "│", diff = "─" } - --- Keymaps -vim.keymap.set("n", "q", ":q", { desc = "Quit" }) - --- Buffer navigation (using native commands since tabufline is disabled) -vim.keymap.set("n", "", "bnext", { desc = "Next buffer" }) -vim.keymap.set("n", "", "bprev", { desc = "Previous buffer" }) -vim.keymap.set("n", "x", "bdelete", { desc = "Close buffer" }) -vim.keymap.set("n", "b", "enew", { desc = "New buffer" }) - -- Load plugins require("lazy").setup("plugins", { defaults = { lazy = true }, @@ -79,10 +48,5 @@ require("lazy").setup("plugins", { }, }) --- Load NvChad base46 highlights (safe load) -local cache = vim.g.base46_cache -if vim.uv.fs_stat(cache) then - for _, v in ipairs(vim.fn.readdir(cache)) do - dofile(cache .. v) - end -end \ No newline at end of file +-- Setup custom statusline +require("config.statusline").setup() diff --git a/lazy-lock.json b/lazy-lock.json index 647406c..d608e6d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,26 +1,26 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" }, - "base46": { "branch": "v3.0", "commit": "884b990dcdbe07520a0892da6ba3e8d202b46337" }, "dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" }, - "diffs.nvim": { "branch": "main", "commit": "75a6bf184ca70358d2fde93df5b5c4da79d9a2e5" }, - "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "diffs.nvim": { "branch": "main", "commit": "2c943c5b9496c816fd1fdcb1fa069b94ba8e9f27" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "gitsigns.nvim": { "branch": "main", "commit": "abf82a65f185bd54adc0679f74b7d6e1ada690c9" }, + "gruvbox-material": { "branch": "master", "commit": "790afe9dd085aa04eccd1da3626c5fa05c620e53" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "3d89e7c92fbd96c5e10e0298fc2b006f21cf9428" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c953789db7fd28eafe5eb5659846d34b5024b3cc" }, "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, - "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-autopairs": { "branch": "master", "commit": "007047febaa3681a8d2f3dd5126fdb9c6e81f393" }, - "nvim-lspconfig": { "branch": "master", "commit": "238583bb00770b079c68c69a860d65e5d1d8acf9" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-lspconfig": { "branch": "master", "commit": "3f58aeca0c6ece8a9fb8782ea3fcb6024f285be3" }, + "nvim-tree.lua": { "branch": "master", "commit": "037d89e60fb01a6c11a48a19540253b8c72a3c32" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" }, "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, "oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, - "ui": { "branch": "v3.0", "commit": "cb75908a86720172594b30de147272c1b3a7f452" }, "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-gutentags": { "branch": "master", "commit": "aa47c5e29c37c52176c44e61c780032dfacef3dd" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } diff --git a/lua/chadrc.lua b/lua/chadrc.lua deleted file mode 100644 index b3d3b9e..0000000 --- a/lua/chadrc.lua +++ /dev/null @@ -1,26 +0,0 @@ ----@type ChadrcConfig -local M = {} - -M.base46 = { - theme = "gruvbox", -- NvChad's gruvbox theme - transparency = false, -- Keep your transparent mode - -- theme_toggle = { "gruvbox", "gruvbox_light" }, -} - -M.ui = { - statusline = { - enabled = true, - theme = "default", -- options: default, vscode, vscode_colored, minimal - separator_style = "round", -- default, round, block, arrow - }, - tabufline = { - enabled = false, - }, -} - --- Disable nvdash if you want to keep your dashboard.lua -M.nvdash = { - load_on_startup = false, -} - -return M diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua new file mode 100644 index 0000000..5775f79 --- /dev/null +++ b/lua/config/lsp.lua @@ -0,0 +1,41 @@ +-- Shared LSP utilities +local M = {} + +-- Set up buffer-local keymaps when LSP attaches +function M.on_attach(client, bufnr) + local opts = { buffer = bufnr, silent = true } + + -- Navigation + vim.keymap.set("n", "gd", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" })) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, vim.tbl_extend("force", opts, { desc = "Go to declaration" })) + vim.keymap.set("n", "", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" })) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, vim.tbl_extend("force", opts, { desc = "Go to implementation" })) + vim.keymap.set("n", "gr", vim.lsp.buf.references, vim.tbl_extend("force", opts, { desc = "Go to references" })) + + -- Documentation + vim.keymap.set("n", "K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover documentation" })) + + -- Refactoring + vim.keymap.set("n", "rn", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename symbol" })) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code action" })) + + -- Formatting + vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ async = true }) + end, vim.tbl_extend("force", opts, { desc = "Format buffer" })) +end + +-- Return default capabilities for LSP servers +function M.capabilities() + local capabilities = vim.lsp.protocol.make_client_capabilities() + + -- If nvim-cmp is available, extend capabilities + local ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + if ok then + capabilities = vim.tbl_deep_extend("force", capabilities, cmp_nvim_lsp.default_capabilities()) + end + + return capabilities +end + +return M diff --git a/lua/config/statusline.lua b/lua/config/statusline.lua new file mode 100644 index 0000000..1a13703 --- /dev/null +++ b/lua/config/statusline.lua @@ -0,0 +1,139 @@ +-- Minimal custom statusline +local M = {} + +-- Mode mapping +local mode_map = { + n = "NORMAL", + no = "N-PENDING", + nov = "N-PENDING", + noV = "N-PENDING", + ["no\22"] = "N-PENDING", + niI = "NORMAL", + niR = "NORMAL", + niV = "NORMAL", + nt = "NORMAL", + ntT = "NORMAL", + v = "VISUAL", + vs = "VISUAL", + V = "V-LINE", + Vs = "V-LINE", + ["\22"] = "V-BLOCK", + ["\22s"] = "V-BLOCK", + s = "SELECT", + S = "S-LINE", + ["\19"] = "S-BLOCK", + i = "INSERT", + ic = "INSERT", + ix = "INSERT", + R = "REPLACE", + Rc = "REPLACE", + Rx = "REPLACE", + Rv = "V-REPLACE", + Rvc = "V-REPLACE", + Rvx = "V-REPLACE", + c = "COMMAND", + cv = "EX", + ce = "EX", + r = "REPLACE", + rm = "MORE", + ["r?"] = "CONFIRM", + ["!"] = "SHELL", + t = "TERMINAL", +} + +-- Get current mode indicator +local function get_mode() + local mode = vim.api.nvim_get_mode().mode + return mode_map[mode] or mode +end + +-- Get git branch from gitsigns +local function get_git_branch() + local branch = vim.b.gitsigns_head + if branch and branch ~= "" then + return " " .. branch + end + return "" +end + +-- Get filename with modified indicator +local function get_filename() + local filename = vim.fn.expand("%:t") + if filename == "" then + filename = "[No Name]" + end + + local modified = vim.bo.modified and " [+]" or "" + local readonly = vim.bo.readonly and " [RO]" or "" + + return filename .. modified .. readonly +end + +-- Get file path (relative to cwd) +local function get_filepath() + local filepath = vim.fn.expand("%:~:.") + if filepath == "" then + return "" + end + return filepath +end + +-- Get current position +local function get_position() + local line = vim.fn.line(".") + local col = vim.fn.col(".") + local total = vim.fn.line("$") + return string.format("%d:%d/%d", line, col, total) +end + +-- Get filetype +local function get_filetype() + local ft = vim.bo.filetype + if ft == "" then + return "" + end + return ft +end + +-- Build the statusline +function M.statusline() + local parts = {} + + -- Left side + table.insert(parts, " " .. get_mode() .. " ") + table.insert(parts, get_git_branch()) + + local filepath = get_filepath() + if filepath ~= "" then + table.insert(parts, " " .. filepath) + end + + -- Modified indicator + if vim.bo.modified then + table.insert(parts, " [+]") + end + + -- Separator + table.insert(parts, "%=") + + -- Right side + local ft = get_filetype() + if ft ~= "" then + table.insert(parts, ft .. " ") + end + + table.insert(parts, get_position() .. " ") + + return table.concat(parts, "") +end + +-- Setup function to configure the statusline +function M.setup() + -- Use the %!v:lua.require() pattern + vim.o.statusline = "%!v:lua.require('config.statusline').statusline()" + + -- Ensure statusline is always shown + vim.o.laststatus = 2 +end + +return M diff --git a/lua/lsp/lua_ls.lua b/lua/lsp/lua_ls.lua new file mode 100644 index 0000000..20d356f --- /dev/null +++ b/lua/lsp/lua_ls.lua @@ -0,0 +1,25 @@ +-- Lua language server configuration +return { + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + runtime = { + version = "LuaJIT", + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + }, + }, + telemetry = { + enable = false, + }, + hint = { + enable = true, + }, + }, + }, +} diff --git a/lua/lsp/pyright.lua b/lua/lsp/pyright.lua new file mode 100644 index 0000000..4916d5a --- /dev/null +++ b/lua/lsp/pyright.lua @@ -0,0 +1,13 @@ +-- Pyright (Python) language server configuration +return { + settings = { + python = { + analysis = { + typeCheckingMode = "basic", + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = "workspace", + }, + }, + }, +} diff --git a/lua/lsp/rust_analyzer.lua b/lua/lsp/rust_analyzer.lua new file mode 100644 index 0000000..e263d50 --- /dev/null +++ b/lua/lsp/rust_analyzer.lua @@ -0,0 +1,28 @@ +-- Rust Analyzer configuration with clippy integration +return { + settings = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy", + }, + cargo = { + allFeatures = true, + }, + procMacro = { + enable = true, + }, + diagnostics = { + enable = true, + }, + inlayHints = { + bindingModeHints = { enable = true }, + chainingHints = { enable = true }, + closingBraceHints = { enable = true }, + closureReturnTypeHints = { enable = "always" }, + lifetimeElisionHints = { enable = "always" }, + parameterHints = { enable = true }, + typeHints = { enable = true }, + }, + }, + }, +} diff --git a/lua/lsp/ts_ls.lua b/lua/lsp/ts_ls.lua new file mode 100644 index 0000000..c24e861 --- /dev/null +++ b/lua/lsp/ts_ls.lua @@ -0,0 +1,27 @@ +-- TypeScript language server configuration +return { + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, +} diff --git a/lua/plugins/arrow.lua b/lua/plugins/arrow.lua deleted file mode 100644 index b17a973..0000000 --- a/lua/plugins/arrow.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "otavioschwanck/arrow.nvim", - event = 'VeryLazy', - opts = { - show_icons = true, - leader_key = '-' - } -} \ No newline at end of file diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua deleted file mode 100644 index 9d8c80c..0000000 --- a/lua/plugins/autopairs.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = function() - require("nvim-autopairs").setup({}) - end, -} \ No newline at end of file diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua deleted file mode 100644 index 7b88c01..0000000 --- a/lua/plugins/comment.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - "numToStr/Comment.nvim", - keys = { - { "gcc", mode = "n", desc = "Comment toggle current line" }, - { "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" }, - { "gc", mode = "x", desc = "Comment toggle linewise (visual)" }, - { "gbc", mode = "n", desc = "Comment toggle current block" }, - { "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" }, - { "gb", mode = "x", desc = "Comment toggle blockwise (visual)" }, - }, - config = function() - require("Comment").setup() - end, -} \ No newline at end of file diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua deleted file mode 100644 index 9d06060..0000000 --- a/lua/plugins/dashboard.lua +++ /dev/null @@ -1,76 +0,0 @@ -return { - "nvimdev/dashboard-nvim", - event = "VimEnter", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - -- Calculate vertical padding to center the dashboard - local header_art = { - " ██▒ █▓ ██▓ ███▄ ▄███▓", - "▓██░ █▒▓██▒▓██▒▀█▀ ██▒", - " ▓██ █▒░▒██▒▓██ ▓██░", - " ▒██ █░░░██░▒██ ▒██ ", - " ▒▀█░ ░██░▒██▒ ░██▒", - " ░ ▐░ ░▓ ░ ▒░ ░ ░", - " ░ ░░ ▒ ░░ ░ ░", - " ░░ ▒ ░░ ░ ", - " ░ ░ ░ ", - " ░ ", - } - local center_items = 6 - local content_height = #header_art + 2 + (center_items * 2) -- header + spacing + center items - local win_height = vim.fn.winheight(0) - local padding = math.max(0, math.floor((win_height - content_height) / 2)) - - local header = {} - for _ = 1, padding do - table.insert(header, "") - end - for _, line in ipairs(header_art) do - table.insert(header, line) - end - table.insert(header, "") - table.insert(header, "") - - vim.api.nvim_set_hl(0, "DashboardHeader", { fg = "#83a598" }) - - require("dashboard").setup({ - theme = "doom", - config = { - header = header, - center = { - { - icon = " ", - desc = "Find File ", - key = "f", - action = "Telescope find_files", - }, - { - icon = " ", - desc = "Recent Files ", - key = "r", - action = "Telescope oldfiles", - }, - { - icon = " ", - desc = "Find Text ", - key = "g", - action = "Telescope live_grep", - }, - { - icon = " ", - desc = "File Explorer ", - key = "e", - action = "Neotree toggle", - }, - { - icon = " ", - desc = "Quit ", - key = "q", - action = "quit", - }, - }, - footer = {}, - }, - }) - end, -} diff --git a/lua/plugins/diffs.lua b/lua/plugins/diffs.lua deleted file mode 100644 index 5b51867..0000000 --- a/lua/plugins/diffs.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "barrettruth/diffs.nvim", - ft = { "git", "fugitive", "diff" }, - opts = { - hide_prefix = true, - highlights = { - gutter = true, - }, - }, -} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua new file mode 100644 index 0000000..37d18b2 --- /dev/null +++ b/lua/plugins/editor.lua @@ -0,0 +1,67 @@ +return { + -- Autopairs + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("nvim-autopairs").setup({}) + end, + }, + + -- Comment.nvim + { + "numToStr/Comment.nvim", + keys = { + { "gcc", mode = "n", desc = "Comment toggle current line" }, + { "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" }, + { "gc", mode = "x", desc = "Comment toggle linewise (visual)" }, + { "gbc", mode = "n", desc = "Comment toggle current block" }, + { "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" }, + { "gb", mode = "x", desc = "Comment toggle blockwise (visual)" }, + }, + config = function() + require("Comment").setup() + end, + }, + + -- Flash.nvim for navigation + { + "folke/flash.nvim", + event = "VeryLazy", + opts = { + modes = { + search = { + enabled = true, + }, + }, + }, + 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" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, + }, + + -- Supermaven AI completion + { + "supermaven-inc/supermaven-nvim", + event = "InsertEnter", + opts = { + keymaps = { + accept_suggestion = "", + clear_suggestion = "", + accept_word = "", + }, + ignore_filetypes = { "gitcommit", "TelescopePrompt" }, + color = { + suggestion_color = vim.api.nvim_get_hl(0, { name = "Comment" }).fg, + cterm = 244, + }, + log_level = "info", + disable_inline_completion = false, + disable_keymaps = false, + }, + }, +} diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua deleted file mode 100644 index d578874..0000000 --- a/lua/plugins/flash.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "folke/flash.nvim", - event = "VeryLazy", - opts = { - modes = { - search = { - enabled = true, - } - } - }, - 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" }, - { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, - }, -} \ No newline at end of file diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 37a7e28..b863acc 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -1,78 +1,80 @@ return { - -- Neogit: Modern Git interface with tree view + -- Fugitive: The gold standard for Git in Vim { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", -- required - "sindrets/diffview.nvim", -- optional - Diff integration - "nvim-telescope/telescope.nvim", -- optional - }, - config = function() - require('neogit').setup({ - -- Neo-tree style integration - kind = "split", - commit_editor = { - kind = "split", - }, - popup = { - kind = "split", - }, - -- Signs for different git states - signs = { - -- { CLOSED, OPENED } - hunk = { "", "" }, - item = { "", "" }, - section = { "", "" }, - }, - -- Integrations - integrations = { - telescope = true, - diffview = true, - }, - }) - end, + "tpope/vim-fugitive", + cmd = { "Git", "G", "Gread", "Gwrite", "Gdiffsplit", "Gvdiffsplit", "Gblame" }, keys = { - { "gg", "Neogit", desc = "Open Neogit" }, - { "gc", "Neogit commit", desc = "Git Commit" }, - { "gp", "Neogit push", desc = "Git Push" }, - { "gl", "Neogit pull", desc = "Git Pull" }, + { "gg", "Git", desc = "Git status" }, + { "gc", "Git commit", desc = "Git commit" }, + { "gp", "Git push", desc = "Git push" }, + { "gl", "Git pull", desc = "Git pull" }, + { "gb", "Git blame", desc = "Git blame" }, + { "gd", "Gvdiffsplit", desc = "Git diff vertical" }, + { "gr", "Gread", desc = "Git checkout file" }, + { "gw", "Gwrite", desc = "Git add file" }, }, }, - -- Diffview: Enhanced diff viewing + -- Gitsigns: Git info in the gutter { - "sindrets/diffview.nvim", - cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles" }, - config = function() - -- Set up diff highlights before loading diffview - vim.api.nvim_set_hl(0, "DiffAdd", { bg = "#2a3a2a" }) - vim.api.nvim_set_hl(0, "DiffChange", { bg = "#3a3a2a" }) - vim.api.nvim_set_hl(0, "DiffDelete", { bg = "#3a2a2a" }) - vim.api.nvim_set_hl(0, "DiffText", { bg = "#5a3d3d" }) - - require("diffview").setup({ - diff_binaries = false, -- Show diffs for binaries - enhanced_diff_hl = true, -- Better word-level diff highlighting - git_cmd = { "git" }, -- The git executable followed by default args. - use_icons = true, -- Requires nvim-web-devicons - show_help_hints = true, -- Show hints for how to open the help panel - watch_index = true, -- Update views and index on git index changes. - }) - end, + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "│" }, + }, + signs_staged = { + add = { text = "┃" }, + change = { text = "┃" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "┃" }, + }, + signs_staged_enable = true, + signcolumn = true, + numhl = false, + linehl = false, -- disabled - let colorscheme handle + word_diff = false, + current_line_blame = false, + current_line_blame_opts = { + delay = 500, + }, + }, keys = { - { "gdo", "DiffviewOpen", desc = "Open Diffview" }, - { "gdc", "DiffviewClose", desc = "Close Diffview" }, - { "gdh", "DiffviewFileHistory", desc = "File History" }, + { "]g", "Gitsigns next_hunk", desc = "Next hunk" }, + { "[g", "Gitsigns prev_hunk", desc = "Prev hunk" }, + { "ghs", "Gitsigns stage_hunk", desc = "Stage hunk" }, + { "ghr", "Gitsigns reset_hunk", desc = "Reset hunk" }, + { "ghp", "Gitsigns preview_hunk", desc = "Preview hunk" }, + { "gB", "Gitsigns toggle_current_line_blame", desc = "Toggle line blame" }, }, }, - -- Fugitive: Additional Git commands + -- Snacks: GitHub integration (browse, issues, PRs) { - 'tpope/vim-fugitive', - cmd = { 'Git', 'Gblame', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep' }, + "folke/snacks.nvim", + lazy = false, + opts = { + gitbrowse = {}, + }, keys = { - { 'gb', 'Git blame', desc = 'Git Blame' }, - { 'gd', 'Gdiff', desc = 'Git Diff (Fugitive)' }, - } + { "go", function() Snacks.gitbrowse() end, desc = "Open in GitHub" }, + }, + }, + + -- Diffs.nvim: Better diff highlighting + { + "barrettruth/diffs.nvim", + ft = { "git", "fugitive", "diff" }, + opts = { + hide_prefix = true, + highlights = { + gutter = true, + }, + }, }, } diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua deleted file mode 100644 index 9e3de90..0000000 --- a/lua/plugins/gitsigns.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() - require("gitsigns").setup({ - signcolumn = true, - numhl = false, - linehl = true, - word_diff = false, - signs = { - add = { text = "│" }, - change = { text = "│" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - signs_staged = { - add = { text = "┃" }, - change = { text = "┃" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - signs_staged_enable = true, - on_attach = function(bufnr) - -- Unstaged changes - line highlighting - vim.api.nvim_set_hl(0, "GitSignsAddLn", { bg = "#2a3a2a" }) - vim.api.nvim_set_hl(0, "GitSignsChangeLn", { bg = "#3a3a2a" }) - vim.api.nvim_set_hl(0, "GitSignsDeleteLn", { bg = "#3a2a2a" }) - -- Staged changes - NO line highlighting (gutter only) - vim.api.nvim_set_hl(0, "GitSignsStagedAddLn", {}) - vim.api.nvim_set_hl(0, "GitSignsStagedChangeLn", {}) - vim.api.nvim_set_hl(0, "GitSignsStagedDeleteLn", {}) - end, - }) - end, -} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 2d22d19..3041690 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,89 +1,66 @@ return { - { - "neovim/nvim-lspconfig", - dependencies = { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - }, - config = function() - require("mason").setup() - require("mason-lspconfig").setup({ - ensure_installed = { - "lua_ls", -- Lua - "pyright", -- Python - "ts_ls", -- TypeScript/JavaScript (tsserver renamed) - "rust_analyzer", -- Rust - "gopls", -- Go - "clangd", -- C/C++ - "bashls", -- Bash - "jsonls", -- JSON - "yamlls", -- YAML - "html", -- HTML - "cssls", -- CSS + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", }, - automatic_installation = true, - }) + config = function() + local lsp_config = require("config.lsp") - local lspconfig = require("lspconfig") - local capabilities = vim.lsp.protocol.make_client_capabilities() - - -- Basic LSP keymaps - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - local opts = { buffer = ev.buf } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "", vim.lsp.buf.definition, opts) -- Ctrl+] for go to definition - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) - vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) - vim.keymap.set("n", "f", function() - vim.lsp.buf.format({ async = true }) - end, opts) - end, - }) - - -- Auto-setup all installed servers - require("mason-lspconfig").setup_handlers({ - -- Default handler for all servers - function(server_name) - lspconfig[server_name].setup({ - capabilities = capabilities, - }) - end, - - -- Custom configuration for specific servers - ["lua_ls"] = function() - lspconfig.lua_ls.setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { "vim" }, + -- Set up Mason for auto-installation + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + "pyright", + "ts_ls", + "rust_analyzer", + "gopls", + "clangd", + "bashls", + "jsonls", + "html", + "cssls", }, - }, - }, - }) - end, + automatic_installation = true, + }) - ["pyright"] = function() - lspconfig.pyright.setup({ - capabilities = capabilities, - settings = { - python = { - analysis = { - typeCheckingMode = "basic", - autoSearchPaths = true, - useLibraryCodeForTypes = true, - }, - }, - }, - }) + local lspconfig = require("lspconfig") + local capabilities = lsp_config.capabilities() + + -- LspAttach autocmd for keymaps + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client then + lsp_config.on_attach(client, ev.buf) + end + end, + }) + + -- Helper to load per-server config from lua/lsp/ if it exists + local function get_server_config(server_name) + local ok, server_config = pcall(require, "lsp." .. server_name) + if ok then + return server_config + end + return {} + end + + -- Auto-setup all installed servers + require("mason-lspconfig").setup_handlers({ + -- Default handler for all servers + function(server_name) + local server_config = get_server_config(server_name) + local config = vim.tbl_deep_extend("force", { + capabilities = capabilities, + }, server_config) + + lspconfig[server_name].setup(config) + end, + }) end, - }) - end, - }, -} \ No newline at end of file + }, +} diff --git a/lua/plugins/navigation.lua b/lua/plugins/navigation.lua new file mode 100644 index 0000000..24b98ee --- /dev/null +++ b/lua/plugins/navigation.lua @@ -0,0 +1,142 @@ +return { + -- Telescope fuzzy finder + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + }, + cmd = "Telescope", + keys = { + { "ff", "Telescope find_files", desc = "Find files" }, + { + "fs", + function() + require("telescope.builtin").find_files({ + find_command = { + "fd", + "--type", "f", + "--max-depth", "3", + "--strip-cwd-prefix", + "--hidden", + "--exclude", ".git", + "--exclude", "node_modules", + "--exclude", ".next", + }, + }) + end, + desc = "Shallow find files", + }, + { "fg", "Telescope live_grep", desc = "Live grep" }, + { "fb", "Telescope buffers", desc = "Buffers" }, + { "fh", "Telescope help_tags", desc = "Help tags" }, + }, + config = function() + local telescope = require("telescope") + telescope.setup({ + defaults = { + file_ignore_patterns = { + "node_modules", + ".next", + ".git", + "dist", + "build", + "%.lock", + }, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--hidden", + "--glob=!.git/", + "--glob=!node_modules/", + "--glob=!.next/", + }, + mappings = { + i = { + [""] = "move_selection_next", + [""] = "move_selection_previous", + }, + }, + }, + pickers = { + find_files = { + hidden = true, + find_command = { + "fd", + "--type", "f", + "--strip-cwd-prefix", + "--hidden", + "--exclude", ".git", + "--exclude", "node_modules", + "--exclude", ".next", + }, + }, + }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + }, + }) + telescope.load_extension("fzf") + end, + }, + + -- Oil file explorer + { + "stevearc/oil.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + lazy = false, + keys = { + { "-", "Oil", desc = "Open parent directory" }, + }, + opts = { + default_file_explorer = true, + columns = { + "icon", + }, + view_options = { + show_hidden = true, + }, + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + }, + }, + }, + + -- Arrow for quick file bookmarks + { + "otavioschwanck/arrow.nvim", + event = "VeryLazy", + opts = { + show_icons = true, + leader_key = ";", + }, + }, +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua deleted file mode 100644 index 1276d56..0000000 --- a/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,50 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - cmd = "Neotree", - keys = { - { "e", "Neotree toggle", desc = "Toggle file explorer" }, - { "", "Neotree toggle", desc = "Toggle file explorer" }, - { "gs", "Neotree git_status left", desc = "Focus git status" }, - }, - config = function() - require("neo-tree").setup({ - close_if_last_window = true, - window = { - width = 30, - }, - -- Source selector (tabs) to switch between files/git - source_selector = { - winbar = true, - content_layout = "center", - tabs_layout = "equal", - sources = { - { source = "filesystem", display_name = " Files" }, - { source = "git_status", display_name = " Git" }, - }, - }, - filesystem = { - follow_current_file = { - enabled = true, -- Highlight and auto-expand to current file - leave_dirs_open = false, -- Close dirs when navigating away - }, - filtered_items = { - visible = true, -- Show filtered items (hidden files) - hide_dotfiles = false, -- Show dotfiles - hide_gitignored = false, -- Show git ignored files - hide_hidden = false, -- Show hidden files on Windows - }, - }, - git_status = { - follow_current_file = { - enabled = true, - }, - }, - }) - end, -} \ No newline at end of file diff --git a/lua/plugins/nvchad.lua b/lua/plugins/nvchad.lua deleted file mode 100644 index 80fe22e..0000000 --- a/lua/plugins/nvchad.lua +++ /dev/null @@ -1,31 +0,0 @@ -return { - "nvim-lua/plenary.nvim", - - { - "nvchad/base46", - lazy = false, - priority = 1000, - build = function() - require("base46").load_all_highlights() - end, - config = function() - -- Generate cache on first load if it doesn't exist - local cache_path = vim.g.base46_cache - if not vim.uv.fs_stat(cache_path) then - vim.fn.mkdir(cache_path, "p") - require("base46").load_all_highlights() - end - end, - }, - - { - "nvchad/ui", - lazy = false, - priority = 999, - config = function() - require("nvchad") - end, - }, - - -} diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua deleted file mode 100644 index 61b5a65..0000000 --- a/lua/plugins/oil.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - "stevearc/oil.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - lazy = false, - keys = { - { "-", "Oil", desc = "Open parent directory" }, - }, - opts = { - default_file_explorer = true, - columns = { - "icon", - }, - view_options = { - show_hidden = true, - }, - keymaps = { - ["g?"] = "actions.show_help", - [""] = "actions.select", - [""] = "actions.select_vsplit", - [""] = "actions.select_split", - [""] = "actions.select_tab", - [""] = "actions.preview", - [""] = "actions.close", - [""] = "actions.refresh", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = "actions.tcd", - ["gs"] = "actions.change_sort", - ["gx"] = "actions.open_external", - ["g."] = "actions.toggle_hidden", - }, - }, -} diff --git a/lua/plugins/supermaven.lua b/lua/plugins/supermaven.lua deleted file mode 100644 index 4b6c1c6..0000000 --- a/lua/plugins/supermaven.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "supermaven-inc/supermaven-nvim", - event = "InsertEnter", - opts = { - keymaps = { - accept_suggestion = "", - clear_suggestion = "", - accept_word = "", - }, - ignore_filetypes = { "gitcommit", "TelescopePrompt" }, - color = { - suggestion_color = "#808080", - cterm = 244, - }, - log_level = "info", - disable_inline_completion = false, - disable_keymaps = false, - }, -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua deleted file mode 100644 index 5385bd5..0000000 --- a/lua/plugins/telescope.lua +++ /dev/null @@ -1,56 +0,0 @@ -return { - "nvim-telescope/telescope.nvim", - tag = "0.1.5", - dependencies = { "nvim-lua/plenary.nvim" }, - cmd = "Telescope", - keys = { - { "ff", "Telescope find_files", desc = "Find files" }, - { "fs", function() - require("telescope.builtin").find_files({ - find_command = { "fd", "--type", "f", "--max-depth", "3", "--strip-cwd-prefix", "--hidden", "--exclude", ".git", "--exclude", "node_modules", "--exclude", ".next" } - }) - end, desc = "Shallow find files" }, - { "fg", "Telescope live_grep", desc = "Live grep" }, - { "fb", "Telescope buffers", desc = "Buffers" }, - { "fh", "Telescope help_tags", desc = "Help tags" }, - }, - config = function() - require("telescope").setup({ - defaults = { - file_ignore_patterns = { - "node_modules", - ".next", - ".git", - "dist", - "build", - "%.lock", - }, - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case", - "--hidden", - "--glob=!.git/", - "--glob=!node_modules/", - "--glob=!.next/", - }, - mappings = { - i = { - [""] = "move_selection_next", - [""] = "move_selection_previous", - }, - }, - }, - pickers = { - find_files = { - hidden = true, - find_command = { "fd", "--type", "f", "--strip-cwd-prefix", "--hidden", "--exclude", ".git", "--exclude", "node_modules", "--exclude", ".next" }, - }, - }, - }) - end, -} \ No newline at end of file diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index ec00bac..bf8c9c2 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,17 +1,92 @@ return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - event = { "BufReadPost", "BufNewFile" }, - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { "lua", "vim", "vimdoc", "query", "javascript", "typescript", "python", "html", "css", "json", "yaml", "markdown" }, - auto_install = true, - highlight = { - enable = false, - }, - indent = { - enable = true, - }, - }) - end, + -- Treesitter for syntax highlighting and code understanding + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "lua", + "vim", + "vimdoc", + "query", + "javascript", + "typescript", + "tsx", + "python", + "html", + "css", + "json", + "yaml", + "markdown", + "markdown_inline", + "bash", + "regex", + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["ai"] = "@conditional.outer", + ["ii"] = "@conditional.inner", + ["al"] = "@loop.outer", + ["il"] = "@loop.inner", + ["ab"] = "@block.outer", + ["ib"] = "@block.inner", + }, + }, + move = { + enable = true, + set_jumps = true, + goto_next_start = { + ["]f"] = "@function.outer", + ["]c"] = "@class.outer", + ["]a"] = "@parameter.inner", + }, + goto_next_end = { + ["]F"] = "@function.outer", + ["]C"] = "@class.outer", + }, + goto_previous_start = { + ["[f"] = "@function.outer", + ["[c"] = "@class.outer", + ["[a"] = "@parameter.inner", + }, + goto_previous_end = { + ["[F"] = "@function.outer", + ["[C"] = "@class.outer", + }, + }, + swap = { + enable = true, + swap_next = { + ["sn"] = "@parameter.inner", + }, + swap_previous = { + ["sp"] = "@parameter.inner", + }, + }, + }, + }) + end, + }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..297ae84 --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,113 @@ +return { + -- Gruvbox Material colorscheme + { + "sainnhe/gruvbox-material", + lazy = false, + priority = 1000, + config = function() + vim.g.gruvbox_material_background = "medium" + vim.g.gruvbox_material_foreground = "material" + vim.g.gruvbox_material_enable_italic = true + vim.g.gruvbox_material_enable_bold = true + vim.g.gruvbox_material_better_performance = true + vim.g.gruvbox_material_diagnostic_text_highlight = true + vim.g.gruvbox_material_diagnostic_virtual_text = "colored" + vim.cmd.colorscheme("gruvbox-material") + end, + }, + + -- Dashboard + { + "nvimdev/dashboard-nvim", + event = "VimEnter", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local header_art = { + " ██▒ █▓ ██▓ ███▄ ▄███▓", + "▓██░ █▒▓██▒▓██▒▀█▀ ██▒", + " ▓██ █▒░▒██▒▓██ ▓██░", + " ▒██ █░░░██░▒██ ▒██ ", + " ▒▀█░ ░██░▒██▒ ░██▒", + " ░ ▐░ ░▓ ░ ▒░ ░ ░", + " ░ ░░ ▒ ░░ ░ ░", + " ░░ ▒ ░░ ░ ", + " ░ ░ ░ ", + " ░ ", + } + local center_items = 6 + local content_height = #header_art + 2 + (center_items * 2) + local win_height = vim.fn.winheight(0) + local padding = math.max(0, math.floor((win_height - content_height) / 2)) + + local header = {} + for _ = 1, padding do + table.insert(header, "") + end + for _, line in ipairs(header_art) do + table.insert(header, line) + end + table.insert(header, "") + table.insert(header, "") + + require("dashboard").setup({ + theme = "doom", + config = { + header = header, + center = { + { + icon = " ", + desc = "Find File ", + key = "f", + action = "Telescope find_files", + }, + { + icon = " ", + desc = "Recent Files ", + key = "r", + action = "Telescope oldfiles", + }, + { + icon = " ", + desc = "Find Text ", + key = "g", + action = "Telescope live_grep", + }, + { + icon = " ", + desc = "File Explorer ", + key = "e", + action = "Oil", + }, + { + icon = " ", + desc = "Quit ", + key = "q", + action = "quit", + }, + }, + footer = {}, + }, + }) + end, + }, + + -- Which-key for keybinding hints + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + win = { + border = { "┏", "━", "┓", "┃", "┛", "━", "┗", "┃" }, + }, + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + }, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua deleted file mode 100644 index 9c490b3..0000000 --- a/lua/plugins/which-key.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "folke/which-key.nvim", - event = 'VeryLazy', - opts = { - win = { - border = { "┏", "━", "┓", "┃", "┛","━", "┗", "┃" }, - }, - }, - keys = { - { - "?", - function() - require("which-key").show({ global = false }) - end, - desc = "Buffer Local Keymaps (which-key)", - }, - }, -} \ No newline at end of file diff --git a/plugin/autocmds.lua b/plugin/autocmds.lua new file mode 100644 index 0000000..99297af --- /dev/null +++ b/plugin/autocmds.lua @@ -0,0 +1,36 @@ +-- Autocommands +local api = vim.api +local augroup = api.nvim_create_augroup("UserAutocmds", { clear = true }) + +-- Highlight on yank +api.nvim_create_autocmd("TextYankPost", { + group = augroup, + callback = function() + vim.highlight.on_yank({ higroup = "Visual", timeout = 200 }) + end, + desc = "Highlight text on yank", +}) + +-- Restore cursor position on file open +api.nvim_create_autocmd("BufReadPost", { + group = augroup, + callback = function() + local mark = api.nvim_buf_get_mark(0, '"') + local line_count = api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= line_count then + pcall(api.nvim_win_set_cursor, 0, mark) + end + end, + desc = "Restore cursor position", +}) + +-- Auto-resize splits on VimResized +api.nvim_create_autocmd("VimResized", { + group = augroup, + callback = function() + local current_tab = vim.fn.tabpagenr() + vim.cmd("tabdo wincmd =") + vim.cmd("tabnext " .. current_tab) + end, + desc = "Auto-resize splits", +}) diff --git a/plugin/keymaps.lua b/plugin/keymaps.lua new file mode 100644 index 0000000..0de7970 --- /dev/null +++ b/plugin/keymaps.lua @@ -0,0 +1,26 @@ +-- Keymaps using global map() helper + +-- File operations +map("n", "w", "w", { desc = "Save file" }) +map("n", "q", "q", { desc = "Quit" }) + +-- Buffer navigation +map("n", "", "bnext", { desc = "Next buffer" }) +map("n", "", "bprev", { desc = "Previous buffer" }) +map("n", "x", "bdelete", { desc = "Close buffer" }) +map("n", "b", "enew", { desc = "New buffer" }) + +-- Window navigation +map("n", "", "h", { desc = "Move to left window" }) +map("n", "", "j", { desc = "Move to lower window" }) +map("n", "", "k", { desc = "Move to upper window" }) +map("n", "", "l", { desc = "Move to right window" }) + +-- Better defaults +map("n", "J", "mzJ`z", { desc = "Join lines keeping cursor position" }) +map("x", "x", '"_x', { desc = "Delete char without yanking" }) +map("x", "p", '"_dP', { desc = "Paste without yanking replaced text" }) +map("n", "", "nohlsearch", { desc = "Clear search highlight" }) + +-- Terminal +map("t", "", "", { desc = "Exit terminal mode" }) diff --git a/plugin/options.lua b/plugin/options.lua new file mode 100644 index 0000000..adc5a86 --- /dev/null +++ b/plugin/options.lua @@ -0,0 +1,47 @@ +-- Vim options +local o, opt = vim.o, vim.opt + +-- Line numbers +o.number = true +o.relativenumber = true + +-- Indentation +o.tabstop = 2 +o.shiftwidth = 2 +o.expandtab = true +o.smartindent = true +o.breakindent = true + +-- Search +o.ignorecase = true +o.smartcase = true +o.hlsearch = false +o.incsearch = true + +-- UI +o.termguicolors = true +o.cursorline = true +o.scrolloff = 8 +o.signcolumn = "yes" +o.wrap = false +o.showmode = false +o.laststatus = 3 +o.cmdheight = 0 + +opt.fillchars = { vert = "│", fold = "─", foldsep = "│", diff = "─" } +opt.shortmess:append("S") + +-- Splits +o.splitbelow = true +o.splitright = true + +-- Files +o.swapfile = false +o.backup = false +o.undofile = true +o.undodir = vim.fn.stdpath("data") .. "/undo" + +-- Misc +o.updatetime = 250 +o.mouse = "a" +o.clipboard = "unnamedplus"