aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-23 08:12:46 +0800
committerGitHub <noreply@github.com>2024-02-23 08:12:46 +0800
commiteb4783fb6c8c16d3a9a10e5ef36312737fc9bc40 (patch)
tree38385943119647162b361d47aacb6b5b7b0425ac /runtime/lua/vim
parentdf1795cd6bdf7e1db31c87d4a33d89a2c8269560 (diff)
downloadrneovim-eb4783fb6c8c16d3a9a10e5ef36312737fc9bc40.tar.gz
rneovim-eb4783fb6c8c16d3a9a10e5ef36312737fc9bc40.tar.bz2
rneovim-eb4783fb6c8c16d3a9a10e5ef36312737fc9bc40.zip
refactor(defaults): use getregion() for default * and # mappings
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_defaults.lua20
1 files changed, 1 insertions, 19 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 6afb1d6b1c..32534a89b4 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -4,27 +4,9 @@ do
---
--- See |v_star-default| and |v_#-default|
do
- local function region_chunks(region)
- local chunks = {}
- local maxcol = vim.v.maxcol
- for line, cols in vim.spairs(region) do
- local endcol = cols[2] == maxcol and -1 or cols[2]
- local chunk = vim.api.nvim_buf_get_text(0, line, cols[1], line, endcol, {})[1]
- table.insert(chunks, chunk)
- end
- return chunks
- end
-
local function _visual_search(cmd)
assert(cmd == '/' or cmd == '?')
- local region = vim.region(
- 0,
- '.',
- 'v',
- vim.api.nvim_get_mode().mode:sub(1, 1),
- vim.o.selection == 'inclusive'
- )
- local chunks = region_chunks(region)
+ local chunks = vim.fn.getregion('.', 'v', vim.fn.mode())
local esc_chunks = vim
.iter(chunks)
:map(function(v)