diff options
author | Eden Zhang <53964412+VelocityDv@users.noreply.github.com> | 2022-04-17 12:11:53 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-17 08:11:53 +0800 |
commit | 813ecdac795405565aab5cb61cb83b9ca1581b60 (patch) | |
tree | 0cd01c6763eab932a04a5f89c0a6cecbdffb9147 /runtime/lua/vim/_editor.lua | |
parent | dcf7bc414037c888dbc4003caf9e28ffb0f7d4e2 (diff) | |
download | rneovim-813ecdac795405565aab5cb61cb83b9ca1581b60.tar.gz rneovim-813ecdac795405565aab5cb61cb83b9ca1581b60.tar.bz2 rneovim-813ecdac795405565aab5cb61cb83b9ca1581b60.zip |
fix(paste): ignore mappings in Cmdline mode (#18114)
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index d4db4850bd..8e372b806c 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -174,11 +174,11 @@ do if vim.fn.getcmdtype() ~= '' then -- cmdline-mode: paste only 1 line. if not got_line1 then got_line1 = (#lines > 1) - vim.api.nvim_set_option('paste', true) -- For nvim_input(). - -- Escape "<" and control characters - local line1 = lines[1]:gsub('<', '<lt>'):gsub('(%c)', '\022%1') - vim.api.nvim_input(line1) - vim.api.nvim_set_option('paste', false) + -- Escape control characters + local line1 = lines[1]:gsub('(%c)', '\022%1') + -- nvim_input() is affected by mappings, + -- so use nvim_feedkeys() with "n" flag to ignore mappings. + vim.api.nvim_feedkeys(line1, 'n', true) end return true end |