Vim Tips Wiki
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
βˆ’
Pasting text into a terminal running Vim with automatic indentation enabled can destroy the indentation of the pasted text. This tip shows how to avoid the problem.
+
Pasting text into a terminal running Vim with 'autoindent' or 'smartindent' set can destroy the indenting of the pasted text. This tip shows how to avoid the problem.
   
 
See [[VimTip330|how to stop auto indenting]] for automatic indentation issues while you are typing.
 
See [[VimTip330|how to stop auto indenting]] for automatic indentation issues while you are typing.
Line 18: Line 18:
 
If you use Vim commands to paste text, nothing unexpected occurs. The problem only arises when pasting from another application, and only when you are not using a GUI version of Vim.
 
If you use Vim commands to paste text, nothing unexpected occurs. The problem only arises when pasting from another application, and only when you are not using a GUI version of Vim.
   
βˆ’
In a console or terminal version of Vim, there is no standard procedure to paste text from another application. Instead, the terminal may emulate pasting by inserting text into the keyboard buffer, so Vim thinks the text has been typed by the user. After each line ending, Vim may move the cursor so the next line starts with the same indent as the last. However, that will change the indentation already in the pasted text.
+
In a console or terminal version of Vim (not gvim), there is no standard procedure to paste text from another application. Instead, the shell may emulate pasting by inserting text into the keyboard buffer, so Vim thinks the text has been typed by the user. After each line ending, Vim may move the cursor so the next line starts with the same indent as the last. However, that will change the indents already in the pasted text.
   
 
==Paste toggle==
 
==Paste toggle==
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)