diff --git a/init.lua b/init.lua index 767086e..dacba2b 100644 --- a/init.lua +++ b/init.lua @@ -27,22 +27,3 @@ vim.g.copilot_no_tab_map = true require("lazy_setup") require("polish") require("core.lsp") - - --- local function silent_hover() --- local params = vim.lsp.util.make_position_params() --- vim.lsp.buf_request(0, 'textDocument/hover', params, function(err, result, ctx, config) --- if err then --- -- Silently ignore errors instead of showing them --- return --- end --- if result and result.contents then --- vim.lsp.util.stylize_markdown(result.contents.value or result.contents, {}) --- end --- end) --- end - --- -- Remap K to use silent hover --- vim.keymap.set({'n', 'v'}, 'K', silent_hover, { silent = true }) - --- Keep K for documentation in normal mode, but disable in visual mode diff --git a/lazy-lock.json b/lazy-lock.json index d26e80c..336e856 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -29,7 +29,6 @@ "kanagawa.nvim": { "branch": "master", "commit": "e5f7b8a804360f0a48e40d0083a97193ee4fcc87" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, - "lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, diff --git a/lua/plugins/README.md b/lua/plugins/README.md new file mode 100644 index 0000000..0264adf --- /dev/null +++ b/lua/plugins/README.md @@ -0,0 +1,94 @@ +# Plugins Organization + +Thư mục `plugins` đã được tổ chức lại theo chức năng để dễ quản lý và bảo trì hơn. + +## Cấu trúc thư mục + +### Core Files +- **`astrocore.lua`** - Cấu hình cốt lõi của AstroNvim (mappings, options, autocmds) +- **`astrolsp.lua`** - Cấu hình Language Server Protocol +- **`astroui.lua`** - Cấu hình giao diện người dùng +- **`mason.lua`** - Quản lý LSP servers, formatters, debuggers +- **`treesitter.lua`** - Cấu hình syntax highlighting +- **`whichkey.lua`** - Cấu hình key mappings + +### Functional Categories + +#### 🎨 **`themes.lua`** - Themes và Colorschemes +- Bamboo (main theme) +- Catppuccin (disabled) +- Các themes khác (disabled) + +#### 🔧 **`completion.lua`** - Completion và AI Assistance +- GitHub Copilot +- Blink.cmp (replacement cho nvim-cmp) +- LSP Kind icons +- Các completion plugins bị disable + +#### ✏️ **`editor.lua`** - Editor Enhancements +- Comment management +- Auto-save functionality +- Indent scope highlighting +- Code folding (nvim-ufo) +- Split navigation (smart-splits) +- Terminal support (disabled) + +#### 🚀 **`motion.lua`** - Motion, Navigation và Multiple Cursors +- Multiple cursors support +- Brackets split/join +- Better word motion (spider) +- Flash navigation +- Code block movement + +#### 🖥️ **`ui.lua`** - UI và Interface Enhancements +- Dashboard (alpha-nvim) +- Status line (heirline) +- Notifications +- Todo comments highlighting +- Smart bracket pairing +- Treesitter context +- Virtual text context +- Noice UI + +#### 🛠️ **`development.lua`** - Development Tools và Debugging +- LSP End hints +- DAP UI (disabled) +- DAP Virtual Text (disabled) +- Các development plugins bị disable + +#### 📝 **`formatting.lua`** - Formatting và Linting +- None-ls formatting +- Ruff formatting +- Các formatting plugins bị disable + +#### 📁 **`file_explorer.lua`** - File Explorer và File Management +- Neo-tree file explorer +- Các file explorer plugins bị disable + +#### 📋 **`snippets.lua`** - Snippets +- LuaSnip +- Các snippet plugins bị disable + +#### ❌ **`disabled.lua`** - Disabled Plugins +- Tất cả các plugins bị disable, được tổ chức theo category + +## Lợi ích của cấu trúc mới + +1. **Dễ tìm kiếm**: Mỗi file có một chức năng cụ thể +2. **Dễ bảo trì**: Khi cần thay đổi một tính năng, chỉ cần sửa một file +3. **Dễ mở rộng**: Thêm plugins mới vào đúng category +4. **Rõ ràng**: Tên file cho biết ngay chức năng +5. **Tổ chức**: Các plugins liên quan được nhóm lại với nhau + +## Cách thêm plugins mới + +1. Xác định chức năng của plugin +2. Thêm vào file tương ứng +3. Nếu không có category phù hợp, tạo file mới +4. Cập nhật README này nếu cần + +## Ghi chú + +- Các plugins bị disable được giữ lại trong `disabled.lua` để dễ tham khảo +- Một số plugins có thể xuất hiện ở nhiều nơi (ví dụ: trong specs của plugin khác) +- Cấu trúc này tương thích với AstroNvim và Lazy.nvim diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 8ea7f39..5eda3fa 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -3,182 +3,195 @@ -- as this provides autocomplete and documentation while editing ---@type LazySpec return { - "AstroNvim/astrolsp", - ---@type AstroLSPOpts - opts = { - -- Configuration table of features provided by AstroLSP - features = { - autoformat = false, -- enable or disable auto formatting on start - codelens = true, -- enable/disable codelens refresh on start - inlay_hints = false, -- enable/disable inlay hints on start - semantic_tokens = true, -- enable/disable semantic token highlighting - }, - -- customize lsp formatting options - formatting = require("plugins.configs.lsp.formatting"), - -- enable servers that you already have installed without mason + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + autoformat = false, -- enable or disable auto formatting on start + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + -- customize lsp formatting options + formatting = require("plugins.configs.lsp.formatting"), + -- enable servers that you already have installed without mason - servers = {}, - -- customize language server configuration options passed to `lspconfig` - ---@diagnostic disable: missing-fields - config = { - -- clangd = require "plugins.configs.lsp.config.clangd", - basedpyright = require("plugins.configs.lsp.config.basedpyright"), - jedi_language_server = require("plugins.configs.lsp.config.jedi_language"), - pyright = require("plugins.configs.lsp.config.pyright"), - ruff = require("plugins.configs.lsp.config.ruff"), - pylsp = require("plugins.configs.lsp.config.pylsp"), - }, - -- customize how language servers are attached - handlers = { - -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server - -- function(server, opts) require("lspconfig")[server].setup(opts) end - -- config Ty + servers = {}, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- clangd = require "plugins.configs.lsp.config.clangd", + basedpyright = require("plugins.configs.lsp.config.basedpyright"), + jedi_language_server = require("plugins.configs.lsp.config.jedi_language"), + pyright = require("plugins.configs.lsp.config.pyright"), + ruff = require("plugins.configs.lsp.config.ruff"), + pylsp = require("plugins.configs.lsp.config.pylsp"), + }, + -- customize how language servers are attached + handlers = { + -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server + -- function(server, opts) require("lspconfig")[server].setup(opts) end + -- config Ty - -- the key is the server that is being setup with `lspconfig` - -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server - -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed - }, - -- Configure buffer local auto commands to add when attaching a language server - autocmds = { - -- first key is the `augroup` to add the auto commands to (:h augroup) - lsp_document_highlight = { - -- Optional condition to create/delete auto command group - -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` - -- condition will be resolved for each client on each execution and if it ever fails for all clients, - -- the auto commands will be deleted for that buffer - cond = "textDocument/documentHighlight", - -- cond = function(client, bufnr) return client.name == "lua_ls" end, - -- list of auto commands to set - { - -- events to trigger - event = { "CursorHold", "CursorHoldI" }, - -- the rest of the autocmd options (:h nvim_create_autocmd) - desc = "Document Highlighting", - callback = function() - vim.lsp.buf.document_highlight() - end, - }, - { - event = { "CursorMoved", "CursorMovedI", "BufLeave" }, - desc = "Document Highlighting Clear", - callback = function() - vim.lsp.buf.clear_references() - end, - }, - }, - -- disable inlay hints in insert mode - disable_inlay_hints_on_insert = { - -- only create for language servers that support inlay hints - -- (and only if vim.lsp.inlay_hint is available) - cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false, - { - -- when going into insert mode - event = "InsertEnter", - desc = "disable inlay hints on insert", - callback = function(args) - local filter = { bufnr = args.buf } - -- if the inlay hints are currently enabled - if vim.lsp.inlay_hint.is_enabled(filter) then - -- disable the inlay hints - vim.lsp.inlay_hint.enable(false, filter) - -- create a single use autocommand to turn the inlay hints back on - -- when leaving insert mode - vim.api.nvim_create_autocmd("InsertLeave", { - buffer = args.buf, - once = true, - callback = function() - vim.lsp.inlay_hint.enable(true, filter) - end, - }) - end - end, - }, - }, - }, - -- mappings to be set up on attaching of a language server - mappings = { - n = { - gh = { - function() - vim.lsp.buf.hover() - end, - desc = "Hover symbol details", - cond = "textDocument/hover", - }, - gl = { - function() - vim.diagnostic.open_float() - end, - desc = "Hover diagnostics", - }, - -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean - gD = { - function() - vim.lsp.buf.declaration() - end, - desc = "Declaration of current symbol", - cond = "textDocument/declaration", - }, - ["uY"] = { - function() - require("astrolsp.toggles").buffer_semantic_tokens() - end, - desc = "Toggle LSP semantic highlight (buffer)", - cond = function(client) - return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens - end, - }, - }, - }, - -- A custom `on_attach` function to be run after the default `on_attach` function - -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) - on_attach = function(client, bufnr) - -- this would disable semanticTokensProvider for all clients - -- client.server_capabilities.semanticTokensProvider = nil - -- Disable ruff_lsp hover in favor of pyright - if client.name == "ruff" then - client.server_capabilities.hoverProvider = false - end + -- the key is the server that is being setup with `lspconfig` + -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server + -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed + }, + -- Configure buffer local auto commands to add when attaching a language server + autocmds = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + lsp_document_highlight = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + cond = "textDocument/documentHighlight", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "CursorHold", "CursorHoldI" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + desc = "Document Highlighting", + callback = function() + vim.lsp.buf.document_highlight() + end, + }, + { + event = { "CursorMoved", "CursorMovedI", "BufLeave" }, + desc = "Document Highlighting Clear", + callback = function() + vim.lsp.buf.clear_references() + end, + }, + }, + -- disable inlay hints in insert mode + disable_inlay_hints_on_insert = { + -- only create for language servers that support inlay hints + -- (and only if vim.lsp.inlay_hint is available) + cond = vim.lsp.inlay_hint and "textDocument/inlayHint" or false, + { + -- when going into insert mode + event = "InsertEnter", + desc = "disable inlay hints on insert", + callback = function(args) + local filter = { bufnr = args.buf } + -- if the inlay hints are currently enabled + if vim.lsp.inlay_hint.is_enabled(filter) then + -- disable the inlay hints + vim.lsp.inlay_hint.enable(false, filter) + -- create a single use autocommand to turn the inlay hints back on + -- when leaving insert mode + vim.api.nvim_create_autocmd("InsertLeave", { + buffer = args.buf, + once = true, + callback = function() + vim.lsp.inlay_hint.enable(true, filter) + end, + }) + end + end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + gh = { + function() + vim.lsp.buf.hover() + end, + desc = "Hover symbol details", + cond = "textDocument/hover", + }, + gl = { + function() + vim.diagnostic.open_float() + end, + desc = "Hover diagnostics", + }, + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + gD = { + function() + vim.lsp.buf.declaration() + end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + function() + require("astrolsp.toggles").buffer_semantic_tokens() + end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens + end, + }, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + -- Disable ruff_lsp hover in favor of pyright + if client.name == "ruff" then + client.server_capabilities.hoverProvider = false + end - -- if client.name == "pyright" then - -- -- disable pyright analysis features - -- client.server_capabilities.documentFormattingProvider = false - -- client.server_capabilities.hoverProvider = false + -- if client.name == "pyright" then + -- -- disable pyright analysis features + -- client.server_capabilities.documentFormattingProvider = false + -- client.server_capabilities.hoverProvider = false - -- end + -- end - -- Disable completion feature of pyright - if client.name == "ty" then - client.server_capabilities.completionProvider = false - end + -- Disable completion feature of pyright + if client.name == "ty" then + client.server_capabilities.completionProvider = false + end - if client.name == "basedpyright" then - client.server_capabilities.completionProvider = false - client.server_capabilities.codeLensProvider = false - client.server_capabilities.colorProvider = false - client.server_capabilities.colorProvider = false - client.server_capabilities.callHierarchyProvider = false - client.server_capabilities.documentFormattingProvider = false - client.server_capabilities.documentRangeFormattingProvider = false - client.server_capabilities.declarationProvider = false - client.server_capabilities.documentLinkProvider = false - client.server_capabilities.definitionProvider = false - client.server_capabilities.documentFormattingProvider = false - client.server_capabilities.documentOnTypeFormattingProvider = false - client.server_capabilities.documentLinkProvider = false - client.server_capabilities.documentSymbolProvider = false - client.server_capabilities.documentRangeFormattingProvider = false - client.server_capabilities.hoverProvider = false - client.server_capabilities.inlineCompletionProvider = false - client.server_capabilities.inlineValueProvider = false - client.server_capabilities.notebookDocumentSync = false - client.server_capabilities.signatureHelpProvider = false - client.server_capabilities.renameProvider = false - client.server_capabilities.typeDefinitionProvider = false - client.server_capabilities.workspaceSymbolProvider = false - client.server_capabilities.monikerProvider = false - client.server_capabilities.semanticTokensProvider = false - end - end, - }, + if client.name == "basedpyright" then + -- Tắt hết các dịch vụ, chỉ giữ lại diagnostics và inlay hints + client.server_capabilities.completionProvider = false + client.server_capabilities.codeLensProvider = false + client.server_capabilities.colorProvider = false + client.server_capabilities.callHierarchyProvider = false + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + client.server_capabilities.declarationProvider = false + client.server_capabilities.documentLinkProvider = false + client.server_capabilities.definitionProvider = false + client.server_capabilities.documentOnTypeFormattingProvider = false + client.server_capabilities.documentSymbolProvider = false + client.server_capabilities.hoverProvider = false + client.server_capabilities.inlineCompletionProvider = false + client.server_capabilities.inlineValueProvider = false + client.server_capabilities.notebookDocumentSync = false + client.server_capabilities.signatureHelpProvider = false + client.server_capabilities.renameProvider = false + client.server_capabilities.typeDefinitionProvider = false + client.server_capabilities.workspaceSymbolProvider = false + client.server_capabilities.monikerProvider = false + client.server_capabilities.semanticTokensProvider = false + + -- Tắt thêm các capabilities khác có thể có + client.server_capabilities.referencesProvider = false + client.server_capabilities.implementationProvider = false + client.server_capabilities.foldingRangeProvider = false + client.server_capabilities.selectionRangeProvider = false + client.server_capabilities.linkedEditingRangeProvider = false + client.server_capabilities.executeCommandProvider = false + client.server_capabilities.workspace = { + workspaceFolders = { supported = false }, + fileOperations = { supported = false } + } + + -- Giữ lại diagnostics và inlay hints + -- client.server_capabilities.diagnosticProvider = true (mặc định) + -- client.server_capabilities.inlayHintProvider = true (mặc định) + end + end, + }, } diff --git a/lua/plugins/auto-save.lua b/lua/plugins/auto-save.lua deleted file mode 100644 index 10ea343..0000000 --- a/lua/plugins/auto-save.lua +++ /dev/null @@ -1,50 +0,0 @@ -return { - "okuuva/auto-save.nvim", - event = { "User AstroFile", "InsertEnter" }, - dependencies = { - "AstroNvim/astrocore", - opts = { - autocmds = { - autoformat_toggle = { - -- Disable autoformat before saving - { - event = "User", - desc = "Disable autoformat before saving", - pattern = "AutoSaveWritePre", - callback = function() - -- Save global autoformat status - vim.g.OLD_AUTOFORMAT = vim.g.autoformat - vim.g.autoformat = false - - local old_autoformat_buffers = {} - -- Disable all manually enabled buffers - for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do - if vim.b[bufnr].autoformat then - table.insert(old_autoformat_buffers, bufnr) - vim.b[bufnr].autoformat = false - end - end - - vim.g.OLD_AUTOFORMAT_BUFFERS = old_autoformat_buffers - end, - }, - -- Re-enable autoformat after saving - { - event = "User", - desc = "Re-enable autoformat after saving", - pattern = "AutoSaveWritePost", - callback = function() - -- Restore global autoformat status - vim.g.autoformat = vim.g.OLD_AUTOFORMAT - -- Re-enable all manually enabled buffers - for _, bufnr in ipairs(vim.g.OLD_AUTOFORMAT_BUFFERS or {}) do - vim.b[bufnr].autoformat = true - end - end, - }, - }, - }, - }, - }, - opts = {}, -} diff --git a/lua/plugins/cmp-plugins.lua b/lua/plugins/cmp-plugins.lua deleted file mode 100644 index a59ffa9..0000000 --- a/lua/plugins/cmp-plugins.lua +++ /dev/null @@ -1,142 +0,0 @@ --- return { --- { --- "onsails/lspkind.nvim", --- opts = { --- symbol_map = require "plugins.configs.ui.lspkind", --- }, --- }, --- { "hrsh7th/cmp-cmdline", event = "CmdlineEnter" }, --- { "github/copilot.vim", event = "BufRead" }, --- { "hrsh7th/cmp-buffer", event = "BufRead" }, --- { "hrsh7th/cmp-path", event = "BufRead" }, - --- { --- "hrsh7th/nvim-cmp", event = "VimEnter", depedencies = { --- "hrsh7th/cmp-nvim-lsp", --- }, --- opts = function(_, opts) --- local cmp = require "cmp" --- local luasnip = require "luasnip" - --- local function has_words_before() --- local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0)) --- return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil --- end - --- cmp.config.sources { --- { name = "nvim_lsp", priority = 1000 }, --- { name = "cmdline", priority = 800 }, --- { name = "path", priority = 250 }, --- } - --- -- `:` cmdline setup. --- cmp.setup.cmdline(":", { --- mapping = cmp.mapping.preset.cmdline { --- [""] = cmp.mapping(function(fallback) --- if cmp.visible() then --- cmp.confirm { select = true } --- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n", true) --- else --- fallback() --- end --- end, { "i", "c" }), --- }, --- sources = cmp.config.sources({ --- { name = "path" }, --- }, { --- { --- name = "cmdline", --- option = { --- -- code for me options for processing command when press enter - --- ignore_cmds = { --- "q", --- "qa", --- "qall", --- "quitall", --- "quit", --- "wall", --- "wq", --- }, --- }, --- }, --- }), --- }) - --- return require("astrocore").extend_tbl(opts, { --- -- Configure window style --- window = { --- completion = { --- winhighlight = "Normal:Pmenu,CursorLine:PmenuSel,Search:None", --- -- border = "none", --- side_padding = 0, --- }, --- }, --- formatting = { --- -- Show icon at the beginning and menu at the end --- fields = { "kind", "abbr", "menu" }, --- format = function(entry, vim_item) --- local kind = require("lspkind").cmp_format { mode = "symbol_text", maxwidth = 50 }(entry, vim_item) --- local strings = vim.split(kind.kind, "%s", { trimetry = true }) --- kind.kind = " " .. (strings[1] or "") .. " " --- kind.menu = " [" .. (strings[2] or "") .. "]" --- return kind --- end, --- }, --- -- Always select the first option --- completion = { --- completeopt = "menu,menuone,noinsert", --- }, --- -- Custom mapping --- mapping = { --- -- Esc to close completion menu --- [""] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() }, - - --- -- Tab to select completion --- [""] = cmp.mapping(function(fallback) --- if cmp.visible() and has_words_before() then --- fallback() --- else --- fallback() --- end --- end, { "i", "s" }), - --- -- Use and to select luasnip --- [""] = cmp.mapping(function(fallback) --- if luasnip.jumpable(1) then --- luasnip.jump(1) --- else --- fallback() --- end --- end, { "i", "s" }), --- [""] = cmp.mapping(function(fallback) --- if luasnip.jumpable(-1) then --- luasnip.jump(-1) --- else --- fallback() --- end --- end, { "i", "s" }), - --- -- NOTE: disable tabl when using copilot PART2 --- vim.api.nvim_set_keymap("i", "", 'copilot#Accept("\\")', { expr = true, silent = true }), --- -- [""] = cmp.mapping(function(fallback) --- -- -- Check if Copilot is suggesting something --- -- if vim.fn["copilot#Accept"]() ~= "" then --- -- else --- -- fallback() -- If no suggestion, fallback to default behavior --- -- end --- -- end, { "i", "s" }), -- Enable in insert and command-line mode --- }, --- experimental = { --- ghost_text = false, -- this feature conflict with copilot.vim's preview. - --- }, --- }) --- end, --- }, - - - --- } -return {} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua deleted file mode 100644 index 5196449..0000000 --- a/lua/plugins/cmp.lua +++ /dev/null @@ -1,187 +0,0 @@ -local function has_words_before() - local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - - - -return { - { - "github/copilot.vim", - event = "BufRead", - config = function() - vim.api.nvim_set_keymap("i", "", 'copilot#Accept("\\")', { expr = true, silent = true }) - end, - }, - -- { "hrsh7th/cmp-buffer", event = "BufRead" }, - -- { "hrsh7th/cmp-path", event = "BufRead" }, - { - "onsails/lspkind.nvim", - opts = { - symbol_map = require("plugins.configs.ui.lspkind"), - }, - }, - { - "saghen/blink.cmp", - event = { "InsertEnter", "CmdlineEnter", "BufEnter" }, - version = "^1", - opts_extend = { "sources.default", "cmdline.sources", "term.sources" }, - opts = { - -- remember to enable your providers here - sources = { - default = { "lsp", "path", "snippets", "buffer" }, - }, - keymap = { - [""] = { "show", "show_documentation", "hide_documentation" }, - [""] = { "select_prev", "fallback" }, - [""] = { "select_next", "fallback" }, - [""] = { "select_next", "show" }, - [""] = { "select_prev", "show" }, - [""] = { "select_next", "fallback" }, - [""] = { "select_prev", "fallback" }, - [""] = { "scroll_documentation_up", "fallback" }, - [""] = { "scroll_documentation_down", "fallback" }, - [""] = { "hide", "fallback" }, - [""] = { "accept", "fallback" }, - [""] = false, - - -- vim.api.nvim_set_keymap("i", "", 'copilot#Accept("\\")', { expr = true, silent = true }), - - [""] = { - "select_next", - "snippet_forward", - function(cmp) - if has_words_before() or vim.api.nvim_get_mode().mode == "c" then - return cmp.show() - end - end, - "fallback", - }, - [""] = { - "select_prev", - "snippet_backward", - function(cmp) - if vim.api.nvim_get_mode().mode == "c" then - return cmp.show() - end - end, - "fallback", - }, - }, - completion = { - list = { selection = { preselect = true, auto_insert = false } }, - ghost_text = { - enabled = false, - }, - menu = { - auto_show = function(ctx) - return ctx.mode ~= "cmdline" - end, - border = "rounded", - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", - draw = { - treesitter = { "lsp" }, - columns = { - { "kind_icon", "label", gap = 1 }, - { "kind" }, - }, - components = { - kind = { - -- (optional) use highlights from mini.icons - highlight = function(ctx) - local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) - return hl - end, - }, - kind_icon = { - text = function(ctx) - local icon = ctx.kind_icon - if vim.tbl_contains({ "Path" }, ctx.source_name) then - local dev_icon, _ = require("nvim-web-devicons").get_icon(ctx.label) - if dev_icon then - icon = dev_icon - end - else - icon = require("lspkind").symbolic(ctx.kind, { - mode = "symbol", - }) - end - - return icon .. ctx.icon_gap - end, - }, - }, - }, - }, - accept = { - auto_brackets = { enabled = true }, - }, - documentation = { - auto_show = true, - auto_show_delay_ms = 0, - window = { - border = "rounded", - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", - }, - }, - }, - signature = { - window = { - border = "rounded", - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder", - }, - }, - }, - specs = { - { - "L3MON4D3/LuaSnip", - optional = true, - specs = { { "Saghen/blink.cmp", opts = { snippets = { preset = "luasnip" } } } }, - }, - { - "AstroNvim/astrolsp", - optional = true, - opts = function(_, opts) - opts.capabilities = require("blink.cmp").get_lsp_capabilities(opts.capabilities) - - -- disable AstroLSP signature help if `blink.cmp` is providing it - local blink_opts = require("astrocore").plugin_opts("blink.cmp") - if vim.tbl_get(blink_opts, "signature", "enabled") == true then - if not opts.features then - opts.features = {} - end - opts.features.signature_help = false - end - end, - }, - { - "folke/lazydev.nvim", - optional = true, - specs = { - { - "Saghen/blink.cmp", - opts = function(_, opts) - if pcall(require, "lazydev.integrations.blink") then - return require("astrocore").extend_tbl(opts, { - sources = { - -- add lazydev to your completion providers - default = { "lazydev" }, - providers = { - lazydev = { - name = "LazyDev", - module = "lazydev.integrations.blink", - score_offset = 100, - }, - }, - }, - }) - end - end, - }, - }, - }, - -- disable built in completion plugins - -- { "hrsh7th/cmp-cmdline", event = "CmdlineEnter" }, - }, - }, -} diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua new file mode 100644 index 0000000..4787974 --- /dev/null +++ b/lua/plugins/completion.lua @@ -0,0 +1,185 @@ +-- Completion and AI Assistance +return { + -- GitHub Copilot + { + "github/copilot.vim", + event = "BufRead", + config = function() + vim.api.nvim_set_keymap("i", "", 'copilot#Accept("\\")', { expr = true, silent = true }) + end, + }, + + -- Blink.cmp (replacement for nvim-cmp) + { + "saghen/blink.cmp", + event = { "InsertEnter", "CmdlineEnter", "BufEnter" }, + version = "^1", + opts_extend = { "sources.default", "cmdline.sources", "term.sources" }, + opts = { + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + keymap = { + [""] = { "show", "show_documentation", "hide_documentation" }, + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_next", "show" }, + [""] = { "select_prev", "show" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback" }, + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + [""] = { "hide", "fallback" }, + [""] = { "accept", "fallback" }, + [""] = false, + [""] = { + "select_next", + "snippet_forward", + function(cmp) + local has_words_before = function() + local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + if has_words_before() or vim.api.nvim_get_mode().mode == "c" then + return cmp.show() + end + end, + "fallback", + }, + [""] = { + "select_prev", + "snippet_backward", + function(cmp) + if vim.api.nvim_get_mode().mode == "c" then + return cmp.show() + end + end, + "fallback", + }, + }, + completion = { + list = { selection = { preselect = true, auto_insert = false } }, + ghost_text = { + enabled = false, + }, + menu = { + auto_show = function(ctx) + return ctx.mode ~= "cmdline" + end, + border = "rounded", + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", + draw = { + treesitter = { "lsp" }, + columns = { + { "kind_icon", "label", gap = 1 }, + { "kind" }, + }, + components = { + kind = { + highlight = function(ctx) + local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + return hl + end, + }, + kind_icon = { + text = function(ctx) + local icon = ctx.kind_icon + if vim.tbl_contains({ "Path" }, ctx.source_name) then + local dev_icon, _ = require("nvim-web-devicons").get_icon(ctx.label) + if dev_icon then + icon = dev_icon + end + else + icon = require("lspkind").symbolic(ctx.kind, { + mode = "symbol", + }) + end + return icon .. ctx.icon_gap + end, + }, + }, + }, + }, + accept = { + auto_brackets = { enabled = true }, + }, + documentation = { + auto_show = true, + auto_show_delay_ms = 0, + window = { + border = "rounded", + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", + }, + }, + }, + signature = { + window = { + border = "rounded", + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder", + }, + }, + }, + specs = { + { + "L3MON4D3/LuaSnip", + optional = true, + specs = { { "Saghen/blink.cmp", opts = { snippets = { preset = "luasnip" } } } }, + }, + { + "AstroNvim/astrolsp", + optional = true, + opts = function(_, opts) + opts.capabilities = require("blink.cmp").get_lsp_capabilities(opts.capabilities) + local blink_opts = require("astrocore").plugin_opts("blink.cmp") + if vim.tbl_get(blink_opts, "signature", "enabled") == true then + if not opts.features then + opts.features = {} + end + opts.features.signature_help = false + end + end, + }, + { + "folke/lazydev.nvim", + optional = true, + specs = { + { + "Saghen/blink.cmp", + opts = function(_, opts) + if pcall(require, "lazydev.integrations.blink") then + return require("astrocore").extend_tbl(opts, { + sources = { + default = { "lazydev" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + score_offset = 100, + }, + }, + }, + }) + end + end, + }, + }, + }, + }, + }, + + -- LSP Kind icons + { + "onsails/lspkind.nvim", + opts = { + symbol_map = require("plugins.configs.ui.lspkind"), + }, + }, + + -- Disabled completion plugins + { "hrsh7th/nvim-cmp", enabled = false }, + { "hrsh7th/cmp-buffer", enabled = false }, + { "hrsh7th/cmp-path", enabled = false }, + { "hrsh7th/cmp-cmdline", enabled = false }, + { "rcarriga/cmp-dap", enabled = false }, + { "saadparwaiz1/cmp_luasnip", enabled = false }, +} diff --git a/lua/plugins/configs/ui/heirline.lua b/lua/plugins/configs/ui/heirline.lua index 6e73700..aa9ba51 100644 --- a/lua/plugins/configs/ui/heirline.lua +++ b/lua/plugins/configs/ui/heirline.lua @@ -12,7 +12,7 @@ M.statusline = { status.component.mode { -- enable mode text with padding as well as an icon before it mode_text = { - icon = { kind = "Mode", padding = { left = 0, right = 1 } }, + icon = { kind = "Mode", padding = { left = 0, right = 0 } }, }, -- surround the component with a separators surround = { @@ -30,7 +30,7 @@ M.statusline = { }, }, status.component.git_branch { - padding = { left = 2, right = 1 }, + padding = { left = 0, right = 1 }, surround = { separator = "none", color = "bg", diff --git a/lua/plugins/development.lua b/lua/plugins/development.lua new file mode 100644 index 0000000..e16006e --- /dev/null +++ b/lua/plugins/development.lua @@ -0,0 +1,106 @@ +-- Development Tools and Debugging +return { + -- LSP End hints + { + "chrisgrieser/nvim-lsp-endhints", + event = "LspAttach", + opts = { + icons = { + type = "󰜁 ", + parameter = "󰏪 ", + offspec = " ", -- hint kind not defined in official LSP spec + unknown = " ", -- hint kind is nil + }, + label = { + truncateAtChars = 100, + padding = 1, + marginLeft = 0, + sameKindSeparator = ", ", + }, + extmark = { + priority = 50, + }, + autoEnableHints = true, + }, + }, + + -- DAP UI (disabled) + { + "rcarriga/nvim-dap-ui", + enabled = false, + requires = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + opts = { + eval = true, + mappings = { + edit = "e", + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + repl = "r", + toggle = "t", + }, + layouts = { + { + elements = { + { + id = "repl", + size = 0.5, + }, + { + id = "console", + size = 0.5, + }, + }, + position = "left", + size = 40, + }, + { + elements = { + { + id = "scopes", + size = 0.25, + }, + { + id = "breakpoints", + size = 0.25, + }, + }, + position = "bottom", + size = 8, + }, + }, + }, + config = function(_, opts) + local dap = require("dap") + local dapui = require("dapui") + dapui.setup(opts) + dap.listeners.after.event_terminated["dapui"] = function() + -- Do nothing, keeping the UI open + end + dap.listeners.after.event_exited["dapui"] = function() + -- Do nothing, keeping the UI open + end + dap.listeners.after.event_initialized["dapui"] = function() + dapui.open() + end + end, + }, + + -- DAP Virtual Text (disabled) + { + "theHamsta/nvim-dap-virtual-text", + enabled = false, + event = "User AstroFile", + opts = { + commented = false, + enabled = true, + enabled_commands = true, + show_stop_reason = true, + virt_text_pos = "eol", + }, + }, + + -- Disabled development plugins + { "mfussenegger/nvim-dap", enabled = false }, + { "jay-babu/mason-nvim-dap.nvim", enabled = false }, +} diff --git a/lua/plugins/disabled.lua b/lua/plugins/disabled.lua index f019100..2195e1f 100644 --- a/lua/plugins/disabled.lua +++ b/lua/plugins/disabled.lua @@ -1,59 +1,61 @@ --- Plugins to disable +-- Disabled Plugins return { - { "s1n7ax/nvim-window-picker", enabled = false }, - { "akinsho/toggleterm.nvim", enabled = false }, - { "NvChad/nvim-colorizer.lua", enabled = false }, - { "catppuccin/nvim", name = "catppuccin", enabled = false }, - { "rebelot/kanagawa.nvim", enabled = false }, - { "folke/tokyonight.nvim", enabled = false }, - { "f4z3r/gruvbox-material.nvim", name = "gruvbox-material", enabled = false }, - { "b0o/SchemaStore.nvim", enabled = false }, - { "ray-x/lsp_signature.nvim", enabled = false }, - { "kmontocam/nvim-conda", enabled = false }, - { "NMAC427/guess-indent.nvim", enabled = false }, - { "lukas-reineke/indent-blankline.nvim", enabled = false }, - { "AstroNvim/astrotheme", enabled = false }, - { "scottmckendry/cyberdream.nvim", enabled = false }, - { "xiyaowong/transparent.nvim", enabled = false }, - { "loctvl842/monokai-pro.nvim", enabled = false }, - { "xiyaowong/transparent.nvim", enabled = false }, - { "iamcco/markdown-preview.nvim", enabled = false }, - { "max397574/better-escape.nvim", enabled = false }, - { "hinell/duplicate.nvim", enabled = false }, - { "CRAG666/code_runner.nvim", enabled = false }, - { "RRethy/vim-illuminate", enabled = false }, - { "kevinhwang91/nvim-ufo", enabled = false }, - { "echasnovski/mini.bufremove", enabled = false }, + -- Themes and Colorschemes + { "catppuccin/nvim", name = "catppuccin", enabled = false }, + { "rebelot/kanagawa.nvim", enabled = false }, + { "folke/tokyonight.nvim", enabled = false }, + { "f4z3r/gruvbox-material.nvim", name = "gruvbox-material", enabled = false }, + { "AstroNvim/astrotheme", enabled = false }, + { "scottmckendry/cyberdream.nvim", enabled = false }, + { "loctvl842/monokai-pro.nvim", enabled = false }, + { "xiyaowong/transparent.nvim", enabled = false }, - { "hrsh7th/nvim-cmp", enabled = false }, - { "rcarriga/cmp-dap", enabled = false }, + -- UI and Interface + { "s1n7ax/nvim-window-picker", enabled = false }, + { "NvChad/nvim-colorizer.lua", enabled = false }, + { "iamcco/markdown-preview.nvim", enabled = false }, + { "lukas-reineke/indent-blankline.nvim", enabled = false }, + { "lazy/nvim-ufo", enabled = false }, - -- System - { "nvim-treesitter/nvim-treesitter-textobjects", enabled = false }, - -- Disable Dap - { "mfussenegger/nvim-dap", enabled = false }, - { "theHamsta/nvim-dap-virtual-text", enabled = false }, - { "rcarriga/nvim-dap-ui", enabled = false }, - { "jay-babu/mason-nvim-dap.nvim", enabled = false }, - -- { "jay-babu/mason-null-ls.nvim", enabled = false }, - { "b0o/schemastore.nvim", enabled = false }, - { "Wansmer/treesj", enabled = false }, + -- Editor Enhancements + { "max397574/better-escape.nvim", enabled = false }, + { "hinell/duplicate.nvim", enabled = false }, + { "CRAG666/code_runner.nvim", enabled = false }, + { "RRethy/vim-illuminate", enabled = false }, + { "echasnovski/mini.bufremove", enabled = false }, + { "akinsho/toggleterm.nvim", enabled = false }, - -- interface - { "ribru17/bamboo.nvim", enabled = true }, + -- Completion + { "hrsh7th/nvim-cmp", enabled = false }, + { "hrsh7th/cmp-buffer", enabled = false }, + { "hrsh7th/cmp-path", enabled = false }, + { "hrsh7th/cmp-cmdline", enabled = false }, + { "rcarriga/cmp-dap", enabled = false }, + { "saadparwaiz1/cmp_luasnip", enabled = false }, - -- service - { "stevearc/resession.nvim", enabled = true }, - { "echasnovski/mini.move", enabled = true }, - { "nvim-neo-tree/neo-tree.nvim", enabled = true }, - { "folke/flash.nvim", enabled = true }, - { "github/copilot.vim", enabled = true }, + -- Development Tools + { "mfussenegger/nvim-dap", enabled = false }, + { "theHamsta/nvim-dap-virtual-text", enabled = false }, + { "rcarriga/nvim-dap-ui", enabled = false }, + { "jay-babu/mason-nvim-dap.nvim", enabled = false }, - { "rafamadriz/friendly-snippets", enabled = false }, - { "JoosepAlviste/nvim-ts-context-commentstring", enabled = false }, - { "windwp/nvim-ts-autotag", enabled = false }, - { "saadparwaiz1/cmp_luasnip", enabled = false }, - { "L3MON4D3/LuaSnip", enabled = true }, + -- Motion and Navigation + { "Wansmer/treesj", enabled = false }, + + -- System + { "nvim-treesitter/nvim-treesitter-textobjects", enabled = false }, + { "b0o/schemastore.nvim", enabled = false }, + + -- Formatting and Snippets + { "rafamadriz/friendly-snippets", enabled = false }, + { "JoosepAlviste/nvim-ts-context-commentstring", enabled = false }, + { "windwp/nvim-ts-autotag", enabled = false }, + + -- Services + { "stevearc/resession.nvim", enabled = true }, + { "echasnovski/mini.move", enabled = true }, + { "nvim-neo-tree/neo-tree.nvim", enabled = true }, + { "folke/flash.nvim", enabled = true }, + { "github/copilot.vim", enabled = true }, + { "L3MON4D3/LuaSnip", enabled = true }, } - --- if true then return {} end diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 850d0e8..98cdd06 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,9 +1,9 @@ --- Plugins that enhance editor experience +-- Editor Enhancements return { + -- Comment management { "numToStr/Comment.nvim", opts = { - -- Ignore empty line ignore = "^$", }, keys = { @@ -21,126 +21,130 @@ return { }, }, }, - -- Built-in terminal support + + -- Auto-save functionality { - "akinsho/toggleterm.nvim", - opts = function(_, opts) - -- Use powershell for toggleterm on windows - -- if vim.fn.has "win32" then opts.shell = "pwsh.exe" end - end, - }, - -- File tagging and navigation - -- { - -- "cbochs/grapple.nvim", - -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- { - -- "AstroNvim/astrocore", - -- opts = function(_, opts) - -- opts.mappings.n[""] = { desc = require("astroui").get_icon("Grapple", 1, true) .. "Grapple" } - -- end, - -- }, - -- }, - -- opts = { - -- scope = "git_branch", - -- }, - -- cmd = { "Grapple" }, - -- keys = { - -- { "a", "Grapple tag", desc = "Add tag to file" }, - -- { "d", "Grapple untag", desc = "Delete tag from file" }, - -- { "e", "Grapple toggle_tags", desc = "Select from tags" }, - -- { "s", "Grapple toggle_scopes", desc = "Select a project scope" }, - -- { "x", "Grapple reset", desc = "Clear tags" }, - -- { "", "Grapple cycle forward", desc = "Select next tag" }, - -- { "", "Grapple cycle backward", desc = "Select previous tag" }, - -- }, - -- }, - -- Better escape support - -- { - -- "max397574/better-escape.nvim", - -- opts = { - -- mapping = { "jj", "kk", "jk" }, - -- }, - -- }, - -- Better indent blankline - -- { - -- "shellRaining/hlchunk.nvim", - -- event = { "BufReadPre", "BufNewFile" }, - -- config = function(_, opts) - -- require("hlchunk").setup(require("astrocore").extend_tbl(opts, { - -- ignore = {}, - -- chunk = { - -- enable = true, - -- notify = false, - -- chars = { - -- -- horizontal_line = "━", - -- -- vertical_line = "┃", - -- -- left_top = "┏", - -- -- left_bottom = "┗", - -- -- right_arrow = "➤", - -- }, - -- style = "#06D001", - -- delay = 25, - -- }, - -- indent = { - -- enable = false, - -- use_treesitter = true, - -- chars = { - -- "│", - -- }, - -- }, - -- blank = { - -- enable = false, - -- chars = { - -- " ", - -- }, - -- style = { - -- { bg = "#434437" }, - -- { bg = "#2f4440" }, - -- { bg = "#433054" }, - -- { bg = "#284251" }, - -- }, - -- }, - -- line_num = { - -- enable = false, - -- }, - -- })) - -- end, - -- }, - -- AI code completion - -- { - -- "monkoose/neocodeium", - -- event = "LspAttach", - -- config = function() - -- local neocodeium = require "neocodeium" - -- neocodeium.setup() - -- vim.keymap.set("n", ";", function() require("neocodeium.commands").toggle() end) - -- vim.keymap.set("i", "", function() require("neocodeium").accept() end) - -- vim.keymap.set("i", "", function() require("neocodeium").accept_word() end) - -- vim.keymap.set("i", "", function() require("neocodeium").accept_line() end) - -- vim.keymap.set("i", "", function() require("neocodeium").cycle_or_complete() end) - -- vim.keymap.set("i", "", function() require("neocodeium").cycle_or_complete(-1) end) - -- vim.keymap.set("i", "", function() require("neocodeium").clear() end) - -- end, - -- }, - -- Multi-cursors support - { - "brenton-leighton/multiple-cursors.nvim", - version = "*", + "okuuva/auto-save.nvim", + event = { "User AstroFile", "InsertEnter" }, + dependencies = { + "AstroNvim/astrocore", + opts = { + autocmds = { + autoformat_toggle = { + { + event = "User", + desc = "Disable autoformat before saving", + pattern = "AutoSaveWritePre", + callback = function() + vim.g.OLD_AUTOFORMAT = vim.g.autoformat + vim.g.autoformat = false + local old_autoformat_buffers = {} + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + if vim.b[bufnr].autoformat then + table.insert(old_autoformat_buffers, bufnr) + vim.b[bufnr].autoformat = false + end + end + vim.g.OLD_AUTOFORMAT_BUFFERS = old_autoformat_buffers + end, + }, + { + event = "User", + desc = "Re-enable autoformat after saving", + pattern = "AutoSaveWritePost", + callback = function() + vim.g.autoformat = vim.g.OLD_AUTOFORMAT + for _, bufnr in ipairs(vim.g.OLD_AUTOFORMAT_BUFFERS or {}) do + vim.b[bufnr].autoformat = true + end + end, + }, + }, + }, + }, + }, opts = {}, - keys = { - { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" } }, - { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" } }, - { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" } }, - { "a", "MultipleCursorsAddMatches", mode = { "n", "x" } }, - { "", "MultipleCursorsAddJumpNextMatch", mode = { "n", "x" } }, + }, + + -- Indent scope highlighting + { + "echasnovski/mini.indentscope", + event = "User AstroFile", + opts = function() + vim.api.nvim_set_hl(0, "MiniIndentscopeSymbol", { fg = "#FF4500" }) + return { + options = { try_as_border = true, border = "both" }, + symbol = require("astrocore").plugin_opts("indent-blankline.nvim").context_char or "󰥓", + draw = { + delay = 0, + animation = function(s, n) return 10 end, + }, + } + end, + dependencies = { + { + "lukas-reineke/indent-blankline.nvim", + optional = true, + opts = { scope = { enabled = false } }, + }, + { + "AstroNvim/astrocore", + opts = { + autocmds = { + mini_indentscope = { + { + event = "FileType", + desc = "Disable indentscope for certain filetypes", + callback = function(event) + if vim.b[event.buf].miniindentscope_disable == nil then + local filetype = vim.bo[event.buf].filetype + local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim" + local ignore_filetypes = { + "aerial", "alpha", "dashboard", "help", "lazy", "mason", "neo-tree", + "NvimTree", "neogitstatus", "notify", "startify", "toggleterm", "Trouble", + } + if vim.tbl_contains(blankline_opts.filetype_exclude or ignore_filetypes, filetype) then + vim.b[event.buf].miniindentscope_disable = true + end + end + end, + }, + { + event = "BufWinEnter", + desc = "Disable indentscope for certain buftypes", + callback = function(event) + if vim.b[event.buf].miniindentscope_disable == nil then + local buftype = vim.bo[event.buf].buftype + local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim" + local ignore_buftypes = { + "nofile", "prompt", "quickfix", "terminal", + } + if vim.tbl_contains(blankline_opts.buftype_exclude or ignore_buftypes, buftype) then + vim.b[event.buf].miniindentscope_disable = true + end + end + end, + }, + { + event = "TermOpen", + desc = "Disable indentscope for terminals", + callback = function(event) + if vim.b[event.buf].miniindentscope_disable == nil then + vim.b[event.buf].miniindentscope_disable = true + end + end, + }, + }, + }, + }, + }, }, }, + -- Better code folding { "kevinhwang91/nvim-ufo", opts = { - -- Add virtual text to show how many lines are folded fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate) local newVirtText = {} local suffix = (" 󰁂 %d "):format(endLnum - lnum) @@ -158,7 +162,6 @@ return { local hlGroup = chunk[2] table.insert(newVirtText, { chunkText, hlGroup }) chunkWidth = vim.fn.strdisplaywidth(chunkText) - -- str width returned from truncate() may less than 2nd argument, need padding if curWidth + chunkWidth < targetWidth then suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) end @@ -171,10 +174,11 @@ return { end, }, }, + -- Better split navigation and resize { "mrjones2014/smart-splits.nvim", - event = "VeryLazy", -- load on very lazy for mux detection + event = "VeryLazy", opts = function(_, opts) opts.ignored_filetypes = { "nofile", "quickfix", "qf", "prompt", "NvimTree" } opts.ignored_buftypes = { "nofile" } @@ -205,31 +209,6 @@ return { mode = { "n" }, desc = "Move to below split", }, - -- { - -- "", - -- function() require("smart-splits").resize_left() end, - -- mode = { "n" }, - -- desc = "Resize split left", - -- }, - -- { - -- "", - -- function() require("smart-splits").resize_right() end, - -- mode = { "n" }, - -- desc = "Resize split right", - -- }, - -- { - -- "", - -- function() require("smart-splits").resize_up() end, - -- mode = { "n" }, - -- desc = "Resize split up", - -- }, - -- { - -- "", - -- function() require("smart-splits").resize_down() end, - -- mode = { "n" }, - -- desc = "Resize split down", - -- }, - { "", function() require("smart-splits").resize_left() end, @@ -242,18 +221,23 @@ return { mode = { "n" }, desc = "Resize split right", }, - -- { - -- "", - -- function() require("smart-splits").resize_up() end, - -- mode = { "n" }, - -- desc = "Resize split up", - -- }, - -- { - -- "", - -- function() require("smart-splits").resize_down() end, - -- mode = { "n" }, - -- desc = "Resize split down", - -- }, }, }, + + -- Built-in terminal support + { + "akinsho/toggleterm.nvim", + enabled = false, + opts = function(_, opts) + -- Use powershell for toggleterm on windows + -- if vim.fn.has "win32" then opts.shell = "pwsh.exe" end + end, + }, + + -- Disabled editor plugins + { "max397574/better-escape.nvim", enabled = false }, + { "hinell/duplicate.nvim", enabled = false }, + { "CRAG666/code_runner.nvim", enabled = false }, + { "RRethy/vim-illuminate", enabled = false }, + { "echasnovski/mini.bufremove", enabled = false }, } diff --git a/lua/plugins/file_explorer.lua b/lua/plugins/file_explorer.lua new file mode 100644 index 0000000..f111e19 --- /dev/null +++ b/lua/plugins/file_explorer.lua @@ -0,0 +1,38 @@ +-- File Explorer and File Management +return { + -- Neo-tree file explorer + { + "nvim-neo-tree/neo-tree.nvim", + opts = { + source_selector = { + winbar = false, + }, + filesystem = { + filtered_items = { + visible = true, + show_hidden_count = true, + hide_dotfiles = false, + hide_gitignored = false, + hide_by_name = {}, + never_show = {}, + never_show_by_pattern = { + "*.zip", + "*.rar", + }, + }, + }, + window = { + mappings = { + ["K"] = false, + ["H"] = false, + }, + }, + enable_git_status = false, + enable_diagnostics = false, + git_status_async = false, + }, + }, + + -- Disabled file explorer plugins + { "s1n7ax/nvim-window-picker", enabled = false }, +} diff --git a/lua/plugins/formatting.lua b/lua/plugins/formatting.lua new file mode 100644 index 0000000..fe1c63d --- /dev/null +++ b/lua/plugins/formatting.lua @@ -0,0 +1,24 @@ +-- Formatting and Linting +return { + -- None-ls formatting + { + "nvimtools/none-ls.nvim", + dependencies = { + "nvimtools/none-ls-extras.nvim", + "jay-babu/mason-null-ls.nvim", + }, + opts = function(_, opts) + local null_ls = require("null-ls") + opts.sources = { + require("none-ls.formatting.ruff").with({ extra_args = { "--extend-select", "F" } }), + require("none-ls.formatting.ruff_format"), + } + return opts + end, + }, + + -- Disabled formatting plugins + { "rafamadriz/friendly-snippets", enabled = false }, + { "JoosepAlviste/nvim-ts-context-commentstring", enabled = false }, + { "windwp/nvim-ts-autotag", enabled = false }, +} diff --git a/lua/plugins/indent-scope.lua b/lua/plugins/indent-scope.lua deleted file mode 100644 index 273de9d..0000000 --- a/lua/plugins/indent-scope.lua +++ /dev/null @@ -1,89 +0,0 @@ -local ignore_filetypes = { - "aerial", - "alpha", - "dashboard", - "help", - "lazy", - "mason", - "neo-tree", - "NvimTree", - "neogitstatus", - "notify", - "startify", - "toggleterm", - "Trouble", -} -local ignore_buftypes = { - "nofile", - "prompt", - "quickfix", - "terminal", -} -local char = "󰥓" - -return { - "echasnovski/mini.indentscope", - event = "User AstroFile", - opts = function() - vim.api.nvim_set_hl(0, "MiniIndentscopeSymbol", { fg = "#FF4500" }) -- Replace #FF4500 with your desired color - return { - options = { try_as_border = true, border = "both" }, - symbol = require("astrocore").plugin_opts("indent-blankline.nvim").context_char or char, - draw = { - delay = 0, - animation = function(s, n) return 10 end, - }, - } - end, - dependencies = { - { - "lukas-reineke/indent-blankline.nvim", - optional = true, - opts = { scope = { enabled = false } }, - }, - { - "AstroNvim/astrocore", - opts = { - autocmds = { - mini_indentscope = { - { - event = "FileType", - desc = "Disable indentscope for certain filetypes", - callback = function(event) - if vim.b[event.buf].miniindentscope_disable == nil then - local filetype = vim.bo[event.buf].filetype - local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim" - if vim.tbl_contains(blankline_opts.filetype_exclude or ignore_filetypes, filetype) then - vim.b[event.buf].miniindentscope_disable = true - end - end - end, - }, - { - event = "BufWinEnter", - desc = "Disable indentscope for certain buftypes", - callback = function(event) - if vim.b[event.buf].miniindentscope_disable == nil then - local buftype = vim.bo[event.buf].buftype - local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim" - if vim.tbl_contains(blankline_opts.buftype_exclude or ignore_buftypes, buftype) then - vim.b[event.buf].miniindentscope_disable = true - end - end - end, - }, - { - event = "TermOpen", - desc = "Disable indentscope for terminals", - callback = function(event) - if vim.b[event.buf].miniindentscope_disable == nil then - vim.b[event.buf].miniindentscope_disable = true - end - end, - }, - }, - }, - }, - }, - }, -} diff --git a/lua/plugins/motion.lua b/lua/plugins/motion.lua index 32af677..7fd1f69 100644 --- a/lua/plugins/motion.lua +++ b/lua/plugins/motion.lua @@ -1,19 +1,25 @@ --- Plugins related to motion +-- Motion, Navigation and Multiple Cursors return { - -- Faster change/delete/replace delimiter pairs - -- { - -- "echasnovski/mini.surround", - -- opts = { n_lines = 200 }, - -- keys = { - -- { "sa", mode = { "n", "x" }, desc = "Add surrounding" }, - -- { "sd", mode = { "n", "x" }, desc = "Delete surrounding" }, - -- { "sr", mode = { "n", "x" }, desc = "Replace surrounding" }, - -- { "sf", mode = { "n", "x" }, desc = "Find right surrounding" }, - -- { "sF", mode = { "n", "x" }, desc = "Find left surrounding" }, - -- { "sh", mode = { "n", "x" }, desc = "Highlight surrounding" }, - -- { "sn", mode = { "n", "x" }, desc = "Update `MiniSurround.config.n_lines`" }, - -- }, - -- }, + -- Multi-cursors support + { + "brenton-leighton/multiple-cursors.nvim", + version = "*", + opts = {}, + keys = { + { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" } }, + { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" } }, + { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" } }, + { "a", "MultipleCursorsAddMatches", mode = { "n", "x" } }, + { "", "MultipleCursorsAddJumpNextMatch", mode = { "n", "x" } }, + }, + }, + + -- Alternative multi-cursor plugin + { + "mg979/vim-visual-multi", + event = "BufRead", + }, + -- Brackets splitjoin { "Wansmer/treesj", @@ -26,6 +32,7 @@ return { { "gs", "TSJToggle", mode = { "n" }, desc = "Toggle splitjoin" }, }, }, + -- Better move by word { "chrisgrieser/nvim-spider", @@ -37,6 +44,7 @@ return { { "ge", "lua require('spider').motion('ge')", mode = { "n", "o", "x" }, desc = "Spider-ge" }, }, }, + -- Better character motion { "folke/flash.nvim", @@ -59,6 +67,7 @@ return { }, }, }, + -- Move code block { "echasnovski/mini.move", @@ -78,4 +87,7 @@ return { } end, }, + + -- Disabled motion plugins + { "Wansmer/treesj", enabled = false }, } diff --git a/lua/plugins/multiple.lua b/lua/plugins/multiple.lua deleted file mode 100644 index c11af58..0000000 --- a/lua/plugins/multiple.lua +++ /dev/null @@ -1,49 +0,0 @@ -return { - { - "brenton-leighton/multiple-cursors.nvim", - event = "BufRead", - cmd = { - "MultipleCursorsAddDown", - "MultipleCursorsAddUp", - "MultipleCursorsMouseAddDelete", - "MultipleCursorsAddMatches", - "MultipleCursorsAddMatchesV", - "MultipleCursorsAddJumpNextMatch", - "MultipleCursorsJumpNextMatch", - "MultipleCursorsLock", - }, - dependencies = { - "AstroNvim/astrocore", - opts = function(_, opts) - local maps = opts.mappings - for lhs, map in pairs { - [""] = { "MultipleCursorsAddDown", desc = "Add cursor down" }, - [""] = { "MultipleCursorsAddUp", desc = "Add cursor up" }, - [""] = { "MultipleCursorsMouseAddDelete", desc = "Add cursor with mouse" }, - } do - maps.n[lhs] = map - maps.i[lhs] = map - end - local prefix = "c" - for lhs, map in pairs { - [prefix .. "a"] = { "MultipleCursorsAddMatches", desc = "Add cursor matches" }, - [prefix .. "A"] = { - "MultipleCursorsAddMatchesV", - desc = "Add cursor matches in previous visual area", - }, - [prefix .. "j"] = { "MultipleCursorsAddJumpNextMatch", desc = "Add cursor and jump to next match" }, - [prefix .. "J"] = { "MultipleCursorsJumpNextMatch", desc = "Move cursor to next match" }, - [prefix .. "l"] = { "MultipleCursorsLock", desc = "Lock virtual cursors" }, - } do - maps.n[lhs] = map - maps.x[lhs] = map - end - end, - }, - opts = {}, - }, - { - "mg979/vim-visual-multi", - event = "BufRead", - }, -} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua deleted file mode 100644 index f068129..0000000 --- a/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - opts = { - source_selector = { - winbar = false, - }, - filesystem = { - filtered_items = { - visible = true, - show_hidden_count = true, - hide_dotfiles = false, -- always show dotfiles - hide_gitignored = false, -- always show gitignored - hide_by_name = {}, - never_show = {}, - never_show_by_pattern = { -- uses glob style patterns - "*.zip", - "*.rar", - -- "*.pdf", - }, - }, - }, - window = { - mappings = { - ["K"] = false, -- disable Shift+k - ["H"] = false, -- disable Shift+k - }, - }, - enable_git_status = false, - enable_diagnostics = false, - git_status_async = false, - }, -} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua deleted file mode 100644 index 0d6e231..0000000 --- a/lua/plugins/noice.lua +++ /dev/null @@ -1,134 +0,0 @@ -return { - "folke/noice.nvim", - event = "VeryLazy", - dependencies = { "MunifTanjim/nui.nvim" }, - config = function() - require("noice").setup({ - -- Configuration here, or leave empty to use defaults - views = {}, - messages = { - enabled = false, -- disables the Noice messages UI - }, - notify = { - enabled = false, -- disables Noice notifications - }, - lsp = { - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, - }, - progress = { - enabled = true, - }, - hover = { - enabled = true, - silent = true, - view = nil, - opts = { - border = { - style = "rounded", - text = { top = " Documents ", top_align = "center" }, - }, - win_options = { - wrap = true, - linebreak = true, - }, - buf_options = { - filetype = "markdown", - }, - }, - }, - signature = { - enabled = false, -- disables Noice LSP signature help - }, - message = { - enabled = false, - }, - }, - markdown = {}, - - presets = { - bottom_search = false, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - - routes = { - -- disable "written" notification - { - filter = { event = "msg_show", kind = "", find = "written" }, - opts = { skip = true }, - }, - -- disable paste/undo notification - { - filter = { event = "msg_show", find = "^%d+ more lines" }, - opts = { skip = true }, - }, - -- disable delete/undo notification - { - filter = { event = "msg_show", find = "^%d+ fewer lines" }, - opts = { skip = true }, - }, - -- disable yank notification - { - filter = { event = "msg_show", find = "^%d+ lines yanked$" }, - opts = { skip = true }, - }, - -- disable move notification - { - filter = { event = "msg_show", find = "^%d+ lines moved$" }, - }, - }, - }) - end, - specs = { - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if opts.ensure_installed ~= "all" then - opts.ensure_installed = require("astrocore").list_insert_unique( - opts.ensure_installed, - { "bash", "markdown", "markdown_inline", "regex", "vim", "latex", "bibtex" } - ) - end - end, - }, - { - "AstroNvim/astrolsp", - optional = true, - ---@param opts AstroLSPOpts - opts = function(_, opts) - -- No need to manage lsp_handlers as noice is not handling them now - end, - }, - { - "heirline.nvim", - optional = true, - opts = function(_, opts) - local noice_opts = require("astrocore").plugin_opts("noice.nvim") - if vim.tbl_get(noice_opts, "lsp", "progress", "enabled") ~= false then -- check if lsp progress is enabled - opts.statusline[9] = require("astroui.status").component.lsp({ lsp_progress = false }) - end - end, - }, - { - "folke/edgy.nvim", - optional = true, - opts = function(_, opts) - if not opts.bottom then - opts.bottom = {} - end - table.insert(opts.bottom, { - ft = "noice", - size = { height = 0.4 }, - filter = function(_, win) - return vim.api.nvim_win_get_config(win).relative == "" - end, - }) - end, - }, - }, -} diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua deleted file mode 100644 index 419a9f9..0000000 --- a/lua/plugins/none-ls.lua +++ /dev/null @@ -1,21 +0,0 @@ --- Customize None-ls sources - ----@type LazySpec -return { - "nvimtools/none-ls.nvim", - dependencies = { - "nvimtools/none-ls-extras.nvim", - "jay-babu/mason-null-ls.nvim", - }, - opts = function(_, opts) - -- config variable is the default configuration table for the setup function call - local null_ls = require("null-ls") - - opts.sources = { - require("none-ls.formatting.ruff").with({ extra_args = { "--extend-select", "F" } }), - require("none-ls.formatting.ruff_format"), -- Set a formatter - - } - return opts - end, -} diff --git a/lua/plugins/nvim-context-vt.lua b/lua/plugins/nvim-context-vt.lua deleted file mode 100644 index c1e30e3..0000000 --- a/lua/plugins/nvim-context-vt.lua +++ /dev/null @@ -1,22 +0,0 @@ ----@type LazySpec -return { - "andersevenrud/nvim_context_vt", - event = "User AstroFile", - cmd = { "NvimContextVtToggle" }, - dependencies = { - "AstroNvim/astrocore", - ---@type AstroCoreOpts - opts = { - mappings = { - n = { - ["uv"] = { - function() - require("nvim_context_vt").toggle() - end, - desc = "Toggle virutal text context", - }, - }, - }, - }, - }, -} diff --git a/lua/plugins/nvim-context.lua b/lua/plugins/nvim-context.lua deleted file mode 100644 index fae37b6..0000000 --- a/lua/plugins/nvim-context.lua +++ /dev/null @@ -1,28 +0,0 @@ ----@type LazySpec -return { - "nvim-treesitter/nvim-treesitter-context", - event = "User AstroFile", - cmd = { "TSContext" }, - opts = { - -- không có option trực tiếp cho border, nên ta set highlight ở đây - on_attach = function() - vim.api.nvim_set_hl(0, "TreesitterContext", { underline = true, sp = "Red", bg = "#1e1e3f" }) - end, - max_lines = 2, -- 0 means no limit - - }, - dependencies = { - "AstroNvim/astrocore", - ---@type AstroCoreOpts - opts = { - mappings = { - n = { - ["uT"] = { - "TSContext toggle", - desc = "Toggle treesitter context", - }, - }, - }, - }, - }, -} diff --git a/lua/plugins/nvim-dap-ui.lua b/lua/plugins/nvim-dap-ui.lua deleted file mode 100644 index e26b067..0000000 --- a/lua/plugins/nvim-dap-ui.lua +++ /dev/null @@ -1,107 +0,0 @@ -return { - -- { - -- { - -- "rcarriga/nvim-dap-ui", - -- requires = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, - -- opts = { - -- eval = true, - -- mappings = { - -- edit = "e", - -- expand = { "", "<2-LeftMouse>" }, - -- open = "o", - -- remove = "d", - -- repl = "r", - -- toggle = "t", - -- }, - - -- layouts = { - -- { - -- elements = { - -- { - -- id = "repl", - -- size = 0.5, - -- }, - -- { - -- id = "console", - -- size = 0.5, - -- }, - -- }, - -- position = "left", - -- size = 40, - -- }, - -- { - -- elements = { - -- { - -- id = "scopes", - -- size = 0.25, - -- }, - -- { - -- id = "breakpoints", - -- size = 0.25, - -- }, - -- -- { - -- -- id = "stacks", - -- -- size = 0.25, - -- -- }, - -- }, - -- position = "bottom", - -- size = 8, - -- }, - -- }, - -- }, - -- config = function(_, opts) - -- local dap = require("dap") - -- local dapui = require("dapui") - - -- -- Initialize dap-ui - -- dapui.setup(opts) - - -- -- Prevent UI from closing when debugging session ends - -- dap.listeners.after.event_terminated["dapui"] = function() - -- -- Do nothing, keeping the UI open - -- end - -- dap.listeners.after.event_exited["dapui"] = function() - -- -- Do nothing, keeping the UI open - -- end - - -- -- Optionally, open dap-ui when session starts - -- dap.listeners.after.event_initialized["dapui"] = function() - -- dapui.open() - -- end - -- end, - -- }, - -- { - -- "theHamsta/nvim-dap-virtual-text", - -- event = "User AstroFile", - -- opts = { - -- commented = false, - -- enabled = true, - -- enabled_commands = true, - -- show_stop_reason = true, - -- virt_text_pos = "eol", - -- }, - -- }, - -- }, - { - "chrisgrieser/nvim-lsp-endhints", - event = "LspAttach", - opts = { - icons = { - type = "󰜁 ", - parameter = "󰏪 ", - offspec = " ", -- hint kind not defined in official LSP spec - unknown = " ", -- hint kind is nil - }, - label = { - truncateAtChars = 100, - padding = 1, - marginLeft = 0, - sameKindSeparator = ", ", - }, - extmark = { - priority = 50, - }, - autoEnableHints = true, - }, - }, -} diff --git a/lua/plugins/snippets.lua b/lua/plugins/snippets.lua new file mode 100644 index 0000000..b69ed75 --- /dev/null +++ b/lua/plugins/snippets.lua @@ -0,0 +1,12 @@ +-- Snippets +return { + -- LuaSnip + { + "L3MON4D3/LuaSnip", + enabled = true, + }, + + -- Disabled snippet plugins + { "rafamadriz/friendly-snippets", enabled = false }, + { "saadparwaiz1/cmp_luasnip", enabled = false }, +} diff --git a/lua/plugins/colorschemes.lua b/lua/plugins/themes.lua similarity index 74% rename from lua/plugins/colorschemes.lua rename to lua/plugins/themes.lua index 7f3a841..4722559 100644 --- a/lua/plugins/colorschemes.lua +++ b/lua/plugins/themes.lua @@ -1,10 +1,27 @@ +-- Themes and Colorschemes return { + -- Main colorscheme + { + "ribru17/bamboo.nvim", + lazy = false, + priority = 1000, + config = function() + require("bamboo").setup { + integrations = { mini = true }, + terminal_colors = false + } + require("bamboo").load() + end, + }, + + -- Alternative themes (disabled) { "catppuccin/nvim", name = "catppuccin", + enabled = false, opts = { - flavour = "mocha", -- latte, frappe, macchiato, mocha - background = { -- :h background + flavour = "mocha", + background = { light = "latte", dark = "mocha", }, @@ -61,19 +78,15 @@ return { }, }, }, - - -- Using lazy.nvim - { - "ribru17/bamboo.nvim", - lazy = false, - priority = 1000, - config = function() - require("bamboo").setup { - -- optional configuration here - integrations = { mini = true }, - terminal_colors = false - } - require("bamboo").load() - end, - }, + + -- Disabled themes + { "rebelot/kanagawa.nvim", enabled = false }, + { "folke/tokyonight.nvim", enabled = false }, + { "f4z3r/gruvbox-material.nvim", name = "gruvbox-material", enabled = false }, + { "AstroNvim/astrotheme", enabled = false }, + { "scottmckendry/cyberdream.nvim", enabled = false }, + { "loctvl842/monokai-pro.nvim", enabled = false }, + + -- Transparent background + { "xiyaowong/transparent.nvim", enabled = false }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 2d7f7a1..e824f22 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,172 +1,295 @@ --- Plugins related to UI +-- UI and Interface Enhancements return { - { - "goolord/alpha-nvim", - dependencies = { "echasnovski/mini.icons" }, - opts = function(_, opts) - -- customize the dashboard header - opts.section.header.val = require("plugins.configs.ui.alpha")[10] - opts.section.buttons.val = {} - end, - -- config = function() require("alpha").setup(require("alpha.themes.startify").config) end, - }, - { - "rebelot/heirline.nvim", - opts = function(_, opts) - opts.statusline = require("plugins.configs.ui.heirline").statusline - opts.winbar = require("plugins.configs.ui.heirline").winbar - end, - }, - { - "rcarriga/nvim-notify", - opts = function(_, opts) - -- Do this to prevent the warning - opts.background_colour = "#000000" - opts.timeout = 2000 - opts.fps = 60 - opts.render = "compact" - opts.top_down = false - end, - }, + -- Dashboard + { + "goolord/alpha-nvim", + dependencies = { "echasnovski/mini.icons" }, + opts = function(_, opts) + opts.section.header.val = require("plugins.configs.ui.alpha")[10] + opts.section.buttons.val = {} + end, + }, - -- Transparent background - -- { - -- "xiyaowong/transparent.nvim", - -- lazy = false, - -- opts = function(_, opts) opts = require "plugins.configs.ui.transparent"(opts) end, - -- keys = { - -- { "uT", "TransparentToggle", desc = "Toggle transparent" }, - -- }, - -- }, - -- { - -- { - -- "HiPhish/rainbow-delimiters.nvim", - -- dependencies = { - -- "nvim-treesitter/nvim-treesitter", - -- { - -- "AstroNvim/astrocore", - -- opts = { - -- mappings = { - -- n = { - -- ["u("] = { - -- function() - -- local bufnr = vim.api.nvim_get_current_buf() - -- require("rainbow-delimiters").toggle(bufnr) - -- require("astrocore").notify( - -- string.format( - -- "Buffer rainbow delimeters %s", - -- require("rainbow-delimiters").is_enabled(bufnr) and "on" or "off" - -- ) - -- ) - -- end, - -- desc = "Toggle rainbow delimeters (buffer)", - -- }, - -- }, - -- }, - -- }, - -- }, - -- }, - -- event = "User AstroFile", - -- main = "rainbow-delimiters.setup", - -- opts = {}, - -- }, - -- }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below + -- Status line + { + "rebelot/heirline.nvim", + opts = function(_, opts) + opts.statusline = require("plugins.configs.ui.heirline").statusline + opts.winbar = require("plugins.configs.ui.heirline").winbar + end, + }, - keywords = { - FIX = { - icon = " ", -- icon used for the sign, and in search results - color = "error", -- can be a hex color, or a named color (see below) - alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords - -- signs = false, -- configure signs for some keywords individually - }, - TODO = { icon = " ", color = "info" }, - GOAL = { icon = " ", color = "info", alt = { "GOALS", "TARGETS", "FIXED" } }, - HACK = { icon = " ", color = "warning" }, - WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, - PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, - TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, - }, - }, - }, - { - "altermo/ultimate-autopair.nvim", - event = "InsertEnter", - branch = "v0.6", --recommended as each new version will have breaking changes - opts = { - -- disable autopair in the command line: https://github.com/altermo/ultimate-autopair.nvim/issues/8 - cmap = false, - extensions = { - cond = { - -- disable in comments - -- https://github.com/altermo/ultimate-autopair.nvim/blob/6fd0d6aa976a97dd6f1bed4d46be1b437613a52f/Q%26A.md?plain=1#L26 - cond = { - function(fn) - return not fn.in_node("comment") - end, + -- Notifications + { + "rcarriga/nvim-notify", + opts = function(_, opts) + opts.background_colour = "#000000" + opts.timeout = 2000 + opts.fps = 60 + opts.render = "compact" + opts.top_down = false + end, + }, + + -- Todo comments highlighting + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + }, + TODO = { icon = " ", color = "info" }, + GOAL = { icon = " ", color = "info", alt = { "GOALS", "TARGETS", "FIXED" } }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + }, + }, + + -- Smart bracket pairing + { + "altermo/ultimate-autopair.nvim", + event = "InsertEnter", + branch = "v0.6", + opts = { + cmap = false, + extensions = { + cond = { + cond = { + function(fn) + return not fn.in_node("comment") + end, + }, + }, + fly = { + nofilter = true, + }, + }, + config_internal_pairs = { + { '"', '"', fly = true }, + { "'", "'", fly = true }, + { "[", "]", fly = true }, + { "{", "}", fly = true }, + { "(", ")", fly = true }, + }, + }, + dependencies = { + { + "AstroNvim/astrocore", + opts = { + mappings = { + n = { + ["ua"] = { + desc = "Toggle Ultimate Autopair", + function() + local notify = require("astrocore").notify + local function bool2str(bool) + return bool and "on" or "off" + end + local ok, ultimate_autopair = pcall(require, "ultimate-autopair") + if ok then + ultimate_autopair.toggle() + vim.g.ultimate_autopair_enabled = require("ultimate-autopair.core").disable + notify( + string.format( + "ultimate-autopair %s", + bool2str(not vim.g.ultimate_autopair_enabled) + ) + ) + else + notify("ultimate-autopair not available") + end + end, + }, + }, + }, + }, + }, + }, + specs = { + { + "windwp/nvim-autopairs", + optional = true, + enabled = false, + }, + }, + }, + + -- Treesitter context + { + "nvim-treesitter/nvim-treesitter-context", + event = "User AstroFile", + cmd = { "TSContext" }, + opts = { + on_attach = function() + vim.api.nvim_set_hl(0, "TreesitterContext", { underline = true, sp = "Red", bg = "#1e1e3f" }) + end, + max_lines = 2, + }, + dependencies = { + "AstroNvim/astrocore", + opts = { + mappings = { + n = { + ["uT"] = { + "TSContext toggle", + desc = "Toggle treesitter context", + }, + }, + }, + }, + }, + }, + + -- Virtual text context + { + "andersevenrud/nvim_context_vt", + event = "User AstroFile", + cmd = { "NvimContextVtToggle" }, + dependencies = { + "AstroNvim/astrocore", + opts = { + mappings = { + n = { + ["uv"] = { + function() + require("nvim_context_vt").toggle() + end, + desc = "Toggle virutal text context", + }, + }, + }, + }, + }, + }, + + -- Noice UI + { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { "MunifTanjim/nui.nvim" }, + config = function() + require("noice").setup({ + views = {}, + messages = { + enabled = false, + }, + notify = { + enabled = false, + }, + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, }, - }, - -- get fly mode working on strings: - -- https://github.com/altermo/ultimate-autopair.nvim/issues/33 - fly = { - nofilter = true, - }, - }, - config_internal_pairs = { - { '"', '"', fly = true }, - { "'", "'", fly = true }, - { "[", "]", fly = true }, - { "{", "}", fly = true }, - { "(", ")", fly = true }, - -- { "<", ">", fly = true }, - }, - }, - dependencies = { - { - "AstroNvim/astrocore", - opts = { - mappings = { - n = { - ["ua"] = { - desc = "Toggle Ultimate Autopair", - function() - local notify = require("astrocore").notify - local function bool2str(bool) - return bool and "on" or "off" - end - local ok, ultimate_autopair = pcall(require, "ultimate-autopair") - if ok then - ultimate_autopair.toggle() - vim.g.ultimate_autopair_enabled = require("ultimate-autopair.core").disable - notify( - string.format( - "ultimate-autopair %s", - bool2str(not vim.g.ultimate_autopair_enabled) - ) - ) - else - notify("ultimate-autopair not available") - end - end, - }, - }, + progress = { + enabled = false, -- Disable LSP progress }, - }, - }, - }, - specs = { - { - "windwp/nvim-autopairs", - optional = true, - enabled = false, - }, - }, - }, + hover = { + enabled = true, + silent = true, + view = nil, + opts = { + border = { + style = "rounded", + text = { top = " Documents ", top_align = "center" }, + }, + win_options = { + wrap = true, + linebreak = true, + }, + buf_options = { + filetype = "markdown", + }, + }, + }, + signature = { + enabled = false, + }, + message = { + enabled = false, + }, + }, + markdown = {}, + presets = { + bottom_search = false, + command_palette = true, + long_message_to_split = true, + inc_rename = false, + lsp_doc_border = false, + }, + routes = { + { + filter = { event = "msg_show", kind = "", find = "written" }, + opts = { skip = true }, + }, + { + filter = { event = "msg_show", find = "^%d+ more lines" }, + opts = { skip = true }, + }, + { + filter = { event = "msg_show", find = "^%d+ fewer lines" }, + opts = { skip = true }, + }, + { + filter = { event = "msg_show", find = "^%d+ lines yanked$" }, + opts = { skip = true }, + }, + { + filter = { event = "msg_show", find = "^%d+ lines moved$" }, + }, + }, + }) + end, + specs = { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if opts.ensure_installed ~= "all" then + opts.ensure_installed = require("astrocore").list_insert_unique( + opts.ensure_installed, + { "bash", "markdown", "markdown_inline", "regex", "vim", "latex", "bibtex" } + ) + end + end, + }, + { + "AstroNvim/astrolsp", + optional = true, + opts = function(_, opts) + -- No need to manage lsp_handlers as noice is not handling them now + end, + }, + + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + if not opts.bottom then + opts.bottom = {} + end + table.insert(opts.bottom, { + ft = "noice", + size = { height = 0.4 }, + filter = function(_, win) + return vim.api.nvim_win_get_config(win).relative == "" + end, + }) + end, + }, + }, + }, + + -- Disabled UI plugins + { "s1n7ax/nvim-window-picker", enabled = false }, + { "NvChad/nvim-colorizer.lua", enabled = false }, + { "iamcco/markdown-preview.nvim", enabled = false }, }