Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

Vim

Vim And Auto Indent Unwanted New Lines

Recently I experienced a very annoying issue with copy/paste. Pasting a line using the Gnome terminal Control-V or Right Mouse Button caused the line to insert with an unwanted new line. I am not sure when or why this started but it could have to do with the file being called "changelog" and/or vim identifying the file as type "changelog". Using ":set" while editing the file does list autoindent.

Note that this issue does not appear with yank and put (Shift-Y and Shift-P) commands. For the moment I am getting around this by adding ":set pastetoggle=<F5>" to my .vimrc. Then before pasting press F5. You could also just do ":set paste" while editing and the paste would work normal for that paste.

admin

Bio Info for Riaan