Pasting code into terminal window into vim on Mac OS X
macos, terminal, text, vim
Solution
Within vim:
:set paste
Put Vim in Paste mode. This is useful if you want to cut or copy some text from one window and paste it in Vim. This will avoid unexpected effects.
Problem
When I paste code into my Mac OS X terminal window into vim it indents each line. For each line it adds an indent so the text looks like this... ``` "ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." ``` My current workaround is I paste the text first into textmate text editor which keeps the correct formatting. Then I save that file and open it up in vim. Then I use vim yank to paste it. Is there a setting in my .vimrc that could change this behavior? Or is this a terminal issue?