You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
518 B
14 lines
518 B
return function()
|
|
local s_start = vim.fn.getpos("'<")
|
|
local s_end = vim.fn.getpos("'>")
|
|
local n_lines = math.abs(s_end[2] - s_start[2]) + 1
|
|
local lines = vim.api.nvim_buf_get_lines(0, s_start[2] - 1, s_end[2], false)
|
|
if (lines[1] == nil) then return nil end
|
|
lines[1] = string.sub(lines[1], s_start[3], -1)
|
|
if n_lines == 1 then
|
|
lines[n_lines] = string.sub(lines[n_lines], 1, s_end[3] - s_start[3] + 1)
|
|
else
|
|
lines[n_lines] = string.sub(lines[n_lines], 1, s_end[3])
|
|
end
|
|
return table.concat(lines, '\n')
|
|
end
|
|
|