Skip to content

Vim and auto indent unwanted new lines

wordpress meta

title: 'Vim And Auto Indent Unwanted New Lines'
date: '2019-01-02T13:56:36-06:00'
status: publish
permalink: /vim-and-auto-indent-unwanted-new-lines
author: admin
excerpt: ''
type: post
id: 1279
category:
    - Vim
tag: []
post_format: []

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=" 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.