diff --git a/init.lua b/init.lua index fe58f8f..425b155 100644 --- a/init.lua +++ b/init.lua @@ -17,4 +17,3 @@ end require "lazy_setup" require "polish" - diff --git a/lazy-lock.json b/lazy-lock.json index c3eb1d1..6f9bbc0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,7 +27,6 @@ "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" }, - "grug-far.nvim": { "branch": "main", "commit": "190c03d54e8976491e6e49acb97087bf4182b079" }, "guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" }, "heirline.nvim": { "branch": "master", "commit": "cc359b628266cb9a84b2d71c883f2b99e16473a0" }, "indent-blankline.nvim": { "branch": "master", "commit": "3fe94b8034dd5241cb882bb73847303b58857ecf" }, @@ -47,7 +46,6 @@ "mini.icons": { "branch": "main", "commit": "910db5df9724d65371182948f921fce23c2c881e" }, "mini.indentscope": { "branch": "main", "commit": "613df2830d7faeae7483ba2e736683154b95921e" }, "mini.move": { "branch": "main", "commit": "4caa1c212f5ca3d1633d21cfb184808090ed74b1" }, - "mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" }, "monokai-pro.nvim": { "branch": "master", "commit": "4f4133601296881bb2197800bd68d2bba9eaadb9" }, "multiple-cursors.nvim": { "branch": "main", "commit": "2f5e786c43aa9c0fc34b295cfcc9bfbacef8e926" }, "neo-tree.nvim": { "branch": "main", "commit": "e6645ecfcba3e064446a6def1c10d788c9873f51" }, @@ -64,7 +62,7 @@ "nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" }, "nvim-lsp-endhints": { "branch": "main", "commit": "a449f2f27b6b985ff216964572224ce432d94a86" }, "nvim-lspconfig": { "branch": "master", "commit": "04e8eb54eb6f70cd367ae58fdafb2ce05b2650ee" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, "nvim-spider": { "branch": "main", "commit": "2b38e3e95e143313d78ca098eeecda7aebfce925" }, "nvim-treesitter": { "branch": "master", "commit": "dc9bf52c1f8b9abae0c10e0192baea2e720472ef" }, @@ -76,12 +74,12 @@ "promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "85b80abaa09cbbc039e3095b2f515b3cf8cadd11" }, "resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" }, - "smart-splits.nvim": { "branch": "master", "commit": "00fba7a0e912a8d82da91a3b6b11d641fa500bd8" }, + "smart-splits.nvim": { "branch": "master", "commit": "4a231987665d3c6e02ca88833d050e918afe3e1e" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, "transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" }, - "treesj": { "branch": "main", "commit": "ec234a9a13d61a7b95900abdb02fabaea1afd9f3" }, + "treesj": { "branch": "main", "commit": "48c1a7539f376fd40ceb9cf12d697040fcf90649" }, "trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" }, "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "9e3209190c22953566ae4e6436ad2b4ff4dabb95" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 8b58b65..b4f579c 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -18,13 +18,14 @@ return function() mappings.n[""] = false mappings.n[""] = false mappings.n[""] = false + mappings.n["K"] = false ------------------------------------------- ----------- 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.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" } @@ -34,6 +35,7 @@ return function() mappings.i[""] = { "", desc = "Unindent line" } mappings.v[""] = { ">gv", desc = "Indent line" } mappings.v[""] = { ""] = { "ggVG", desc = "Select all lines" } - return mappings + + ------ My customs keybinding ------ + mappings.n["xn"] = { "Telescope notify", desc = "Notifications" } + + mappings.i["VK"] = false + mappings.v["VK"] = false + mappings.n["VK"] = false + + + return mappings end diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 154185a..58c3da0 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -12,7 +12,7 @@ return { autoformat = false, -- enable or disable auto formatting on start codelens = false, -- enable/disable codelens refresh on start inlay_hints = false, -- enable/disable inlay hints on start - semantic_tokens = false, -- enable/disable semantic token highlighting + semantic_tokens = true, -- enable/disable semantic token highlighting }, -- customize lsp formatting options formatting = require "plugins.configs.lsp.formatting", diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 1b0458a..ad03679 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -27,7 +27,6 @@ return { cmp.config.sources { { name = "nvim_lsp", priority = 1000 }, { name = "cmdline", priority = 800 }, - { name = "buffer", priority = 500 }, { name = "path", priority = 250 }, } diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index c43f5cd..1b39792 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -170,14 +170,15 @@ return { end, }, }, - + -- Better split navigation and resize { "mrjones2014/smart-splits.nvim", event = "VeryLazy", -- load on very lazy for mux detection opts = function(_, opts) - opts.ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" } + opts.ignored_filetypes = { "nofile", "quickfix", "qf", "prompt", "NvimTree" } opts.ignored_buftypes = { "nofile" } + opts.log_level = "error" end, keys = { { diff --git a/lua/plugins/markdown-preview-nvim.lua b/lua/plugins/markdown-preview-nvim.lua deleted file mode 100644 index 5ee3991..0000000 --- a/lua/plugins/markdown-preview-nvim.lua +++ /dev/null @@ -1,42 +0,0 @@ ----@type LazySpec -return { - "iamcco/markdown-preview.nvim", - build = function(plugin) - local package_manager = vim.fn.executable "yarn" and "yarn" or vim.fn.executable "npx" and "npx -y yarn" or false - - --- HACK: Use `yarn` or `npx` when possible, otherwise throw an error - ---@see https://github.com/iamcco/markdown-preview.nvim/issues/690 - ---@see https://github.com/iamcco/markdown-preview.nvim/issues/695 - if not package_manager then error "Missing `yarn` or `npx` in the PATH" end - - local cmd = string.format( - "!cd %s && cd app && COREPACK_ENABLE_AUTO_PIN=0 %s install --frozen-lockfile", - plugin.dir, - package_manager - ) - - vim.cmd(cmd) - end, - ft = { "markdown", "markdown.mdx" }, - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - init = function() - local plugin = require("lazy.core.config").spec.plugins["markdown-preview.nvim"] - vim.g.mkdp_filetypes = require("lazy.core.plugin").values(plugin, "ft", true) - end, - dependencies = { - { "AstroNvim/astroui", opts = { icons = { Markdown = "" } } }, - { - "AstroNvim/astrocore", - optional = true, - opts = function(_, opts) - local maps = opts.mappings - local prefix = "M" - - maps.n[prefix] = { desc = require("astroui").get_icon("Markdown", 1, true) .. "Markdown" } - maps.n[prefix .. "p"] = { "MarkdownPreview", desc = "Preview" } - maps.n[prefix .. "s"] = { "MarkdownPreviewStop", desc = "Stop preview" } - maps.n[prefix .. "t"] = { "MarkdownPreviewToggle", desc = "Toggle preview" } - end, - }, - }, -} diff --git a/lua/plugins/motion.lua b/lua/plugins/motion.lua index 837632e..32af677 100644 --- a/lua/plugins/motion.lua +++ b/lua/plugins/motion.lua @@ -1,19 +1,19 @@ -- Plugins related to motion 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`" }, - }, - }, + -- { + -- "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`" }, + -- }, + -- }, -- Brackets splitjoin { "Wansmer/treesj", @@ -26,68 +26,6 @@ return { { "gs", "TSJToggle", mode = { "n" }, desc = "Toggle splitjoin" }, }, }, - -- { - -- "echasnovski/mini.ai", - -- event = "User AstroFile", - -- opts = function() - -- -- Register to which-key - -- local i = { - -- [" "] = "Whitespace", - -- ["?"] = "User Prompt", - -- _ = "Underscore", - -- a = "Argument", - -- b = "Paired ), ], }", - -- c = "Class", - -- d = "Digit(s)", - -- e = "Word in CamelCase & snake_case", - -- f = "Function", - -- g = "Entire file", - -- o = "Block, conditional, loop", - -- q = "Quote `, \", '", - -- t = "Tag", - -- u = "Use/call function & method", - -- U = "Use/call without dot in name", - -- } - -- local a = vim.deepcopy(i) - -- for k, v in pairs(a) do - -- a[k] = v:gsub(" including.*", "") - -- end - - -- local ic = vim.deepcopy(i) - -- local ac = vim.deepcopy(a) - -- for key, name in pairs { n = "Next", l = "Last" } do - -- i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic) - -- a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac) - -- end - -- require("which-key").register { - -- mode = { "o", "x" }, - -- i = i, - -- a = a, - -- } - - -- -- define custom textobjects - -- local ai = require "mini.ai" - -- return { - -- n_lines = 500, - -- custom_textobjects = { - -- o = ai.gen_spec.treesitter { -- code block - -- a = { "@block.outer", "@conditional.outer", "@loop.outer" }, - -- i = { "@block.inner", "@conditional.inner", "@loop.inner" }, - -- }, - -- f = ai.gen_spec.treesitter { a = "@function.outer", i = "@function.inner" }, -- function - -- c = ai.gen_spec.treesitter { a = "@class.outer", i = "@class.inner" }, -- class - -- t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, -- tags - -- d = { "%f[%d]%d+" }, -- digits - -- e = { -- Word with case - -- { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]", "%f[%P][%l%d]+%f[^%l%d]", "^[%l%d]+%f[^%l%d]" }, - -- "^().*()$", - -- }, - -- u = ai.gen_spec.function_call(), -- u for "Usage" - -- U = ai.gen_spec.function_call { name_pattern = "[%w_]" }, -- without dot in function name - -- }, - -- } - -- end, - -- }, -- Better move by word { "chrisgrieser/nvim-spider", @@ -99,16 +37,6 @@ return { { "ge", "lua require('spider').motion('ge')", mode = { "n", "o", "x" }, desc = "Spider-ge" }, }, }, - -- Duplicate line/block up/down - { - "hinell/duplicate.nvim", - keys = { - { "", "LineDuplicate -1", mode = { "n" }, desc = "Duplicate line up" }, - { "", "LineDuplicate +1", mode = { "n" }, desc = "Duplicate line down" }, - { "", "VisualDuplicate -1", mode = { "x" }, desc = "Duplicate block up" }, - { "", "VisualDuplicate +1", mode = { "x" }, desc = "Duplicate block down" }, - }, - }, -- Better character motion { "folke/flash.nvim", @@ -131,4 +59,23 @@ return { }, }, }, + -- Move code block + { + "echasnovski/mini.move", + event = "BufRead", + config = function() + require("mini.move").setup { + mappings = { + left = "", + right = "", + down = "", + up = "", + line_left = "", + line_right = "", + line_down = "", + line_up = "", + }, + } + end, + }, } diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 3d373a2..98d77ba 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -17,18 +17,17 @@ return { enabled = false, }, hover = { - -- enabled = false, -- disables Noice LSP hover - enabled = true, -- bật Noice hover - silent = true, -- thông báo nếu không có tài liệu hover - view = "hover", -- chế độ hiển thị mặc định cho hover - opts = { -- tùy chỉnh hiển thị + enabled = true, + silent = true, + view = "hover", + opts = { border = { - style = "rounded", -- bo góc viền - text = { top = " Documents ", top_align = "center" }, -- tiêu đề hover + style = "rounded", + text = { top = " Documents ", top_align = "center" }, }, win_options = { - wrap = true, -- bật tự động xuống dòng - linebreak = true, -- ngắt dòng ở khoảng trắng + wrap = true, + linebreak = true, }, }, }, diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index b635130..318d16e 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -30,14 +30,14 @@ return { }, -- Transparent background - { - "xiyaowong/transparent.nvim", - lazy = false, - opts = function(_, opts) opts = require "plugins.configs.ui.transparent"(opts) end, - keys = { - { "uT", "TransparentToggle", desc = "Toggle transparent" }, - }, - }, + -- { + -- "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", diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 47121d0..47f2430 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -16,5 +16,6 @@ return { function() require("which-key").show { global = false } end, desc = "Buffer Local Keymaps (which-key)", }, + }, }