完善treesitter相关配置

This commit is contained in:
a770 2025-06-08 19:08:27 +08:00
parent d1f5f0a2c8
commit 6a883b41e9
12 changed files with 207 additions and 182 deletions

View file

@ -6,3 +6,5 @@
```bash
paru -S python-neovim python-pip npm
```
![效果](效果.jpg)

BIN
.github/效果.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 KiB

View file

@ -3,18 +3,18 @@
"blink-cmp-avante": { "branch": "master", "commit": "ddefb8de3cb1286ab39e0ccec0f32a45d03391f2" },
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "56a9dfd1e05868cf3189369aad87242941396563" },
"catppuccin": { "branch": "main", "commit": "a0c769bc7cd04bbbf258b3d5f01e2bdce744108d" },
"cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" },
"conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" },
"copilot.lua": { "branch": "master", "commit": "5f726c8e6bbcd7461ee0b870d4e6c8a973b55b64" },
"conform.nvim": { "branch": "master", "commit": "0e93e0d12d2f7ebdea9e3e444dfaff0050cefbe6" },
"copilot.lua": { "branch": "master", "commit": "c1bb86abbed1a52a11ab3944ef00c8410520543d" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"dropbar.nvim": { "branch": "master", "commit": "f7ecb0c3600ca1dc467c361e9af40f97289d7aad" },
"dropbar.nvim": { "branch": "master", "commit": "ce1db78abd1fae838abc23740b8fc9525679d6dc" },
"fittencode.nvim": { "branch": "master", "commit": "be2e6e8345bb76922fae37012af10c3cc51585b5" },
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
"flutter-tools.nvim": { "branch": "main", "commit": "d1022db80dab2a565563993843e8c60b20a3df39" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"fzf-lua": { "branch": "main", "commit": "29e982dfc96a134fecc80853c8cb8324e43e574b" },
"gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" },
"fzf-lua": { "branch": "main", "commit": "6d1d81a5c7936d82a47a41a521958e482e499fde" },
"gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" },
"gtranslate.nvim": { "branch": "master", "commit": "a3ce65cd2ccda9c3198869fee53553d575aa547d" },
"img-clip.nvim": { "branch": "main", "commit": "08a02e14c8c0d42fa7a92c30a98fd04d6993b35d" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
@ -24,9 +24,10 @@
"kommentary": { "branch": "main", "commit": "d5a111a3bc4109a8f913a5863c9092b3b3801482" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
"llm.nvim": { "branch": "main", "commit": "dc5d729a6482f38018f9a465b90a79420d139719" },
"llm.nvim": { "branch": "main", "commit": "22eb06f362e89a48e5a0053b93398568b7f26001" },
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "67da97f8c2fd12d05427bb485ce07ee6418e0a51" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "bef29b653ba71d442816bf56286c2a686210be04" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"mini.nvim": { "branch": "stable", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
"mini.pick": { "branch": "main", "commit": "c272dc61cd0326b344761cd9d031bfcdef1978c7" },
@ -35,24 +36,24 @@
"nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" },
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" },
"nvim-dap-view": { "branch": "main", "commit": "186c9580895f8552a6e0eff8087e643a824dac2d" },
"nvim-lspconfig": { "branch": "master", "commit": "b8e7957bde4cbb3cb25a13a62548f7c273b026e9" },
"nvim-dap": { "branch": "master", "commit": "ea82027c3447dc1a022be9a9884de276c05cd33a" },
"nvim-dap-view": { "branch": "main", "commit": "995f5c6a80da3f2a55b5efc352754fb34230c87c" },
"nvim-lspconfig": { "branch": "master", "commit": "036885e8e5456d3907626b634693234f628afef6" },
"nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-context": { "branch": "master", "commit": "ed1cf48d5af252248c55f50b9427e8ce883a2c6b" },
"nvim-treesitter-context": { "branch": "master", "commit": "464a443b5a6657f39772b20baa95d02ffe97b268" },
"nvim-ufo": { "branch": "main", "commit": "3c7a3570e9c9dc198a2ad4491b0b0e51c4d4ba08" },
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
"peek.nvim": { "branch": "master", "commit": "a6f341dc2fca621bf3c9272360b9a62bc92bb1c0" },
"outline.nvim": { "branch": "main", "commit": "321f89ef79f168a78685f70d70c52d0e7b563abb" },
"peek.nvim": { "branch": "master", "commit": "803815d18689b8f9e69d433b08ed767d7555128c" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" },
"render-markdown.nvim": { "branch": "main", "commit": "048d68028d09ad2e134e7059032b8192a85180b9" },
"render-markdown.nvim": { "branch": "main", "commit": "6f5a4c36d9383b2a916facaa63dcd573afa11ee8" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
"symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"yazi.nvim": { "branch": "main", "commit": "59c22d1a8bcb3d00a7115ef7f2d59b90cf989ab3" }
"yazi.nvim": { "branch": "main", "commit": "e2ddbaa88ec61d0b96e3d53ba851b0e7a0b36f14" }
}

View file

@ -91,11 +91,11 @@ require("lazy").setup({
require("lazy.plugins.kittyscroll"),
-- 像cursor一样使用neovim
require("lazy.plugins.avante"),
-- 在浏览器中查看markdown preview
require("lazy.plugins.markdownpreview"),
-- mcp server插件
-- require("lazy.plugins.mcphub"),
-- 用于改进在 Neovim 中查看 Markdown 文件的插件
-- require("lazy.plugins.markview"),
-- require("lazy.plugins.render-markdown"),
-- 在浏览器中查看markdown preview
require("lazy.plugins.markdownpreview"),
})

View file

@ -13,51 +13,28 @@ return {
},
},
},
{ "williamboman/mason.nvim" },
{ "jay-babu/mason-nvim-dap.nvim" },
},
config = function()
vim.keymap.set("n", "<F5>", function()
require("dap").continue()
end)
vim.keymap.set("n", "<F10>", function()
require("dap").step_over()
end)
vim.keymap.set("n", "<F11>", function()
require("dap").step_into()
end)
vim.keymap.set("n", "<F12>", function()
require("dap").step_out()
end)
vim.keymap.set("n", "<Leader>b", function()
require("dap").toggle_breakpoint()
end)
vim.keymap.set("n", "<Leader>B", function()
require("dap").set_breakpoint()
end)
vim.keymap.set("n", "<Leader>lp", function()
local dap, dv = require("dap"), require("dap-view")
-- Keymappings for DAP
vim.keymap.set("n", "<leader>db", dap.toggle_breakpoint, { desc = "DAP: Toggle Breakpoint" })
vim.keymap.set("n", "<leader>dc", dap.continue, { desc = "DAP: Continue" })
vim.keymap.set("n", "<leader>do", dap.step_over, { desc = "DAP: Step Over" })
vim.keymap.set("n", "<leader>di", dap.step_into, { desc = "DAP: Step Into" })
vim.keymap.set("n", "<leader>du", dap.step_out, { desc = "DAP: Step Out" })
vim.keymap.set("n", "<leader>dr", dap.repl.open, { desc = "DAP: Open REPL" })
vim.keymap.set("n", "<leader>dt", dap.terminate, { desc = "DAP: Terminate" })
vim.keymap.set("n", "<leader>dl", function()
require("dap").run_last()
end, { desc = "DAP: Run Last" })
vim.keymap.set("n", "<Leader>dp", function()
require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
end)
vim.keymap.set("n", "<Leader>dr", function()
require("dap").repl.open()
end)
vim.keymap.set("n", "<Leader>dl", function()
require("dap").run_last()
end)
vim.keymap.set({ "n", "v" }, "<Leader>dh", function()
require("dap.ui.widgets").hover()
end)
vim.keymap.set({ "n", "v" }, "<Leader>dp", function()
require("dap.ui.widgets").preview()
end)
vim.keymap.set("n", "<Leader>df", function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.frames)
end)
vim.keymap.set("n", "<Leader>ds", function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.scopes)
end)
-- 自动切换和关闭
local dap, dv = require("dap"), require("dap-view")
dap.listeners.before.attach["dap-view-config"] = function()
dv.open()
end
@ -79,47 +56,45 @@ return {
})
-- 如果没有窗口包含缓冲区,请创建一个新选项卡
dap.defaults.fallback.switchbuf = "usevisible,usetab,newtab"
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
}
dap.configurations.c = {
dap.configurations.rust = {
{
name = "Launch",
type = "gdb",
name = "Launch Rust Program (GDB)",
type = "cppdbg", -- Use the cpptools adapter
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Select and attach to process",
type = "gdb",
request = "attach",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
pid = function()
local name = vim.fn.input("Executable name (filter): ")
return require("dap.utils").pick_process({ filter = name })
end,
cwd = "${workspaceFolder}",
},
{
name = "Attach to gdbserver :1234",
type = "gdb",
request = "attach",
target = "localhost:1234",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
-- Ask for the executable path when launching
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file")
end,
cwd = "${workspaceFolder}",
stopAtEntry = false,
MIMode = "gdb", -- Specify GDB
miDebuggerPath = "gdb", -- Or full path to gdb if not in PATH
-- setupCommands are executed at the beginning of the GDB session
setupCommands = {
{
text = "-enable-pretty-printing",
description = "Enable GDB pretty printing",
ignoreFailures = false,
},
-- You might need to find the exact path to rust-gdb on your system
-- It's usually in `~/.rustup/toolchains/<your-toolchain>/lib/rustlib/src/rust/etc/rust-gdb`
-- Or system-wide if rustc was installed differently.
-- Example: (ADJUST THIS PATH!)
-- {
-- text = "source ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/etc/rust-gdb",
-- description = "Load Rust GDB extensions",
-- ignoreFailures = true -- Set to true if the path might not always be valid
-- }
},
-- If you want to pass arguments to your program:
-- args = {"arg1", "arg2"},
},
-- You can add more configurations, e.g., for attaching to a running process
}
dap.configurations.cpp = dap.configurations.c
dap.configurations.rust = dap.configurations.c
require("mason-nvim-dap").setup({
ensure_installed = { "cpptools" },
handlers = {}, -- sets up dap in the predefined manner
})
end,
}

View file

@ -3,13 +3,27 @@ vim.o.foldcolumn = "0" -- '0' is not bad,其他的会有奇怪的数字
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- 设置可折叠处的样式
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
return {
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
config = function()
-- Option 2: nvim lsp as LSP client
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'}
for _, ls in ipairs(language_servers) do
require("lspconfig")[ls].setup({
capabilities = capabilities,
-- you can add other fields for setting up lsp server in this table
})
end
require("ufo").setup()
-- Option 3: treesitter as a main provider instead
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
@ -19,9 +33,7 @@ return {
end,
})
-- 键盘映射,这里的按键会打开或折叠全部的可折叠位置
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds)
vim.keymap.set("n", "zm", require("ufo").closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
vim.keymap.set("n", "zr", require("ufo").openAllFolds)
vim.keymap.set("n", "zm", require("ufo").closeAllFolds)
end,
}

View file

@ -1,5 +1,6 @@
return {
"Eandrju/cellular-automaton.nvim",
event = "VeryLazy",
keys = "<leader>rr",
config = function()
vim.keymap.set("n", "<leader>rr", "<cmd>CellularAutomaton make_it_rain<CR>")

View file

@ -5,8 +5,8 @@ return {
config = function()
require("peek").setup({
port = 9000,
-- app = { "firefox-esr", "-private-window" },
app = { "google-chrome-stable", "--app=http://localhost:9000/?theme=dark", "--incognito" },
app = { "firefox-esr", "-private-window" },
-- app = { "google-chrome-stable", "--app=http://localhost:9000/?theme=dark", "--incognito" },
})
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})

View file

@ -1,31 +1,54 @@
-- ===
-- === outlines,大纲,函数变量结构
-- ===
local map = require("core.keymap")
-- 空格+v打开大纲,N全部收起,n收起当前节点,r重命名,I展开全部节点,i展开当前节点
map:cmd('<space>v', 'SymbolsOutline')
return {
'simrat39/symbols-outline.nvim',
enabled = not vim.g.vscode,
config = function()
require("symbols-outline").setup {
"hedyhli/outline.nvim",
lazy = true,
cmd = { "Outline", "OutlineOpen" },
keys = { -- Example mapping to toggle outline
{ "<leader>v", "<cmd>Outline<CR>", desc = "Toggle outline" },
},
opts = {
outline_window = {
position = "left",
width = 20,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = {"<Esc>", "q"},
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
fold = "n",
unfold = "i",
fold_all = "N",
unfold_all = "I",
fold_reset = "R",
}
}
end
},
keymaps = {
show_help = "?",
close = { "<Esc>", "q" },
-- Jump to symbol under cursor.
-- It can auto close the outline window when triggered, see
-- 'auto_close' option above.
goto_location = "<Cr>",
-- Jump to symbol under cursor but keep focus on outline window.
peek_location = "o",
-- Visit location in code and close outline immediately
goto_and_close = "<S-Cr>",
-- Change cursor position of outline window to match current location in code.
-- 'Opposite' of goto/peek_location.
restore_location = "<C-g>",
-- Open LSP/provider-dependent symbol hover information
hover_symbol = "<C-space>",
-- Preview location code of the symbol under cursor
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
-- These fold actions are collapsing tree nodes, not code folding
fold = "n",
unfold = "i",
fold_toggle = "<Tab>",
-- Toggle folds for all nodes.
-- If at least one node is folded, this action will fold all nodes.
-- If all nodes are folded, this action will unfold all nodes.
fold_toggle_all = "<S-Tab>",
fold_all = "N",
unfold_all = "I",
fold_reset = "R",
-- Move down/up by one line and peek_location immediately.
-- You can also use outline_window.auto_jump=true to do this for any
-- j/k/<down>/<up>.
down_and_jump = "<C-e>",
up_and_jump = "<C-u>",
},
},
}

View file

@ -1,24 +1,24 @@
return {
"nvim-treesitter/nvim-treesitter-context",
config = function()
-- 前往上下文开始处winbar相同快捷键更细致
-- vim.keymap.set("n", "[c", function()
-- require("treesitter-context").go_to_context(vim.v.count1)
-- end, { silent = true })
require'treesitter-context'.setup{
-- 前往上下文开始处winbar可以做到更细致
vim.keymap.set("n", "[C", function()
require("treesitter-context").go_to_context(vim.v.count1)
end, { silent = true })
require("treesitter-context").setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
multiwindow = true, -- Enable multiwindow support.
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to show for a single context
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
zindex = 20, -- The Z-index of the context window
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
}
end
})
end,
}

View file

@ -3,38 +3,48 @@
-- ===
return {
'nvim-treesitter/nvim-treesitter',
"nvim-treesitter/nvim-treesitter",
config = function()
-- 要安装高亮的语言直接加入括号即可把sync_install设置为true下次进入vim自动安装语言列表查看treesitter的github
-- 或者执行:TSInstall <language_to_install>
local language = {
"python",
"lua",
"dart",
"markdown",
"go",
"bash",
"java",
"sql",
}
require("nvim-treesitter.configs").setup {
-- A list of parser names, or "all"
ensure_installed = language,
-- Install parsers synchronously (only applied to `ensure_installed`)
require("nvim-treesitter.configs").setup({
-- 要安装高亮的语言直接加入括号即可把sync_install设置为true下次进入vim自动安装
-- 或者手动执行:TSInstall <想要安装的语言>
-- 语言列表查看https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#supported-languages
ensure_installed = {
"json",
"rust",
"python",
"lua",
"markdown",
"bash",
"java",
-- "dart",
-- "go",
-- "sql",
},
-- 设置为true后位于ensure_installed里面的语言会自动安装
sync_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = {},
-- 这里填写不想要自动安装的语言
ignore_install = {
},
highlight = {
-- 默认开启高亮
enable = true,
-- list of language that will be disabled
disable = {},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
-- 想要禁用高亮的语言列表
-- disable = {
-- },
-- 使用function以提高灵活性禁用大型文件的高亮
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- 如果您依靠启用'语法'(例如,缩进),则将其设置为“ True”。
-- 使用此选项可能会放慢编辑器,您可能会看到一些重复的高亮。
-- 除了设置为true它也可以设置成语言列表
additional_vim_regex_highlighting = false,
},
}
end
})
end,
}

View file

@ -2,9 +2,9 @@ return {
"Bekaboo/dropbar.nvim",
config = function()
local api = require("dropbar.api")
vim.keymap.set('n', '<Leader>;', api.pick)
vim.keymap.set('n', '[c', api.goto_context_start)
vim.keymap.set('n', ']c', api.select_next_context)
vim.keymap.set("n", "<Leader>;", api.pick)
vim.keymap.set("n", "[c", api.goto_context_start)
vim.keymap.set("n", "]c", api.select_next_context)
local confirm = function()
local menu = api.get_current_dropbar_menu()
@ -18,12 +18,12 @@ return {
end
end
local quit_curr = function()
local menu = api.get_current_dropbar_menu()
if menu then
menu:close()
end
end
-- local quit_curr = function()
-- local menu = api.get_current_dropbar_menu()
-- if menu then
-- menu:close()
-- end
-- end
require("dropbar").setup({
menu = {
@ -32,7 +32,7 @@ return {
quick_navigation = true,
---@type table<string, string|function|table<string, string|function>>
keymaps = {
['<LeftMouse>'] = function()
["<LeftMouse>"] = function()
local menu = api.get_current_dropbar_menu()
if not menu then
return
@ -48,14 +48,15 @@ return {
end
return
end
menu:click_at({ mouse.line, mouse.column }, nil, 1, 'l')
menu:click_at({ mouse.line, mouse.column }, nil, 1, "l")
end,
['<CR>'] = confirm,
['i'] = confirm,
['<esc>'] = quit_curr,
['q'] = quit_curr,
['n'] = quit_curr,
['<MouseMove>'] = function()
["<CR>"] = confirm,
["i"] = confirm,
["<esc>"] = "<C-w>q",
-- ['q'] = quit_curr,
["q"] = "<C-w>q",
["n"] = "<C-w>q",
["<MouseMove>"] = function()
local menu = api.get_current_dropbar_menu()
if not menu then
return
@ -69,5 +70,5 @@ return {
},
},
})
end
end,
}