mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 23:05:41 +00:00
feat(editor)!: insert-mode ctrl-r should work like paste #35477
Problem: insert-mode ctrl-r input is treated like raw user input, which is almost never useful. This means any newlines in the input are affected by autoindent, etc., which is: - slow - usually breaks the formatting of the input Solution: - ctrl-r should be treated like a paste, not user-input. - does not affect `<c-r>=`, so `<c-r>=@x` can still be used to get the old behavior. Co-authored-by: Justin M. Keyes <justinkz@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
@@ -83,6 +83,36 @@ describe('insert-mode', function()
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('inserts named registers literally', function()
|
||||
local screen = Screen.new(50, 6)
|
||||
-- regular text without special charecter command
|
||||
command('let @a = "test"')
|
||||
feed('i<C-R>a<ESC>')
|
||||
screen:expect([[
|
||||
tes^t |
|
||||
{1:~ }|*4
|
||||
|
|
||||
]])
|
||||
|
||||
-- text with backspace character gets written literally by default
|
||||
command('let @a = "test\\<C-H>"')
|
||||
feed('cc<C-R>a<ESC>')
|
||||
screen:expect([[
|
||||
test{18:^^H} |
|
||||
{1:~ }|*4
|
||||
|
|
||||
]])
|
||||
|
||||
-- =@reg<CR> can be used to get effect of keypress
|
||||
command('let @a = "test\\<C-H>"')
|
||||
feed('cc<C-R>=@a<CR><ESC>')
|
||||
screen:expect([[
|
||||
te^s |
|
||||
{1:~ }|*4
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('Ctrl-O', function()
|
||||
|
||||
Reference in New Issue
Block a user