I'm trying to copy-paste by hand this file, but whenever I paste the contents in vim the last line shows this weird character at the end of the line ^[[201~.
My guess is that it's one of those wrong conversion types between dos and unix, but this character is causing some strange behavior in vim.
As soon as I paste it and this character shows at the end of the file, vim goes to "INSERT COMPL" mode, and somehow I lose control over vim and I'm obligated to close the window, otherwise there's nothing I can do.

  • 1
    Welcome to Vi and Vim! Does it work if you use :set paste before you go into insert mode to paste the file? Enabling 'paste' mode should disable most of the special behavior Vim implements in insert mode and is meant to take all keystrokes verbatim, exactly how you'd want it if you're pasting large blocks of text possibly containing characters that Vim might try to have a special interpretation for...
    – filbranden
    Aug 12, 2020 at 16:28
  • 1
    Fill is most probably right and I believe we a duplicate about this issue on this website even though I can't find it right now.
    – statox
    Aug 12, 2020 at 16:49
  • 1
    @filbranden it still happens.. I paste it after entering paste mode and at the end this character is printed and I loose control over vim. Esc doesn't work, Ctrl+<anything> doesn't work, and the only solution is to close the terminal.
    – Teodoro
    Aug 12, 2020 at 16:52
  • 2
    Actually, ^[[201~ is what a terminal usually sends for bracketed paste mode, so maybe try to mess with some of those settings there... Perhaps :set t_BE= to disable bracketed paste mode will fix the issue for you?
    – filbranden
    Aug 12, 2020 at 17:35
  • 2
    Please also post the output of :set t_BE? t_BD? t_PS? t_PE? which should tell us what those values are set to and whether they're set to something odd... Please also describe more about your environment, such as the operating system and which terminal emulator you're using, since that's potentially relevant with bracketed paste mode... Thanks!
    – filbranden
    Aug 12, 2020 at 18:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.