mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 19:28:24 +00:00
feat(statuscolumn): added mouse click handler to open/close folds. Closes #968
This commit is contained in:
parent
9e7e4b73ce
commit
98a7b647c9
1 changed files with 10 additions and 1 deletions
|
@ -231,7 +231,8 @@ function M._get()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return table.concat(components, "")
|
local ret = table.concat(components, "")
|
||||||
|
return "%@v:lua.require'snacks.statuscolumn'.click_fold@" .. ret .. "%T"
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get()
|
function M.get()
|
||||||
|
@ -259,4 +260,12 @@ function M.health()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.click_fold()
|
||||||
|
local pos = vim.fn.getmousepos()
|
||||||
|
vim.api.nvim_win_set_cursor(pos.winid, { pos.line, 1 })
|
||||||
|
vim.api.nvim_win_call(pos.winid, function()
|
||||||
|
vim.cmd("normal! za")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue