diff --git a/init.lua b/init.lua index 3ba2447..5b77a8f 100644 --- a/init.lua +++ b/init.lua @@ -26,5 +26,3 @@ end require "lazy_setup" require "polish" -vim.g.copilot_no_tab_map = true - diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index 3d30478..7291ec3 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -5,7 +5,7 @@ vim.api.nvim_create_augroup("auto_wrap", { clear = true }) vim.api.nvim_create_augroup("disable_suspend_with_c_z", { clear = true }) vim.api.nvim_create_augroup("clear_last_search", { clear = true }) -vim.keymap.set("v", "K", "", { silent = true }) +-- vim.keymap.set("v", "K", "", { silent = true }) vim.api.nvim_create_autocmd("BufEnter", { desc = "Disable auto insert comment newline", diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 1c24138..23155f4 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -23,43 +23,21 @@ return function() ----------- Utility functions ------------- ------------------------------------------- mappings.n[""] = { "u", desc = "Undo" } - -- mappings.n[""] = { "u", desc = "Undo" } - -- mappings.n["K"] = { function() vim.lsp.buf.hover() end, desc = "Hover symbol details"} - mappings.i[""] = { "u", desc = "Undo" } mappings.i[""] = { "dw", desc = "Delete a word backward" } mappings.i[""] = { "w!", desc = "Save file" } mappings.i["jj"] = { "", desc = "Normal mode" } - + mappings.i[""] = { "", desc = "Unindent line" } mappings.v[""] = { ">gv", desc = "Indent line" } mappings.v[""] = { "", desc = "Ignore error when hover on visual" } ------ Motions related to jumping or selecting ------ - -- for key, map in pairs { - -- ["H"] = { "^", desc = "Jump to beginning of line" }, - -- ["L"] = { "$", desc = "Jump to end of line" }, - -- ["K"] = { "5k", desc = "Move up 5 lines" }, - -- ["J"] = { "5j", desc = "Move down 5 lines" }, - -- } do - -- mappings.n[key] = map - -- mappings.v[key] = map - -- end mappings.n[""] = { "ggVG", desc = "Select all lines" } ------ My customs keybinding ------ mappings.n["xn"] = { "Telescope notify", desc = "Notifications" } - - return mappings + return mappings end diff --git a/lua/core/options.lua b/lua/core/options.lua index 90df014..6270901 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -21,7 +21,7 @@ return { tabstop = 2, -- set the number of space in a tab to 4 softtabstop = 2, -- can be differnt from tabstop showtabline = 0, -- always show tabline - expandtab = true, -- use spaces instead of tab + expandtab = false, -- use spaces instead of tab undofile = true, -- enable persistent undo }, -- vim.g. @@ -29,5 +29,6 @@ return { -- configure global vim variables (vim.g) -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` -- This can be found in the `lua/lazy_setup.lua` file + copilot_no_tab_map = true, }, } diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 02e5fdc..fa50ee3 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -98,36 +98,6 @@ return { -- 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 @@ -153,7 +123,6 @@ return { 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 @@ -175,7 +144,6 @@ return { 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 @@ -186,9 +154,6 @@ return { 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/astroui.lua b/lua/plugins/astroui.lua index 752079e..974b960 100644 --- a/lua/plugins/astroui.lua +++ b/lua/plugins/astroui.lua @@ -9,7 +9,7 @@ return { ---@type AstroUIOpts opts = { -- change colorscheme - colorscheme = "bamboo", + colorscheme = "bamboo-multiplex", -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes highlights = require "plugins.configs.ui.highlights", diff --git a/lua/plugins/configs/lsp/config/basedpyright.lua b/lua/plugins/configs/lsp/config/basedpyright.lua index afbaa69..837cd59 100644 --- a/lua/plugins/configs/lsp/config/basedpyright.lua +++ b/lua/plugins/configs/lsp/config/basedpyright.lua @@ -1,38 +1,33 @@ return { - before_init = function(_, c) - if not c.settings then - c.settings = {} - end - if not c.settings.python then - c.settings.python = {} - end - c.settings.python.pythonPath = vim.fn.exepath("python") - end, - settings = { - basedpyright = { - disableLanguageServices = false, - disableOrganizeImports = true, - disableTaggedHints = true, - - analysis = { - autoSearchPath = false, - logLevel = "Trace", - typeCheckingMode = "standard", - deprecateTypingAliases = false, - inlayHints = { - variableTypes = true, - functionReturnTypes = true, - callArgumentNames = true, - pytestParameters = true, - }, - ignore = { - "unsloth_compiled_cache", - "__pycache__", - "__index__", - }, - useLibraryCodeForTypes = true, - }, - autoImportCompletions = false, - }, - }, + before_init = function(_, c) + if not c.settings then c.settings = {} end + if not c.settings.python then c.settings.python = {} end + c.settings.python.pythonPath = vim.fn.exepath "python" + end, + settings = { + basedpyright = { + disableLanguageServices = false, + disableOrganizeImports = true, + disableTaggedHints = true, + useLibraryCodeForTypes = true, + analysis = { + autoSearchPath = false, + logLevel = "Trace", + typeCheckingMode = "standard", + deprecateTypingAliases = false, + inlayHints = { + variableTypes = true, + callArgumentNames = false, + functionReturnTypes = true, + genericTypes = true, + }, + ignore = { + "**/unsloth_compiled_cache/**", + "**/__pycache__/**", + "__index__", + }, + autoImportCompletions = false, + }, + }, + }, } diff --git a/lua/plugins/configs/lsp/config/jedi_language.lua b/lua/plugins/configs/lsp/config/jedi_language.lua index 9ad8f9d..aff58d5 100644 --- a/lua/plugins/configs/lsp/config/jedi_language.lua +++ b/lua/plugins/configs/lsp/config/jedi_language.lua @@ -12,9 +12,10 @@ return { }, workspace = { -- environmentPath = "/home/duckq1u/miniconda3/envs/OCR3/bin/python", - environmentPath = vim.fn.exepath("python"), + environmentPath = vim.fn.exepath "python", ignore = { "/home/duckq1u/miniconda3/envs/OCR3/lib/python3.11/site-packages/transformers/mode ls/albert/configuration_albert.py", + "**/unsloth_compiled_cache/**", }, }, diff --git a/lua/plugins/configs/ui/indent.lua b/lua/plugins/configs/ui/indent.lua index f8b1142..f9383eb 100644 --- a/lua/plugins/configs/ui/indent.lua +++ b/lua/plugins/configs/ui/indent.lua @@ -18,15 +18,15 @@ return { }, }, scope = { - enabled = false, -- enable highlighting the current scope + enabled = true, -- enable highlighting the current scope priority = 200, - char = "󰥓", + char = "", underline = false, -- underline the start of the scope only_current = false, -- only show scope in the current window hl = "SnacksIndentScope", ---@type string|string[] hl group for scopes }, chunk = { - enabled = true, + enabled = false, char = { corner_top = "┏", corner_bottom = "┗", diff --git a/lua/plugins/contexts.lua b/lua/plugins/contexts.lua index 50fb781..210f2f5 100644 --- a/lua/plugins/contexts.lua +++ b/lua/plugins/contexts.lua @@ -1,49 +1,51 @@ - -- Treesitter context -return { +-- Treesitter context +return { { - "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", - }, - }, - }, - }, - }, - }, + "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", - }, - }, - }, - }, - }, - } + -- Virtual text context + { + "andersevenrud/nvim_context_vt", + event = "User AstroFile", + cmd = { "NvimContextVtToggle" }, + opts = { + prefix = " ", + -- disable_virtual_lines = true, + }, + dependencies = { + "AstroNvim/astrocore", + opts = { + mappings = { + n = { + ["uv"] = { + function() require("nvim_context_vt").toggle() end, + desc = "Toggle virutal text context", + }, + }, + }, + }, + }, + }, } diff --git a/lua/plugins/disabled.lua b/lua/plugins/disabled.lua index b354445..9bb7070 100644 --- a/lua/plugins/disabled.lua +++ b/lua/plugins/disabled.lua @@ -1,9 +1,10 @@ return { { "Wansmer/treesj", enabled = false }, - -- You can disable default plugins as follows: + -- You can disable default plugins as follows: { "max397574/better-escape.nvim", enabled = false }, { "andweeb/presence.nvim", enabled = false }, + { "s1n7ax/nvim-window-picker", enabled = false }, -- Disabled formatting plugins { "rafamadriz/friendly-snippets", enabled = false }, @@ -13,6 +14,5 @@ return { -- Disabled development plugins { "mfussenegger/nvim-dap", enabled = false }, { "jay-babu/mason-nvim-dap.nvim", enabled = false }, - {"brenton-leighton/multiple-cursors.nvim", enabled = false} + { "brenton-leighton/multiple-cursors.nvim", enabled = false }, } - diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index ef17d47..920b3e6 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -28,8 +28,8 @@ return { package_installed = "  ", package_pending = "  ", package_uninstalled = "  ", - } - } + }, + }, }, }, } diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 1f20622..35f411e 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -26,6 +26,7 @@ return { ["K"] = false, ["H"] = false, }, + width = 50 }, enable_git_status = false, enable_diagnostics = false, @@ -34,6 +35,5 @@ return { }, -- Disabled file explorer plugins - { "s1n7ax/nvim-window-picker", enabled = false }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 8827d2f..d8d9adf 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -6,19 +6,19 @@ return { config = function() require("bamboo").setup { integrations = { mini = true }, - terminal_colors = false + terminal_colors = false, } require("bamboo").load() end, }, { - "rebelot/heirline.nvim", - opts = function(_, opts) - opts.statusline = require("plugins.configs.ui.heirline").statusline - opts.winbar = require("plugins.configs.ui.heirline").winbar - end, - }, - { + "rebelot/heirline.nvim", + opts = function(_, opts) + opts.statusline = require("plugins.configs.ui.heirline").statusline + opts.winbar = require("plugins.configs.ui.heirline").winbar + end, + }, + { "folke/which-key.nvim", event = "VeryLazy", opts = { @@ -36,8 +36,6 @@ return { function() require("which-key").show { global = false } end, desc = "Buffer Local Keymaps (which-key)", }, - }, - } + }, } - diff --git a/lua/plugins/user.lua b/lua/plugins/user.lua index a1c5c4e..d1e288a 100644 --- a/lua/plugins/user.lua +++ b/lua/plugins/user.lua @@ -12,8 +12,8 @@ return { "ray-x/lsp_signature.nvim", event = "BufRead", opts = { - hint_enable = false, - doc_lines = 5, + hint_enable = false, + doc_lines = 0, }, -- config = function() require("lsp_signature").setup() end, }, @@ -23,9 +23,7 @@ return { -- customize dashboard options { "folke/snacks.nvim", - config = function(_, opts) - require("snacks").setup(opts) - end, + config = function(_, opts) require("snacks").setup(opts) end, opts = { dashboard = { preset = { @@ -33,11 +31,14 @@ return { keys = {}, }, }, - indent = require( "plugins.configs.ui.indent" ), + indent = require "plugins.configs.ui.indent", + dim = { enabled = false }, + terminal = { enabled = false }, + profiler = { enabled = false }, + }, }, - -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call { "L3MON4D3/LuaSnip", @@ -49,72 +50,62 @@ return { end, }, - - { - "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, - }, - }, - }, + { + "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, + }, + }, + }, }