mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 02:38:46 +00:00
fix(debug): better way of getting visual selection. See #190
This commit is contained in:
parent
e26ab0ef2c
commit
af41cb088d
1 changed files with 7 additions and 2 deletions
|
@ -49,8 +49,13 @@ function M.run(opts)
|
|||
|
||||
-- Get the lines to run
|
||||
local lines ---@type string[]
|
||||
if vim.fn.mode():find("[vV]") then
|
||||
vim.fn.feedkeys(":", "nx")
|
||||
local mode = vim.fn.mode()
|
||||
if mode:find("[vV]") then
|
||||
if mode == "v" then
|
||||
vim.cmd("normal! v")
|
||||
elseif mode == "V" then
|
||||
vim.cmd("normal! V")
|
||||
end
|
||||
local from = vim.api.nvim_buf_get_mark(buf, "<")
|
||||
local to = vim.api.nvim_buf_get_mark(buf, ">")
|
||||
lines = vim.api.nvim_buf_get_text(buf, from[1] - 1, from[2], to[1] - 1, to[2] + 1, {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue