Vi/Vim - avoid tabs when you copy/paste

January 2017

The Linux operating system has ample text duplication ability within a text editor. Vi and Vim include some of the useful Linux commands, including copy and paste. Using the Y or YY copy command one or multiple lines can be copied. The operating system lets you copy as many lines as you need. To paste you can use "p". If you want it pasted above the cursor buffer use a capital "P". In case you want it to be pasted below the cursor buffer, use small case "p" respectively.
You can tug or yank text into a line, by using the yank text commands of Linux from the location of the current cursor up to the word or till the end of the line, respectively. To paste text in a line use the same commands. However when you copy and paste in Vi or Vim (through a remote SSH session), it adds incremented tabs on each line, to solve the issue set paste in the window or add the set paste in /etc/vim/vimrc or in the~/.vimrc file.


Issue


By default, when you copy and paste in Vi or Vim (through a remote SSH session), it adds incremented tabs on each line.

Solution


To solve this problem, simply type: set paste in the window or add the set paste in /etc/vim/vimrc or in the ~/.vimrc file

Related


Published by aakai1056. Latest update on March 9, 2012 at 04:19 PM by Virginia Parsons.
This document, titled "Vi/Vim - avoid tabs when you copy/paste," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).