From 0358bfc002070810a67cb8ab872286052cb43fad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Jul 2023 01:51:12 +0000 Subject: [PATCH 1/7] chore(lockfile): auto update lazy-lock.json --- lazy-lock.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index d4cbe569d..22ec7c01b 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,12 +1,12 @@ { "Comment.nvim": { "branch": "master", "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" }, - "LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" }, + "LuaSnip": { "branch": "master", "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" }, "accelerated-jk.nvim": { "branch": "main", "commit": "8fb5dad4ccc1811766cebf16b544038aeeb7806f" }, "alpha-nvim": { "branch": "main", "commit": "e4fc5e29b731bdf55d204c5c6a11dc3be70f3b65" }, "autoclose.nvim": { "branch": "main", "commit": "469782b0456f0b4f764378ffda94c18599544e09" }, "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" }, "bigfile.nvim": { "branch": "main", "commit": "9616b73670ffeb92679677554ded88854ae42cf8" }, - "bufferline.nvim": { "branch": "main", "commit": "d24378edc14a675c820a303b4512af3bbc5761e9" }, + "bufferline.nvim": { "branch": "main", "commit": "99f0932365b34e22549ff58e1bea388465d15e99" }, "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "d9989a56380f4c30f8fda41eb9a9ac0932d4f383" }, "clever-f.vim": { "branch": "master", "commit": "6a3ac5e3688598af9411ab741737f98c47370c22" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -26,20 +26,20 @@ "diffview.nvim": { "branch": "main", "commit": "e91110d2a7f8e2f667666aba6ea089ff823f8748" }, "edge": { "branch": "master", "commit": "358cb6688ac577470a4eafcb53bdd63899dfc937" }, "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, - "friendly-snippets": { "branch": "main", "commit": "4aed1a0ca605cb1c87f59799a0cc4afe00a40272" }, + "friendly-snippets": { "branch": "main", "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, - "gitsigns.nvim": { "branch": "main", "commit": "adcf2c7f2f495f5df148683764bf7cba6a70f34c" }, - "hop.nvim": { "branch": "master", "commit": "31e0e42e629bf16affea747132d9c54f55fb17c8" }, + "gitsigns.nvim": { "branch": "main", "commit": "11b80e7eea249affc8776483272bcfc627b5552a" }, + "hop.nvim": { "branch": "master", "commit": "e41c04125fab05406be576640749352ad3eafcdb" }, "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, - "lsp_signature.nvim": { "branch": "master", "commit": "b36080555e393402bc9484ce0e60d8b6cd23d426" }, - "lspsaga.nvim": { "branch": "main", "commit": "d3ac8b98f207ef355ab968726996702f7ce41b99" }, + "lsp_signature.nvim": { "branch": "master", "commit": "04f0c52c6a04680f29bdecb5b2943591b8c0ff43" }, + "lspsaga.nvim": { "branch": "main", "commit": "23a481f0b142f4498e2fc2dd80e7a404079833e6" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" }, - "mason.nvim": { "branch": "main", "commit": "3f6b544c75c01549f7a2a9e395e0f1cea42b25dd" }, + "mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, "neodim": { "branch": "master", "commit": "9477da03b93f1984a81fee3b92e6ac7c6ada6aa4" }, "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, "nord.nvim": { "branch": "master", "commit": "fab04b2dd4b64f4b1763b9250a8824d0b5194b8f" }, @@ -47,27 +47,27 @@ "nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" }, "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, - "nvim-dap": { "branch": "master", "commit": "d17d1bba23ec72a157bd183c57840c39e323f515" }, + "nvim-dap": { "branch": "master", "commit": "0a02ed103e4da1928dc88428248dec7bb5ee6f34" }, "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, - "nvim-lspconfig": { "branch": "master", "commit": "dd11ba7b3c8f82d51b6d4dd7d68fce2d78bf78a0" }, + "nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, - "nvim-scrollview": { "branch": "main", "commit": "c0dc4822e0b87d10569c55d7189c6147ad03538b" }, + "nvim-scrollview": { "branch": "main", "commit": "dc236a2e6503f46598554d0955fe897dbcfa4807" }, "nvim-tree.lua": { "branch": "master", "commit": "273c1700eb68c27dce4e518efafc8144fd7ce4ab" }, "nvim-treehopper": { "branch": "master", "commit": "5a28bff46c05d28bdb4bcaef67e046eb915a9390" }, - "nvim-treesitter": { "branch": "master", "commit": "7b04e8b67eec7d92daadf9f0717dd272ddfc81a3" }, + "nvim-treesitter": { "branch": "master", "commit": "736a672afe852dbad4199002c89b7461b285c47f" }, "nvim-treesitter-context": { "branch": "master", "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ef32a5c24b767d165ed63fd2b24ac8dc52742521" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" }, "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, "paint.nvim": { "branch": "main", "commit": "6ce64212804f425073c61ab0d9c2b034f0435260" }, - "persisted.nvim": { "branch": "main", "commit": "b03c863731eafacd973912383297ea5d8fdb006a" }, + "persisted.nvim": { "branch": "main", "commit": "c1c4bbff8a4e9b9f66812b2daa9d3338916e8da2" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "5db37600becf689d78dbf066545b0de4d6f0ab94" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "ec7ade261f961a5299a13451aa18a4dce630d0b3" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "smartyank.nvim": { "branch": "master", "commit": "7e3905578f646503525b2f7018b8afd17861018c" }, - "sniprun": { "branch": "master", "commit": "4762952f3d206d41eedb789e10741de75d1391a3" }, + "sniprun": { "branch": "master", "commit": "6f9025bf475799bc0fbe8b338b3912f4a701ff81" }, "specs.nvim": { "branch": "main", "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" }, "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, "suda.vim": { "branch": "master", "commit": "8b0fc3711760195aba104e2d190cff9af8267052" }, @@ -79,7 +79,7 @@ "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, "telescope.nvim": { "branch": "master", "commit": "1228f3b15ca3d9b95dcb92efda6a3448871030bd" }, "toggleterm.nvim": { "branch": "main", "commit": "00c13dccc78c09fa5da4c5edda990a363e75035e" }, - "trouble.nvim": { "branch": "main", "commit": "0e6703c1d37d2d34ed029ab54f9bd66e3f2ecbf7" }, + "trouble.nvim": { "branch": "main", "commit": "fc4bb22b1d2cd5eb46fe61a9f6d6416d742beb5c" }, "vim-cool": { "branch": "master", "commit": "04bb7f5dade175a81b47abf4e87aeb30b05b33d8" }, "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, "vim-fugitive": { "branch": "master", "commit": "b3b838d690f315a503ec4af8c634bdff3b200aaf" }, From d917673d26d82a6dce1e93fb7b91f6b4d8f92af9 Mon Sep 17 00:00:00 2001 From: Charles Chiu Date: Thu, 27 Jul 2023 15:54:23 +0800 Subject: [PATCH 2/7] perf(lspsaga): align options with official doc and update config (#898) --- lua/modules/configs/completion/lspsaga.lua | 160 ++++++++++++--------- 1 file changed, 95 insertions(+), 65 deletions(-) diff --git a/lua/modules/configs/completion/lspsaga.lua b/lua/modules/configs/completion/lspsaga.lua index 0e8d7e967..d57339333 100644 --- a/lua/modules/configs/completion/lspsaga.lua +++ b/lua/modules/configs/completion/lspsaga.lua @@ -26,38 +26,31 @@ return function() set_sidebar_icons() require("lspsaga").setup({ - scroll_preview = { - scroll_down = "", - scroll_up = "", + -- Breadcrumbs: https://dev.neovim.pro/lspsaga/breadcrumbs/ + symbol_in_winbar = { + enable = true, + separator = " " .. icons.ui.Separator, + hide_keyword = false, + show_file = false, + folder_level = 1, + color_mode = true, + delay = 100, }, - request_timeout = 3000, - finder = { - silent = true, - default = "def+ref+imp", + -- https://dev.neovim.pro/lspsaga/callhierarchy/ + callhierarchy = { layout = "float", - filter = {}, keys = { - shuttle = "[]", - toggle_or_open = "", - jump_to = "e", + edit = "e", vsplit = "v", split = "s", tabe = "t", - tabnew = "n", quit = "q", + shuttle = "[]", + toggle_or_req = "u", close = "", }, }, - definition = { - keys = { - edit = "o", - vsplit = "v", - split = "s", - tabe = "t", - close = "q", - quit = "q", - }, - }, + -- https://dev.neovim.pro/lspsaga/codeaction/ code_action = { num_shortcut = true, show_server_name = true, @@ -67,22 +60,33 @@ return function() exec = "", }, }, - lightbulb = { - enable = false, - sign = true, - sign_priority = 20, - virtual_text = false, + -- https://dev.neovim.pro/lspsaga/definition/ + definition = { + width = 0.6, + height = 0.5, + keys = { + edit = "o", + vsplit = "v", + split = "s", + tabe = "t", + quit = "q", + close = "q", + }, }, + -- https://dev.neovim.pro/lspsaga/diagnostic/ diagnostic = { + show_code_action = true, + jump_num_shortcut = true, max_width = 0.5, max_height = 0.6, text_hl_follow = true, - show_code_action = true, border_follow = true, - diagnostic_only_current = false, - extend_relatedInformation = false, - jump_num_shortcut = true, + extend_relatedInformation = true, show_layout = "float", + show_normal_height = 10, + max_show_width = 0.9, + max_show_height = 0.6, + diagnostic_only_current = false, keys = { exec_action = "r", quit = "q", @@ -90,72 +94,93 @@ return function() quit_in_show = { "q", "" }, }, }, - rename = { - in_select = false, - auto_save = false, + -- https://dev.neovim.pro/lspsaga/finder/ + finder = { + max_height = 0.5, + left_width = 0.3, + right_width = 0.3, + default = "def+ref+imp", + methods = {}, + layout = "float", + filter = {}, + silent = false, keys = { - quit = "", - select = "x", - exec = "", + shuttle = "[]", + toggle_or_open = "", + vsplit = "v", + split = "s", + tabe = "t", + tabnew = "n", + quit = "q", + close = "", }, }, + -- https://dev.neovim.pro/lspsaga/hover/ hover = { max_width = 0.3, max_height = 0.7, open_link = "gl", - open_browser = "silent !" .. require("core.settings").external_browser, + open_cmd = "silent !" .. require("core.settings").external_browser, + }, + -- https://dev.neovim.pro/lspsaga/implement/ + implement = { + enable = true, + sign = true, + virtual_text = false, + priority = 100, + }, + -- https://dev.neovim.pro/lspsaga/lightbulb/ + lightbulb = { + enable = false, + sign = true, + virtual_text = false, + debounce = 10, + sign_priority = 20, }, + -- https://dev.neovim.pro/lspsaga/outline/ outline = { win_position = "right", win_width = 30, auto_preview = false, + detail = false, auto_close = true, close_after_jump = true, - detail = false, layout = "normal", + max_height = 0.5, + left_width = 0.3, keys = { toggle_or_jump = "", - jump = "o", quit = "q", + jump = "o", }, }, - symbol_in_winbar = { - enable = true, - separator = " " .. icons.ui.Separator, - hide_keyword = false, - show_file = false, - color_mode = true, - }, - implement = { - enable = true, - sign = true, - virtual_text = false, - }, - callhierarchy = { - layout = "float", + -- https://dev.neovim.pro/lspsaga/rename/ + rename = { + in_select = false, + auto_save = false, + project_max_width = 0.5, + project_max_height = 0.5, keys = { - edit = "e", - vsplit = "v", - split = "s", - tabe = "t", - quit = "q", - shuttle = "[]", - toggle_or_req = "u", - close = "", + quit = "", + exec = "", + select = "x", }, }, + -- https://dev.neovim.pro/lspsaga/misc/#beacon beacon = { enable = true, frequency = 12, }, + -- https://dev.neovim.pro/lspsaga/misc/#generic-ui-options ui = { - title = true, - devicon = true, border = "single", -- Can be single, double, rounded, solid, shadow. - actionfix = icons.ui.Spell, + devicon = true, + title = true, expand = icons.ui.ArrowClosed, collapse = icons.ui.ArrowOpen, code_action = icons.ui.CodeAction, + actionfix = icons.ui.Spell, + lines = { "┗", "┣", "┃", "━", "┏" }, imp_sign = icons.kind.Implementation, kind = { -- Kind @@ -198,5 +223,10 @@ return function() Value = { icons.kind.Value, "LspKindValue" }, }, }, + -- https://dev.neovim.pro/lspsaga/misc/#scrolling-keymaps + scroll_preview = { + scroll_down = "", + scroll_up = "", + }, }) end From a9610243ce33271effb6ea10db683adc59fb62bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E9=85=94=E9=96=91=E5=90=9F?= <50296129+Jint-lzxy@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:28:30 +0800 Subject: [PATCH 3/7] feat(dap)!: support integrated terminals (io in neovim) (#877) * feat(dap)!: support integrated terminals (io in neovim) * fix(dap): correct event callback * feat(dap): setup keymaps correctly * fix CI fix variable naming * adjust dapui * feat(dap): support debugpy integrated terminal io. * support vscode-go and misc changes * fix CI * fixup dap utils --------- Co-authored-by: ayamir --- lua/keymap/tool.lua | 1 - lua/modules/configs/editor/rainbow_delims.lua | 4 +- .../configs/tool/dap/clients/codelldb.lua | 20 ++- .../configs/tool/dap/clients/delve.lua | 122 +++++++++++------- lua/modules/configs/tool/dap/clients/lldb.lua | 3 +- .../configs/tool/dap/clients/python.lua | 47 ++++--- lua/modules/configs/tool/dap/dap-keymap.lua | 33 +++++ lua/modules/configs/tool/dap/dapui.lua | 43 ++++-- lua/modules/configs/tool/dap/init.lua | 24 +++- lua/modules/utils/dap.lua | 4 + 10 files changed, 210 insertions(+), 91 deletions(-) create mode 100644 lua/modules/configs/tool/dap/dap-keymap.lua diff --git a/lua/keymap/tool.lua b/lua/keymap/tool.lua index 6ff95a782..b16a779f3 100644 --- a/lua/keymap/tool.lua +++ b/lua/keymap/tool.lua @@ -145,7 +145,6 @@ local plug_map = { :with_desc("debug: Run/Continue"), ["n|"] = map_callback(function() require("dap").terminate() - require("dapui").close() end) :with_noremap() :with_silent() diff --git a/lua/modules/configs/editor/rainbow_delims.lua b/lua/modules/configs/editor/rainbow_delims.lua index 037a81397..cb58af559 100644 --- a/lua/modules/configs/editor/rainbow_delims.lua +++ b/lua/modules/configs/editor/rainbow_delims.lua @@ -10,7 +10,7 @@ return function() if errors < 0 then return nil end - return (check_lines and vim.fn.line("$") > 450) and require("rainbow-delimiters").strategy["global"] + return (check_lines and vim.fn.line("$") > 350) and require("rainbow-delimiters").strategy["global"] or require("rainbow-delimiters").strategy["local"] end end @@ -20,6 +20,8 @@ return function() [""] = init_strategy(false), c = init_strategy(true), cpp = init_strategy(true), + vimdoc = init_strategy(true), + vim = init_strategy(true), }, query = { [""] = "rainbow-delimiters", diff --git a/lua/modules/configs/tool/dap/clients/codelldb.lua b/lua/modules/configs/tool/dap/clients/codelldb.lua index 44eea8237..64124c617 100644 --- a/lua/modules/configs/tool/dap/clients/codelldb.lua +++ b/lua/modules/configs/tool/dap/clients/codelldb.lua @@ -15,13 +15,31 @@ return function() } dap.configurations.c = { { - name = "Launch the debugger", + name = "Debug", + type = "codelldb", + request = "launch", + program = utils.input_exec_path(), + cwd = "${workspaceFolder}", + stopOnEntry = false, + terminal = "integrated", + }, + { + name = "Debug (with args)", type = "codelldb", request = "launch", program = utils.input_exec_path(), args = utils.input_args(), cwd = "${workspaceFolder}", stopOnEntry = false, + terminal = "integrated", + }, + { + name = "Attach to a running process", + type = "codelldb", + request = "attach", + program = utils.input_exec_path(), + stopOnEntry = false, + waitFor = true, }, } dap.configurations.cpp = dap.configurations.c diff --git a/lua/modules/configs/tool/dap/clients/delve.lua b/lua/modules/configs/tool/dap/clients/delve.lua index 719d5950a..6f023445e 100644 --- a/lua/modules/configs/tool/dap/clients/delve.lua +++ b/lua/modules/configs/tool/dap/clients/delve.lua @@ -1,66 +1,100 @@ --- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go-using-delve-directly --- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md +-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go +-- https://github.com/golang/vscode-go/blob/master/docs/debugging.md return function() local dap = require("dap") local utils = require("modules.utils.dap") - dap.adapters.go = function(callback) - local stdout = vim.loop.new_pipe(false) - local handle - local pid_or_err - local port = 28695 - local opts = { - stdio = { nil, stdout }, - args = { "dap", "-l", "127.0.0.1:" .. port }, - detached = true, - } - handle, pid_or_err = vim.loop.spawn(vim.fn.exepath("dlv"), opts, function(code) - stdout:close() - handle:close() - if code ~= 0 then - vim.notify( - string.format('"dlv" exited with code: %d, please check your configs for correctness.', code), - vim.log.levels.WARN, - { title = "[go] DAP Warning!" } - ) - end - end) - assert(handle, "Error running dlv: " .. tostring(pid_or_err)) - stdout:read_start(function(err, chunk) - assert(not err, err) - if chunk then - vim.schedule(function() - require("dap.repl").append(chunk) - end) - end - end) - -- Wait for delve to start - vim.defer_fn(function() - callback({ type = "server", host = "127.0.0.1", port = port }) - end, 100) + if not require("mason-registry").is_installed("go-debug-adapter") then + vim.notify( + "Automatically installing `go-debug-adapter` for go debugging", + vim.log.levels.INFO, + { title = "nvim-dap" } + ) + + local go_dbg = require("mason-registry").get_package("go-debug-adapter") + go_dbg:install():once( + "closed", + vim.schedule_wrap(function() + if go_dbg:is_installed() then + vim.notify("Successfully installed `go-debug-adapter`", vim.log.levels.INFO, { title = "nvim-dap" }) + end + end) + ) end + + dap.adapters.go = { + type = "executable", + command = "node", + args = { + require("mason-registry").get_package("go-debug-adapter"):get_install_path() + .. "/extension/dist/debugAdapter.js", + }, + } dap.configurations.go = { - { type = "go", name = "Debug", request = "launch", program = "${file}" }, { type = "go", - name = "Debug with args", + name = "Debug (file)", + request = "launch", + cwd = "${workspaceFolder}", + program = utils.input_file_path(), + console = "integratedTerminal", + dlvToolPath = vim.fn.exepath("dlv"), + showLog = true, + showRegisters = true, + stopOnEntry = false, + }, + { + type = "go", + name = "Debug (file with args)", request = "launch", - program = "${file}", + cwd = "${workspaceFolder}", + program = utils.input_file_path(), args = utils.input_args(), + console = "integratedTerminal", + dlvToolPath = vim.fn.exepath("dlv"), + showLog = true, + showRegisters = true, + stopOnEntry = false, }, { type = "go", - name = "Debug test", -- configuration for debugging test files + name = "Debug (executable)", request = "launch", - mode = "test", - program = "${file}", - }, -- works with go.mod packages and sub packages + cwd = "${workspaceFolder}", + program = utils.input_exec_path(), + args = utils.input_args(), + console = "integratedTerminal", + dlvToolPath = vim.fn.exepath("dlv"), + mode = "exec", + showLog = true, + showRegisters = true, + stopOnEntry = false, + }, { type = "go", - name = "Debug test (go.mod)", + name = "Debug (test file)", request = "launch", + cwd = "${workspaceFolder}", + program = utils.input_file_path(), + console = "integratedTerminal", + dlvToolPath = vim.fn.exepath("dlv"), mode = "test", + showLog = true, + showRegisters = true, + stopOnEntry = false, + }, + { + type = "go", + name = "Debug (using go.mod)", + request = "launch", + cwd = "${workspaceFolder}", program = "./${relativeFileDirname}", + console = "integratedTerminal", + dlvToolPath = vim.fn.exepath("dlv"), + mode = "test", + showLog = true, + showRegisters = true, + stopOnEntry = false, }, } end diff --git a/lua/modules/configs/tool/dap/clients/lldb.lua b/lua/modules/configs/tool/dap/clients/lldb.lua index 2064b85c6..8461c77a1 100644 --- a/lua/modules/configs/tool/dap/clients/lldb.lua +++ b/lua/modules/configs/tool/dap/clients/lldb.lua @@ -5,8 +5,7 @@ return function() dap.adapters.lldb = { type = "executable", - command = "lldb-vscode", - name = "lldb", + command = vim.fn.exepath("lldb-vscode"), -- Find lldb-vscode on $PATH } dap.configurations.c = { { diff --git a/lua/modules/configs/tool/dap/clients/python.lua b/lua/modules/configs/tool/dap/clients/python.lua index cbb46ed98..29fda2a0f 100644 --- a/lua/modules/configs/tool/dap/clients/python.lua +++ b/lua/modules/configs/tool/dap/clients/python.lua @@ -1,7 +1,9 @@ -- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python +-- https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings return function() local dap = require("dap") local debugpy = vim.fn.exepath("debugpy-adapter") + local utils = require("modules.utils.dap") local function is_empty(s) return s == nil or s == "" @@ -9,9 +11,7 @@ return function() dap.adapters.python = function(callback, config) if config.request == "attach" then - ---@diagnostic disable-next-line: undefined-field local port = (config.connect or config).port - ---@diagnostic disable-next-line: undefined-field local host = (config.connect or config).host or "127.0.0.1" callback({ type = "server", @@ -32,9 +32,10 @@ return function() -- The first three options are required by nvim-dap type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python` request = "launch", - name = "Launch file", + name = "Debug", -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options - program = "${file}", -- This configuration will launch the current file if used. + console = "integratedTerminal", + program = utils.input_file_path(), pythonPath = function() if not is_empty(vim.env.CONDA_PREFIX) then return vim.env.CONDA_PREFIX .. "/bin/python" @@ -43,22 +44,26 @@ return function() end end, }, + { + -- NOTE: This setting is for people using venv + type = "python", + request = "launch", + name = "Debug (using venv)", + -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options + console = "integratedTerminal", + program = utils.input_file_path(), + pythonPath = function() + local cwd, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV") + if venv and vim.fn.executable(venv .. "/bin/python") == 1 then + return venv .. "/bin/python" + elseif vim.fn.executable(cwd .. "/venv/bin/python") == 1 then + return cwd .. "/venv/bin/python" + elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then + return cwd .. "/.venv/bin/python" + else + return "python3" + end + end, + }, } - - -- NOTE: This setting is for people using venv - -- pythonPath = function() - -- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself. - -- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within. - -- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. - -- local cwd, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV") - -- if venv and vim.fn.executable(venv .. "/bin/python") == 1 then - -- return venv .. "/bin/python" - -- elseif vim.fn.executable(cwd .. "/venv/bin/python") == 1 then - -- return cwd .. "/venv/bin/python" - -- elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then - -- return cwd .. "/.venv/bin/python" - -- else - -- return "python3" - -- end - -- end, end diff --git a/lua/modules/configs/tool/dap/dap-keymap.lua b/lua/modules/configs/tool/dap/dap-keymap.lua new file mode 100644 index 000000000..4505e1217 --- /dev/null +++ b/lua/modules/configs/tool/dap/dap-keymap.lua @@ -0,0 +1,33 @@ +local M = {} + +local bind = require("keymap.bind") +local map_cr = bind.map_cr +local map_cmd = bind.map_cmd + +local did_load_debug_mappings = false +local debug_keymap = { + ["nv|K"] = map_cmd("lua require('dapui').eval()") + :with_noremap() + :with_nowait() + :with_desc("debug: Evaluate expression under cursor"), +} +local original_keymap = { + ["n|K"] = map_cr("Lspsaga hover_doc"):with_noremap():with_silent():with_desc("lsp: Show doc"), + ["v|K"] = map_cmd(":m '<-2gv=gv"), +} + +function M.load() + if not did_load_debug_mappings then + bind.nvim_load_mapping(debug_keymap) + did_load_debug_mappings = true + end +end + +function M.restore() + if did_load_debug_mappings then + bind.nvim_load_mapping(original_keymap) + did_load_debug_mappings = false + end +end + +return M diff --git a/lua/modules/configs/tool/dap/dapui.lua b/lua/modules/configs/tool/dap/dapui.lua index 13896e2d8..b588f0816 100644 --- a/lua/modules/configs/tool/dap/dapui.lua +++ b/lua/modules/configs/tool/dap/dapui.lua @@ -5,14 +5,20 @@ return function() } require("dapui").setup({ - icons = { expanded = icons.ui.ArrowOpen, collapsed = icons.ui.ArrowClosed, current_frame = icons.ui.Indicator }, + force_buffers = true, + icons = { + expanded = icons.ui.ArrowOpen, + collapsed = icons.ui.ArrowClosed, + current_frame = icons.ui.Indicator, + }, mappings = { -- Use a table to apply multiple mappings + edit = "e", expand = { "", "<2-LeftMouse>" }, open = "o", remove = "d", - edit = "e", repl = "r", + toggle = "t", }, layouts = { { @@ -20,18 +26,24 @@ return function() -- Provide as ID strings or tables with "id" and "size" keys { id = "scopes", - size = 0.25, -- Can be float or integer > 1 + size = 0.3, -- Can be float or integer > 1 }, - { id = "breakpoints", size = 0.25 }, - { id = "stacks", size = 0.25 }, - { id = "watches", size = 0.25 }, + { id = "watches", size = 0.3 }, + { id = "stacks", size = 0.3 }, + { id = "breakpoints", size = 0.1 }, + }, + size = 0.3, + position = "right", + }, + { + elements = { + { id = "console", size = 0.55 }, + { id = "repl", size = 0.45 }, }, - size = 40, - position = "left", + position = "bottom", + size = 0.25, }, - { elements = { "repl" }, size = 10, position = "bottom" }, }, - -- Requires Nvim version >= 0.8 controls = { enabled = true, -- Display controls in this session @@ -48,10 +60,13 @@ return function() }, }, floating = { - max_height = nil, - max_width = nil, - mappings = { close = { "q", "" } }, + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. + border = "single", -- Border style. Can be "single", "double" or "rounded" + mappings = { + close = { "q", "" }, + }, }, - windows = { indent = 1 }, + render = { indent = 1, max_value_lines = 85 }, }) end diff --git a/lua/modules/configs/tool/dap/init.lua b/lua/modules/configs/tool/dap/init.lua index 78b76b0ba..489f0dc9b 100644 --- a/lua/modules/configs/tool/dap/init.lua +++ b/lua/modules/configs/tool/dap/init.lua @@ -5,16 +5,26 @@ return function() local icons = { dap = require("modules.utils.icons").get("dap") } local colors = require("modules.utils").get_palette() + local mappings = require("tool.dap.dap-keymap") - dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() + -- Initialize debug hooks + local _debugging = false + local function debug_init_cb() + _debugging = true + mappings.load() + dapui.open({ reset = true }) end - dap.listeners.after.event_terminated["dapui_config"] = function() - dapui.close() - end - dap.listeners.after.event_exited["dapui_config"] = function() - dapui.close() + local function debug_terminate_cb() + if _debugging then + _debugging = false + mappings.restore() + dapui.close() + end end + dap.listeners.after.event_initialized["dapui_config"] = debug_init_cb + dap.listeners.before.event_terminated["dapui_config"] = debug_terminate_cb + dap.listeners.before.event_exited["dapui_config"] = debug_terminate_cb + dap.listeners.before.disconnect["dapui_config"] = debug_terminate_cb -- We need to override nvim-dap's default highlight groups, AFTER requiring nvim-dap for catppuccin. vim.api.nvim_set_hl(0, "DapStopped", { fg = colors.green }) diff --git a/lua/modules/utils/dap.lua b/lua/modules/utils/dap.lua index 7e61d8da5..0ea276c7c 100644 --- a/lua/modules/utils/dap.lua +++ b/lua/modules/utils/dap.lua @@ -9,6 +9,10 @@ function M.input_exec_path() return vim.fn.input('Path to executable (default to "a.out"): ', vim.fn.expand("%:p:h") .. "/a.out", "file") end +function M.input_file_path() + return vim.fn.input("Path to debuggee (default to the current file): ", vim.fn.expand("%:p"), "file") +end + function M.get_env() local variables = {} for k, v in pairs(vim.fn.environ()) do From 179038446176e5f9bfb4e08f21c43ce8a13f2f58 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:49:57 +0000 Subject: [PATCH 4/7] chore(lockfile): auto update lazy-lock.json --- lazy-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 22ec7c01b..63da378bb 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -28,12 +28,12 @@ "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, "friendly-snippets": { "branch": "main", "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, - "gitsigns.nvim": { "branch": "main", "commit": "11b80e7eea249affc8776483272bcfc627b5552a" }, + "gitsigns.nvim": { "branch": "main", "commit": "5d73da785a3c05fd63ac31769079db05169a6ec7" }, "hop.nvim": { "branch": "master", "commit": "e41c04125fab05406be576640749352ad3eafcdb" }, "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, "lsp_signature.nvim": { "branch": "master", "commit": "04f0c52c6a04680f29bdecb5b2943591b8c0ff43" }, - "lspsaga.nvim": { "branch": "main", "commit": "23a481f0b142f4498e2fc2dd80e7a404079833e6" }, + "lspsaga.nvim": { "branch": "main", "commit": "557e6fd7fbca325a4bea582576fe36bec903367c" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, @@ -47,18 +47,18 @@ "nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" }, "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, - "nvim-dap": { "branch": "master", "commit": "0a02ed103e4da1928dc88428248dec7bb5ee6f34" }, + "nvim-dap": { "branch": "master", "commit": "2f28ea843bcdb378b171a66ddcd568516e431d55" }, "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, "nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-scrollview": { "branch": "main", "commit": "dc236a2e6503f46598554d0955fe897dbcfa4807" }, "nvim-tree.lua": { "branch": "master", "commit": "273c1700eb68c27dce4e518efafc8144fd7ce4ab" }, "nvim-treehopper": { "branch": "master", "commit": "5a28bff46c05d28bdb4bcaef67e046eb915a9390" }, - "nvim-treesitter": { "branch": "master", "commit": "736a672afe852dbad4199002c89b7461b285c47f" }, + "nvim-treesitter": { "branch": "master", "commit": "6aababfca4e3d72cb1e8fbbdac4115a5f88107d0" }, "nvim-treesitter-context": { "branch": "master", "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" }, "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, "paint.nvim": { "branch": "main", "commit": "6ce64212804f425073c61ab0d9c2b034f0435260" }, "persisted.nvim": { "branch": "main", "commit": "c1c4bbff8a4e9b9f66812b2daa9d3338916e8da2" }, @@ -67,7 +67,7 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "ec7ade261f961a5299a13451aa18a4dce630d0b3" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "smartyank.nvim": { "branch": "master", "commit": "7e3905578f646503525b2f7018b8afd17861018c" }, - "sniprun": { "branch": "master", "commit": "6f9025bf475799bc0fbe8b338b3912f4a701ff81" }, + "sniprun": { "branch": "master", "commit": "1f698c5d26afa356f548d4be5a0deb389d0bb387" }, "specs.nvim": { "branch": "main", "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" }, "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, "suda.vim": { "branch": "master", "commit": "8b0fc3711760195aba104e2d190cff9af8267052" }, @@ -77,7 +77,7 @@ "telescope-live-grep-args.nvim": { "branch": "master", "commit": "0f75ea809c46af8997c64f49c52e3c641d887885" }, "telescope-undo.nvim": { "branch": "main", "commit": "3dec002ea3e7952071d26fbb5d01e2038a58a554" }, "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, - "telescope.nvim": { "branch": "master", "commit": "1228f3b15ca3d9b95dcb92efda6a3448871030bd" }, + "telescope.nvim": { "branch": "master", "commit": "22735947d84d78f29436c203f0a4b8dc15dda204" }, "toggleterm.nvim": { "branch": "main", "commit": "00c13dccc78c09fa5da4c5edda990a363e75035e" }, "trouble.nvim": { "branch": "main", "commit": "fc4bb22b1d2cd5eb46fe61a9f6d6416d742beb5c" }, "vim-cool": { "branch": "master", "commit": "04bb7f5dade175a81b47abf4e87aeb30b05b33d8" }, @@ -85,7 +85,7 @@ "vim-fugitive": { "branch": "master", "commit": "b3b838d690f315a503ec4af8c634bdff3b200aaf" }, "vim-go": { "branch": "master", "commit": "12de6c0bc0efce3cedc5e28d4fe0ecc3a4aaeb77" }, "vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" }, - "vim-matchup": { "branch": "master", "commit": "ca8971739e3908973c5912cb3a0ffb6cf7bd83e7" }, + "vim-matchup": { "branch": "master", "commit": "0646093e07b1f89b16536cfb3dc4993e3f0ac653" }, "which-key.nvim": { "branch": "main", "commit": "38b990f6eabf62014018b4aae70a97d7a6c2eb88" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } } \ No newline at end of file From 430375e583bfeee111b72dc348af8b89fecaaa7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E9=85=94=E9=96=91=E5=90=9F?= <50296129+Jint-lzxy@users.noreply.github.com> Date: Fri, 28 Jul 2023 11:48:56 +0800 Subject: [PATCH 5/7] fix(dap-keymap): properly create and destroy keymaps (#902) * fix(dap-keymap): properly create and destroy keymaps * fixup! fix(dap-keymap): properly create and destroy keymaps --- .github/workflows/lint_code.yml | 2 +- lua/core/event.lua | 8 +++- lua/modules/configs/tool/dap/dap-keymap.lua | 49 ++++++++++++++++++++- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint_code.yml b/.github/workflows/lint_code.yml index 2eff9436d..ebf3a1a94 100644 --- a/.github/workflows/lint_code.yml +++ b/.github/workflows/lint_code.yml @@ -7,4 +7,4 @@ jobs: - uses: actions/checkout@v3 - uses: lunarmodules/luacheck@v1 with: - args: . --std luajit --globals vim _toggle_lazygit _command_panel --max-line-length 150 --no-config + args: . --std luajit --globals vim _toggle_lazygit _command_panel _lspkeymap_loaded_bufnr --max-line-length 150 --no-config diff --git a/lua/core/event.lua b/lua/core/event.lua index b1d8dd9ca..e88d74e85 100644 --- a/lua/core/event.lua +++ b/lua/core/event.lua @@ -14,10 +14,14 @@ function autocmd.nvim_create_augroups(definitions) end local mapping = require("keymap.completion") +_G._lspkeymap_loaded_bufnr = {} vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), + group = vim.api.nvim_create_augroup("LspKeymapLoader", { clear = true }), callback = function(event) - mapping.lsp(event.buf) + if not _lspkeymap_loaded_bufnr[event.buf] then + mapping.lsp(event.buf) + _lspkeymap_loaded_bufnr[event.buf] = true + end end, }) diff --git a/lua/modules/configs/tool/dap/dap-keymap.lua b/lua/modules/configs/tool/dap/dap-keymap.lua index 4505e1217..495ef5cb2 100644 --- a/lua/modules/configs/tool/dap/dap-keymap.lua +++ b/lua/modules/configs/tool/dap/dap-keymap.lua @@ -5,6 +5,14 @@ local map_cr = bind.map_cr local map_cmd = bind.map_cmd local did_load_debug_mappings = false +local keymap_info_debug = { + n = { K = false }, + v = { K = false }, +} +local keymap_info_original = { + n = { K = true }, + v = { K = false }, +} local debug_keymap = { ["nv|K"] = map_cmd("lua require('dapui').eval()") :with_noremap() @@ -16,16 +24,53 @@ local original_keymap = { ["v|K"] = map_cmd(":m '<-2gv=gv"), } +local function del_keymap(mappings, keymap_info) + for key in pairs(mappings) do + local modes, keymap = key:match("([^|]*)|?(.*)") + for _, mode in ipairs(vim.split(modes, "")) do + if vim.fn.maparg(keymap, mode, false) ~= "" then + if keymap_info[mode][keymap] == true then + vim.api.nvim_buf_del_keymap(0, mode, keymap) + else + vim.api.nvim_del_keymap(mode, keymap) + end + end + end + end +end + +local function load_keymap(mappings, keymap_info) + for key, value in pairs(mappings) do + local modes, keymap = key:match("([^|]*)|?(.*)") + if type(value) == "table" then + for _, mode in ipairs(vim.split(modes, "")) do + local rhs = value.cmd + local options = value.options + if keymap_info[mode][keymap] == true then + for buf in pairs(_G._lspkeymap_loaded_bufnr) do + -- Restore lsp keymaps + vim.api.nvim_buf_set_keymap(buf, mode, keymap, rhs, options) + end + else + vim.api.nvim_set_keymap(mode, keymap, rhs, options) + end + end + end + end +end + function M.load() if not did_load_debug_mappings then - bind.nvim_load_mapping(debug_keymap) + del_keymap(original_keymap, keymap_info_original) + load_keymap(debug_keymap, keymap_info_debug) did_load_debug_mappings = true end end function M.restore() if did_load_debug_mappings then - bind.nvim_load_mapping(original_keymap) + del_keymap(debug_keymap, keymap_info_debug) + load_keymap(original_keymap, keymap_info_original) did_load_debug_mappings = false end end From c09fb334e356676a389796cfd705d4c1e5e10674 Mon Sep 17 00:00:00 2001 From: TonyWu20 Date: Fri, 28 Jul 2023 11:55:03 +0800 Subject: [PATCH 6/7] Merge from ayamir-main --- lazy-lock.json | 482 +++++------------------- lua/modules/configs/editor/vimtex.lua | 3 +- lua/modules/configs/editor/wrapping.lua | 5 + lua/modules/plugins/editor.lua | 3 + 4 files changed, 107 insertions(+), 386 deletions(-) create mode 100644 lua/modules/configs/editor/wrapping.lua diff --git a/lazy-lock.json b/lazy-lock.json index 72c4fb5ea..8d48cca0b 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,386 +1,98 @@ { - "Comment.nvim": { - "branch": "master", - "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" - }, - "LuaSnip": { - "branch": "master", - "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" - }, - "accelerated-jk.nvim": { - "branch": "main", - "commit": "8fb5dad4ccc1811766cebf16b544038aeeb7806f" - }, - "alpha-nvim": { - "branch": "main", - "commit": "e4fc5e29b731bdf55d204c5c6a11dc3be70f3b65" - }, - "autoclose.nvim": { - "branch": "main", - "commit": "469782b0456f0b4f764378ffda94c18599544e09" - }, - "better-escape.nvim": { - "branch": "master", - "commit": "7031dc734add47bb71c010e0551829fa5799375f" - }, - "bigfile.nvim": { - "branch": "main", - "commit": "9616b73670ffeb92679677554ded88854ae42cf8" - }, - "bufferline.nvim": { - "branch": "main", - "commit": "99f0932365b34e22549ff58e1bea388465d15e99" - }, - "catppuccin": { - "branch": "refactor/syntax-highlighting", - "commit": "d9989a56380f4c30f8fda41eb9a9ac0932d4f383" - }, - "clever-f.vim": { - "branch": "master", - "commit": "6a3ac5e3688598af9411ab741737f98c47370c22" - }, - "cmp-buffer": { - "branch": "main", - "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" - }, - "cmp-latex-symbols": { - "branch": "main", - "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" - }, - "cmp-nvim-lsp": { - "branch": "main", - "commit": "44b16d11215dce86f253ce0c30949813c0a90765" - }, - "cmp-nvim-lua": { - "branch": "main", - "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" - }, - "cmp-pandoc-references": { - "branch": "master", - "commit": "0f84af3682be2845775f811b82251edeadb8faf6" - }, - "cmp-path": { - "branch": "main", - "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" - }, - "cmp-spell": { - "branch": "master", - "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" - }, - "cmp-tmux": { - "branch": "main", - "commit": "984772716f66d8ee88535a6bf3f94c4b4e1301f5" - }, - "cmp-treesitter": { - "branch": "master", - "commit": "c8e3a74b51597d69d240085a258636972ce98e15" - }, - "cmp-under-comparator": { - "branch": "master", - "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" - }, - "cmp_luasnip": { - "branch": "master", - "commit": "18095520391186d634a0045dacaa346291096566" - }, - "copilot-cmp": { - "branch": "master", - "commit": "c2cdb3c0f5078b0619055af192295830a7987790" - }, - "copilot.lua": { - "branch": "master", - "commit": "e48bd7020a98be217d85c006a298656294fd6210" - }, - "crates.nvim": { - "branch": "main", - "commit": "4ce7c51b881e58f1e2f8f437f30e4e583cbac319" - }, - "csv.vim": { - "branch": "master", - "commit": "15ff93edf5b26c466affbb356e0696b7d6a3b499" - }, - "diffview.nvim": { - "branch": "main", - "commit": "e91110d2a7f8e2f667666aba6ea089ff823f8748" - }, - "edge": { - "branch": "master", - "commit": "358cb6688ac577470a4eafcb53bdd63899dfc937" - }, - "fidget.nvim": { - "branch": "legacy", - "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" - }, - "focus.nvim": { - "branch": "master", - "commit": "a994282f957840ee3419ad62a36be9d4e155560c" - }, - "friendly-snippets": { - "branch": "main", - "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" - }, - "fzy-lua-native": { - "branch": "master", - "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" - }, - "gitsigns.nvim": { - "branch": "main", - "commit": "11b80e7eea249affc8776483272bcfc627b5552a" - }, - "hop.nvim": { - "branch": "master", - "commit": "e41c04125fab05406be576640749352ad3eafcdb" - }, - "indent-blankline.nvim": { - "branch": "master", - "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" - }, - "knap": { - "branch": "main", - "commit": "503010f541696e99ed5c62f658620e546cebf8b0" - }, - "lazy.nvim": { - "branch": "main", - "commit": "3ad55ae678876516156cca2f361c51f7952a924b" - }, - "lsp_signature.nvim": { - "branch": "master", - "commit": "58d4e810801da74c29313da86075d6aea537501f" - }, - "lspsaga.nvim": { - "branch": "main", - "commit": "23a481f0b142f4498e2fc2dd80e7a404079833e6" - }, - "lualine.nvim": { - "branch": "master", - "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" - }, - "markdown-preview.nvim": { - "branch": "master", - "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" - }, - "mason-lspconfig.nvim": { - "branch": "main", - "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" - }, - "mason-null-ls.nvim": { - "branch": "main", - "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" - }, - "mason-nvim-dap.nvim": { - "branch": "main", - "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" - }, - "mason.nvim": { - "branch": "main", - "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" - }, - "neodim": { - "branch": "master", - "commit": "9477da03b93f1984a81fee3b92e6ac7c6ada6aa4" - }, - "neoscroll.nvim": { - "branch": "master", - "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" - }, - "nord.nvim": { - "branch": "master", - "commit": "fab04b2dd4b64f4b1763b9250a8824d0b5194b8f" - }, - "null-ls.nvim": { - "branch": "main", - "commit": "db09b6c691def0038c456551e4e2772186449f35" - }, - "nvim-bufdel": { - "branch": "main", - "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" - }, - "nvim-cmp": { - "branch": "main", - "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" - }, - "nvim-colorizer.lua": { - "branch": "master", - "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" - }, - "nvim-dap": { - "branch": "master", - "commit": "0a02ed103e4da1928dc88428248dec7bb5ee6f34" - }, - "nvim-dap-ui": { - "branch": "master", - "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" - }, - "nvim-lspconfig": { - "branch": "master", - "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" - }, - "nvim-notify": { - "branch": "master", - "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" - }, - "nvim-scrollview": { - "branch": "main", - "commit": "dc236a2e6503f46598554d0955fe897dbcfa4807" - }, - "nvim-tree.lua": { - "branch": "master", - "commit": "273c1700eb68c27dce4e518efafc8144fd7ce4ab" - }, - "nvim-treehopper": { - "branch": "master", - "commit": "5a28bff46c05d28bdb4bcaef67e046eb915a9390" - }, - "nvim-treesitter": { - "branch": "master", - "commit": "736a672afe852dbad4199002c89b7461b285c47f" - }, - "nvim-treesitter-context": { - "branch": "master", - "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" - }, - "nvim-treesitter-textobjects": { - "branch": "master", - "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" - }, - "nvim-ts-autotag": { - "branch": "main", - "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" - }, - "nvim-ts-context-commentstring": { - "branch": "main", - "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" - }, - "nvim-web-devicons": { - "branch": "master", - "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" - }, - "obsidian.nvim": { - "branch": "main", - "commit": "1534187b4e3eee40053918388460c739d2b76da4" - }, - "paint.nvim": { - "branch": "main", - "commit": "6ce64212804f425073c61ab0d9c2b034f0435260" - }, - "persisted.nvim": { - "branch": "main", - "commit": "c1c4bbff8a4e9b9f66812b2daa9d3338916e8da2" - }, - "plenary.nvim": { - "branch": "master", - "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" - }, - "project.nvim": { - "branch": "main", - "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" - }, - "rainbow-delimiters.nvim": { - "branch": "master", - "commit": "5db37600becf689d78dbf066545b0de4d6f0ab94" - }, - "rust-tools.nvim": { - "branch": "master", - "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" - }, - "smartyank.nvim": { - "branch": "master", - "commit": "7e3905578f646503525b2f7018b8afd17861018c" - }, - "sniprun": { - "branch": "master", - "commit": "6f9025bf475799bc0fbe8b338b3912f4a701ff81" - }, - "specs.nvim": { - "branch": "main", - "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" - }, - "sqlite.lua": { - "branch": "master", - "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" - }, - "suda.vim": { - "branch": "master", - "commit": "8b0fc3711760195aba104e2d190cff9af8267052" - }, - "tabout.nvim": { - "branch": "master", - "commit": "0d275c8d25f32457e67b5c66d6ae43f26a61bce5" - }, - "telescope-bibtex.nvim": { - "branch": "master", - "commit": "0b01f5c457f208ff2e12ce4dae89a61eec1ed69d" - }, - "telescope-frecency.nvim": { - "branch": "master", - "commit": "62d3381a32ae541233b03a129ece0aeced30ad5e" - }, - "telescope-fzf-native.nvim": { - "branch": "main", - "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" - }, - "telescope-live-grep-args.nvim": { - "branch": "master", - "commit": "0f75ea809c46af8997c64f49c52e3c641d887885" - }, - "telescope-undo.nvim": { - "branch": "main", - "commit": "3dec002ea3e7952071d26fbb5d01e2038a58a554" - }, - "telescope-zoxide": { - "branch": "main", - "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" - }, - "telescope.nvim": { - "branch": "master", - "commit": "1228f3b15ca3d9b95dcb92efda6a3448871030bd" - }, - "toggleterm.nvim": { - "branch": "main", - "commit": "00c13dccc78c09fa5da4c5edda990a363e75035e" - }, - "trouble.nvim": { - "branch": "main", - "commit": "fc4bb22b1d2cd5eb46fe61a9f6d6416d742beb5c" - }, - "vim-cool": { - "branch": "master", - "commit": "04bb7f5dade175a81b47abf4e87aeb30b05b33d8" - }, - "vim-easy-align": { - "branch": "master", - "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" - }, - "vim-fugitive": { - "branch": "master", - "commit": "b3b838d690f315a503ec4af8c634bdff3b200aaf" - }, - "vim-go": { - "branch": "master", - "commit": "12de6c0bc0efce3cedc5e28d4fe0ecc3a4aaeb77" - }, - "vim-illuminate": { - "branch": "master", - "commit": "a2907275a6899c570d16e95b9db5fd921c167502" - }, - "vim-matchup": { - "branch": "master", - "commit": "ca8971739e3908973c5912cb3a0ffb6cf7bd83e7" - }, - "vim-pencil": { - "branch": "master", - "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" - }, - "vimtex": { - "branch": "master", - "commit": "877de3ba5de5f766e5bfa1c3fb0d2ecfcd18f868" - }, - "which-key.nvim": { - "branch": "main", - "commit": "38b990f6eabf62014018b4aae70a97d7a6c2eb88" - }, - "wilder.nvim": { - "branch": "master", - "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" - } -} + "Comment.nvim": { "branch": "master", "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" }, + "LuaSnip": { "branch": "master", "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" }, + "accelerated-jk.nvim": { "branch": "main", "commit": "8fb5dad4ccc1811766cebf16b544038aeeb7806f" }, + "alpha-nvim": { "branch": "main", "commit": "e4fc5e29b731bdf55d204c5c6a11dc3be70f3b65" }, + "autoclose.nvim": { "branch": "main", "commit": "469782b0456f0b4f764378ffda94c18599544e09" }, + "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" }, + "bigfile.nvim": { "branch": "main", "commit": "9616b73670ffeb92679677554ded88854ae42cf8" }, + "bufferline.nvim": { "branch": "main", "commit": "99f0932365b34e22549ff58e1bea388465d15e99" }, + "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "d9989a56380f4c30f8fda41eb9a9ac0932d4f383" }, + "clever-f.vim": { "branch": "master", "commit": "6a3ac5e3688598af9411ab741737f98c47370c22" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-pandoc-references": { "branch": "master", "commit": "0f84af3682be2845775f811b82251edeadb8faf6" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" }, + "cmp-tmux": { "branch": "main", "commit": "984772716f66d8ee88535a6bf3f94c4b4e1301f5" }, + "cmp-treesitter": { "branch": "master", "commit": "c8e3a74b51597d69d240085a258636972ce98e15" }, + "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "copilot-cmp": { "branch": "master", "commit": "c2cdb3c0f5078b0619055af192295830a7987790" }, + "copilot.lua": { "branch": "master", "commit": "e48bd7020a98be217d85c006a298656294fd6210" }, + "crates.nvim": { "branch": "main", "commit": "4ce7c51b881e58f1e2f8f437f30e4e583cbac319" }, + "csv.vim": { "branch": "master", "commit": "15ff93edf5b26c466affbb356e0696b7d6a3b499" }, + "diffview.nvim": { "branch": "main", "commit": "e91110d2a7f8e2f667666aba6ea089ff823f8748" }, + "edge": { "branch": "master", "commit": "358cb6688ac577470a4eafcb53bdd63899dfc937" }, + "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, + "focus.nvim": { "branch": "master", "commit": "a994282f957840ee3419ad62a36be9d4e155560c" }, + "friendly-snippets": { "branch": "main", "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, + "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, + "gitsigns.nvim": { "branch": "main", "commit": "11b80e7eea249affc8776483272bcfc627b5552a" }, + "hop.nvim": { "branch": "master", "commit": "e41c04125fab05406be576640749352ad3eafcdb" }, + "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, + "knap": { "branch": "main", "commit": "503010f541696e99ed5c62f658620e546cebf8b0" }, + "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, + "lsp_signature.nvim": { "branch": "master", "commit": "04f0c52c6a04680f29bdecb5b2943591b8c0ff43" }, + "lspsaga.nvim": { "branch": "main", "commit": "23a481f0b142f4498e2fc2dd80e7a404079833e6" }, + "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, + "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" }, + "mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, + "neodim": { "branch": "master", "commit": "9477da03b93f1984a81fee3b92e6ac7c6ada6aa4" }, + "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, + "nord.nvim": { "branch": "master", "commit": "fab04b2dd4b64f4b1763b9250a8824d0b5194b8f" }, + "null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" }, + "nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" }, + "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, + "nvim-dap": { "branch": "master", "commit": "2f28ea843bcdb378b171a66ddcd568516e431d55" }, + "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, + "nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, + "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, + "nvim-scrollview": { "branch": "main", "commit": "dc236a2e6503f46598554d0955fe897dbcfa4807" }, + "nvim-tree.lua": { "branch": "master", "commit": "273c1700eb68c27dce4e518efafc8144fd7ce4ab" }, + "nvim-treehopper": { "branch": "master", "commit": "5a28bff46c05d28bdb4bcaef67e046eb915a9390" }, + "nvim-treesitter": { "branch": "master", "commit": "ad3805f5c34b51890c3d3c37c2f0c86269598a32" }, + "nvim-treesitter-context": { "branch": "master", "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, + "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" }, + "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, + "obsidian.nvim": { "branch": "main", "commit": "ed7ace4823a57eeea1d296e86861c57eefe292bb" }, + "paint.nvim": { "branch": "main", "commit": "6ce64212804f425073c61ab0d9c2b034f0435260" }, + "persisted.nvim": { "branch": "main", "commit": "c1c4bbff8a4e9b9f66812b2daa9d3338916e8da2" }, + "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, + "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "ec7ade261f961a5299a13451aa18a4dce630d0b3" }, + "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, + "smartyank.nvim": { "branch": "master", "commit": "7e3905578f646503525b2f7018b8afd17861018c" }, + "sniprun": { "branch": "master", "commit": "6f9025bf475799bc0fbe8b338b3912f4a701ff81" }, + "specs.nvim": { "branch": "main", "commit": "2743e412bbe21c9d73954c403d01e8de7377890d" }, + "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, + "suda.vim": { "branch": "master", "commit": "8b0fc3711760195aba104e2d190cff9af8267052" }, + "tabout.nvim": { "branch": "master", "commit": "0d275c8d25f32457e67b5c66d6ae43f26a61bce5" }, + "telescope-bibtex.nvim": { "branch": "master", "commit": "0b01f5c457f208ff2e12ce4dae89a61eec1ed69d" }, + "telescope-frecency.nvim": { "branch": "master", "commit": "62d3381a32ae541233b03a129ece0aeced30ad5e" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope-live-grep-args.nvim": { "branch": "master", "commit": "0f75ea809c46af8997c64f49c52e3c641d887885" }, + "telescope-undo.nvim": { "branch": "main", "commit": "3dec002ea3e7952071d26fbb5d01e2038a58a554" }, + "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, + "telescope.nvim": { "branch": "master", "commit": "22735947d84d78f29436c203f0a4b8dc15dda204" }, + "toggleterm.nvim": { "branch": "main", "commit": "00c13dccc78c09fa5da4c5edda990a363e75035e" }, + "trouble.nvim": { "branch": "main", "commit": "fc4bb22b1d2cd5eb46fe61a9f6d6416d742beb5c" }, + "vim-cool": { "branch": "master", "commit": "04bb7f5dade175a81b47abf4e87aeb30b05b33d8" }, + "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, + "vim-fugitive": { "branch": "master", "commit": "b3b838d690f315a503ec4af8c634bdff3b200aaf" }, + "vim-go": { "branch": "master", "commit": "12de6c0bc0efce3cedc5e28d4fe0ecc3a4aaeb77" }, + "vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" }, + "vim-matchup": { "branch": "master", "commit": "ca8971739e3908973c5912cb3a0ffb6cf7bd83e7" }, + "vim-pencil": { "branch": "master", "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" }, + "vimtex": { "branch": "master", "commit": "877de3ba5de5f766e5bfa1c3fb0d2ecfcd18f868" }, + "which-key.nvim": { "branch": "main", "commit": "38b990f6eabf62014018b4aae70a97d7a6c2eb88" }, + "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } +} \ No newline at end of file diff --git a/lua/modules/configs/editor/vimtex.lua b/lua/modules/configs/editor/vimtex.lua index b6a21daa3..e50adbf15 100644 --- a/lua/modules/configs/editor/vimtex.lua +++ b/lua/modules/configs/editor/vimtex.lua @@ -1,8 +1,9 @@ return function() - vim.g.vimtex_view_method = "zathura" + vim.g.vimtex_view_method = "skim" vim.g.vimtex_compiler_latexmk_engines = { _ = "-xelatex", } vim.g.tex_comment_nospell = 1 vim.g.vimtex_compiler_progname = "nvr" + vim.g.vimtex_view_skim_sync = 1 end diff --git a/lua/modules/configs/editor/wrapping.lua b/lua/modules/configs/editor/wrapping.lua new file mode 100644 index 000000000..80796a165 --- /dev/null +++ b/lua/modules/configs/editor/wrapping.lua @@ -0,0 +1,5 @@ +return function() + require("wrapping").setup({ + softener = { latex = 0.8 }, + }) +end diff --git a/lua/modules/plugins/editor.lua b/lua/modules/plugins/editor.lua index fd7b4eb22..b87866162 100644 --- a/lua/modules/plugins/editor.lua +++ b/lua/modules/plugins/editor.lua @@ -122,5 +122,8 @@ editor["lervag/vimtex"] = { config = require("editor.vimtex"), ft = "tex", } +-- editor["andrewferrier/wrapping.nvim"] = { +-- config = require("editor.wrapping"), +-- } return editor From 372d3c9f7dab8db15b5b7268442b2b3584801515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E9=85=94=E9=96=91=E5=90=9F?= <50296129+Jint-lzxy@users.noreply.github.com> Date: Fri, 28 Jul 2023 17:19:00 +0800 Subject: [PATCH 7/7] fix(dap-keymap): simplify keymap implementation (#905) * fix(dap-keymap): simplify keymap implementation * Implement keymap module * fix(dap-keymap)!: simplify keymap implementation --- .github/workflows/lint_code.yml | 2 +- lua/core/event.lua | 6 +- lua/modules/configs/tool/dap/dap-keymap.lua | 63 +------- lua/modules/configs/tool/dap/init.lua | 9 +- lua/modules/utils/keymap.lua | 150 ++++++++++++++++++++ 5 files changed, 159 insertions(+), 71 deletions(-) create mode 100644 lua/modules/utils/keymap.lua diff --git a/.github/workflows/lint_code.yml b/.github/workflows/lint_code.yml index ebf3a1a94..622cbbd4c 100644 --- a/.github/workflows/lint_code.yml +++ b/.github/workflows/lint_code.yml @@ -7,4 +7,4 @@ jobs: - uses: actions/checkout@v3 - uses: lunarmodules/luacheck@v1 with: - args: . --std luajit --globals vim _toggle_lazygit _command_panel _lspkeymap_loaded_bufnr --max-line-length 150 --no-config + args: . --std luajit --globals vim _toggle_lazygit _command_panel _debugging --max-line-length 150 --no-config diff --git a/lua/core/event.lua b/lua/core/event.lua index e88d74e85..db579fef4 100644 --- a/lua/core/event.lua +++ b/lua/core/event.lua @@ -14,14 +14,10 @@ function autocmd.nvim_create_augroups(definitions) end local mapping = require("keymap.completion") -_G._lspkeymap_loaded_bufnr = {} vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("LspKeymapLoader", { clear = true }), callback = function(event) - if not _lspkeymap_loaded_bufnr[event.buf] then - mapping.lsp(event.buf) - _lspkeymap_loaded_bufnr[event.buf] = true - end + mapping.lsp(event.buf) end, }) diff --git a/lua/modules/configs/tool/dap/dap-keymap.lua b/lua/modules/configs/tool/dap/dap-keymap.lua index 495ef5cb2..bdaf08d32 100644 --- a/lua/modules/configs/tool/dap/dap-keymap.lua +++ b/lua/modules/configs/tool/dap/dap-keymap.lua @@ -1,78 +1,21 @@ local M = {} local bind = require("keymap.bind") -local map_cr = bind.map_cr local map_cmd = bind.map_cmd local did_load_debug_mappings = false -local keymap_info_debug = { - n = { K = false }, - v = { K = false }, -} -local keymap_info_original = { - n = { K = true }, - v = { K = false }, -} local debug_keymap = { ["nv|K"] = map_cmd("lua require('dapui').eval()") :with_noremap() :with_nowait() - :with_desc("debug: Evaluate expression under cursor"), -} -local original_keymap = { - ["n|K"] = map_cr("Lspsaga hover_doc"):with_noremap():with_silent():with_desc("lsp: Show doc"), - ["v|K"] = map_cmd(":m '<-2gv=gv"), + :with_desc("Evaluate expression under cursor"), } -local function del_keymap(mappings, keymap_info) - for key in pairs(mappings) do - local modes, keymap = key:match("([^|]*)|?(.*)") - for _, mode in ipairs(vim.split(modes, "")) do - if vim.fn.maparg(keymap, mode, false) ~= "" then - if keymap_info[mode][keymap] == true then - vim.api.nvim_buf_del_keymap(0, mode, keymap) - else - vim.api.nvim_del_keymap(mode, keymap) - end - end - end - end -end - -local function load_keymap(mappings, keymap_info) - for key, value in pairs(mappings) do - local modes, keymap = key:match("([^|]*)|?(.*)") - if type(value) == "table" then - for _, mode in ipairs(vim.split(modes, "")) do - local rhs = value.cmd - local options = value.options - if keymap_info[mode][keymap] == true then - for buf in pairs(_G._lspkeymap_loaded_bufnr) do - -- Restore lsp keymaps - vim.api.nvim_buf_set_keymap(buf, mode, keymap, rhs, options) - end - else - vim.api.nvim_set_keymap(mode, keymap, rhs, options) - end - end - end - end -end - -function M.load() +function M.load_extras() if not did_load_debug_mappings then - del_keymap(original_keymap, keymap_info_original) - load_keymap(debug_keymap, keymap_info_debug) + require("modules.utils.keymap").amend("Debugging", "_debugging", debug_keymap) did_load_debug_mappings = true end end -function M.restore() - if did_load_debug_mappings then - del_keymap(debug_keymap, keymap_info_debug) - load_keymap(original_keymap, keymap_info_original) - did_load_debug_mappings = false - end -end - return M diff --git a/lua/modules/configs/tool/dap/init.lua b/lua/modules/configs/tool/dap/init.lua index 489f0dc9b..8fff15a4e 100644 --- a/lua/modules/configs/tool/dap/init.lua +++ b/lua/modules/configs/tool/dap/init.lua @@ -8,16 +8,15 @@ return function() local mappings = require("tool.dap.dap-keymap") -- Initialize debug hooks - local _debugging = false + _G._debugging = false local function debug_init_cb() - _debugging = true - mappings.load() + _G._debugging = true + mappings.load_extras() dapui.open({ reset = true }) end local function debug_terminate_cb() if _debugging then - _debugging = false - mappings.restore() + _G._debugging = false dapui.close() end end diff --git a/lua/modules/utils/keymap.lua b/lua/modules/utils/keymap.lua new file mode 100644 index 000000000..033e1686a --- /dev/null +++ b/lua/modules/utils/keymap.lua @@ -0,0 +1,150 @@ +local M = {} + +---Shortcut for `nvim_replace_termcodes`. +---@param keys string +---@return string +local function termcodes(keys) + return vim.api.nvim_replace_termcodes(keys, true, true, true) +end + +---Returns if two key sequence are equal or not. +---@param a string +---@param b string +---@return boolean +local function keymap_equals(a, b) + return termcodes(a) == termcodes(b) +end + +---Get map +---@param mode string +---@param lhs string +---@return table +local function get_map(mode, lhs) + for _, map in ipairs(vim.api.nvim_buf_get_keymap(0, mode)) do + if keymap_equals(map.lhs, lhs) then + return { + lhs = map.lhs, + rhs = map.rhs or "", + expr = map.expr == 1, + callback = map.callback, + noremap = map.noremap == 1, + script = map.script == 1, + silent = map.silent == 1, + nowait = map.nowait == 1, + buffer = true, + } + end + end + + for _, map in ipairs(vim.api.nvim_get_keymap(mode)) do + if keymap_equals(map.lhs, lhs) then + return { + lhs = map.lhs, + rhs = map.rhs or "", + expr = map.expr == 1, + callback = map.callback, + noremap = map.noremap == 1, + script = map.script == 1, + silent = map.silent == 1, + nowait = map.nowait == 1, + buffer = false, + } + end + end + + return { + lhs = lhs, + rhs = lhs, + expr = false, + callback = nil, + noremap = true, + script = false, + silent = true, + nowait = false, + buffer = false, + } +end + +---Returns the function constructed from the passed keymap object on call of +---which the original keymapping will be executed. +---@param map table keymap object +---@return function +local function get_fallback(map) + return function() + local keys, fmode + if map.expr then + if map.callback then + keys = map.callback() + else + keys = vim.api.nvim_eval(map.rhs) + end + elseif map.callback then + map.callback() + return + else + keys = map.rhs + end + keys = termcodes(keys) + fmode = map.noremap and "in" or "im" + vim.api.nvim_feedkeys(keys, fmode, false) + end +end + +---@param cond string +---@param mode string +---@param lhs string +---@param rhs function +---@param opts? table +local function amend(cond, mode, lhs, rhs, opts) + local map = get_map(mode, lhs) + local fallback = get_fallback(map) + local options = vim.deepcopy(opts) or {} + options.desc = table.concat({ + "[" .. cond, + (options.desc and ": " .. options.desc or ""), + "]", + (map.desc and " / " .. map.desc or ""), + }) + vim.keymap.set(mode, lhs, function() + rhs(fallback) + end, options) +end + +---Amend the existing keymap. +---@param cond string +---@param mode string | string[] +---@param lhs string +---@param rhs function +---@param opts? table +local function modes_amend(cond, mode, lhs, rhs, opts) + if type(mode) == "table" then + for _, m in ipairs(mode) do + amend(cond, m, lhs, rhs, opts) + end + else + amend(cond, mode, lhs, rhs, opts) + end +end + +---@param cond string +---@param global_flag string +---@param mapping table +function M.amend(cond, global_flag, mapping) + for key, value in pairs(mapping) do + local modes, keymap = key:match("([^|]*)|?(.*)") + if type(value) == "table" then + local rhs = value.cmd + local options = value.options + modes_amend(cond, vim.split(modes, ""), keymap, function(fallback) + if _G[global_flag] then + local fmode = options.noremap and "in" or "im" + vim.api.nvim_feedkeys(termcodes(rhs), fmode, false) + else + fallback() + end + end, options) + end + end +end + +return M