diff --git a/lazy-lock.json b/lazy-lock.json index 3240b96..9f68174 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,6 @@ { "aerial.nvim": { "branch": "master", "commit": "c7cbbad40c2065fccfd1f1863bb2c08180c0533d" }, + "autoclose.nvim": { "branch": "main", "commit": "3f86702b54a861a17d7994b2e32a7c648cb12fb1" }, "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, "blueprints": { "branch": "main", "commit": "e5825c30464f98e77e8b5ffb88d59fd98df6c802" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, @@ -14,7 +15,7 @@ "mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, "monkey-alert": { "branch": "main", "commit": "213a39f8161f80ce43e1a164a54fe796432422b8" }, "neo-tree.nvim": { "branch": "main", "commit": "ed057048a281b418d5318dd5153f9486daa517a3" }, - "no-neck-pain.nvim": { "branch": "main", "commit": "0463fbb77bcab4cc9716ba1e87255bbe4d002de7" }, + "no-neck-pain.nvim": { "branch": "main", "commit": "76ccd195fb2195ae1b9b9f0d539c517fa3f8a2b9" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-scrollbar": { "branch": "main", "commit": "5b103ef0fd2e8b9b4be3878ed38d224522192c6c" }, @@ -26,9 +27,8 @@ "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "rose-pine": { "branch": "main", "commit": "72a04c4065345b51b56aed4859ea1d884f734097" }, "smear-cursor.nvim": { "branch": "main", "commit": "4b86df8a0c5f46e708616b21a02493bb0e47ecbd" }, - "snacks.nvim": { "branch": "main", "commit": "da230e3ca8146da4b73752daaf0a1d07d343c12d" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-git-file-history.nvim": { "branch": "master", "commit": "e7d495319f2a04df96402057a6992ea970f8914d" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, diff --git a/lua/plugins/code-utils.lua b/lua/plugins/code-utils.lua index b4368f4..0b5ce53 100644 --- a/lua/plugins/code-utils.lua +++ b/lua/plugins/code-utils.lua @@ -2,75 +2,82 @@ -- │ Code utils │ -- ╰────────────╯ return { - -- │ Code parse │ - { - "nvim-treesitter/nvim-treesitter", - opts = function() - return require("plugins.opts.treesitter") - end, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, - }, + -- │ Code parse │ + { + "nvim-treesitter/nvim-treesitter", + opts = function() + return require("plugins.opts.treesitter") + end, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + }, - { - "nvim-treesitter/nvim-treesitter-context", - opts = function() - return require("plugins.opts.treesitterContext") - end, - }, + { + "nvim-treesitter/nvim-treesitter-context", + opts = function() + return require("plugins.opts.treesitterContext") + end, + }, - -- │ Completion │ - { - "saghen/blink.cmp", - dependencies = { "rafamadriz/friendly-snippets" }, - version = "1.*", - -- build = "cargo build --release", - opts = { - -- C-e: Hide menu - -- C-k: Toggle signature help (if signature.enabled = true) - keymap = { - preset = "default", - [""] = { "accept", "fallback" }, - [""] = { "select_next", "fallback" }, - [""] = { "select_prev", "fallback" }, - }, - appearance = { - nerd_font_variant = "mono", - }, - completion = { documentation = { auto_show = false } }, - sources = {}, - -- default = { "lsp", "path", "snippets", "buffer" }, - fuzzy = { implementation = "prefer_rust_with_warning" }, - }, - opts_extend = { "sources.default" }, - }, + -- │ Completion │ + { + "saghen/blink.cmp", + dependencies = { "rafamadriz/friendly-snippets" }, + version = "1.*", + -- build = "cargo build --release", + opts = { + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + keymap = { + preset = "default", + [""] = { "accept", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback" }, + }, + appearance = { + nerd_font_variant = "mono", + }, + completion = { documentation = { auto_show = false } }, + sources = {}, + -- default = { "lsp", "path", "snippets", "buffer" }, + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, + }, - -- -- │ Auto close │ - { - "windwp/nvim-ts-autotag", - config = function(_, opts) - require("nvim-ts-autotag").setup({ - opts = { - enable_close = true, - enable_rename = true, - enable_close_on_slash = false, - }, - }) - end, - }, + -- -- │ Auto close │ + { + "windwp/nvim-ts-autotag", + config = function(_, opts) + require("nvim-ts-autotag").setup({ + opts = { + enable_close = true, + enable_rename = true, + enable_close_on_slash = false, + }, + }) + end, + }, - -- │ Diagnostics │ - { - "folke/trouble.nvim", - opts = { use_diagnostic_signs = true }, - }, + { + 'm4xshen/autoclose.nvim', + opts = function() + return require("plugins.opts.autoclose") + end, + }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = function() - return require("plugins.opts.todocomments") - end, - }, + -- │ Diagnostics │ + { + "folke/trouble.nvim", + opts = { use_diagnostic_signs = true }, + }, + + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = function() + return require("plugins.opts.todocomments") + end, + }, } diff --git a/lua/plugins/opts/autoclose.lua b/lua/plugins/opts/autoclose.lua new file mode 100644 index 0000000..e0d6359 --- /dev/null +++ b/lua/plugins/opts/autoclose.lua @@ -0,0 +1,24 @@ +return { + keys = { + ["("] = { escape = false, close = true, pair = "()" }, + ["["] = { escape = false, close = true, pair = "[]" }, + ["{"] = { escape = false, close = true, pair = "{}" }, + + [">"] = { escape = true, close = false, pair = "<>" }, + [")"] = { escape = true, close = false, pair = "()" }, + ["]"] = { escape = true, close = false, pair = "[]" }, + ["}"] = { escape = true, close = false, pair = "{}" }, + + ['"'] = { escape = true, close = true, pair = '""' }, + ["'"] = { escape = true, close = true, pair = "''" }, + ["`"] = { escape = true, close = true, pair = "``" }, + }, + options = { + disabled_filetypes = { "text" }, + disable_when_touch = false, + touch_regex = "[%w(%[{]", + pair_spaces = false, + auto_indent = true, + disable_command_mode = false, + }, +}