On 2022-11-15, Melker Österberg wrote:
> Steps to reproduce
>
> 1. > vim -u DEFAULTS -c "set autoindent"
>
> 2. Enter insert mode and paste the following with <C-r>+ (assuming that you
> have copied it to your clipboard register)
>
> foo
> bar
> baz
>
> 3. Pasted text looks like this:
>
> foo
> bar
> baz
>
> If I disable autoindent, i.e. run vim -u DEFAULTS, the text gets pasted with
> the correct indentation.
>
> Expected behaviour
>
> Text gets pasted like this:
>
> foo
> bar
> baz
That is expected behavior. From ":help i_CTRL-R":
The text is inserted as if you typed it, but mappings and
abbreviations are not used. If you have options like
'textwidth', 'formatoptions', or 'autoindent' set, this will
influence what will be inserted. This is different from what
happens with the "p" command and pasting with the mouse.
To get the behavior you want, use <C-r><C-o>+. From ":help
i_CTRL-R_CTRL-O":
Insert the contents of a register literally and don't
auto-indent. Does the same as pasting with the mouse
|<MiddleMouse>|.
Regards,
Gary
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221115172457.GA4274%40phoenix.