Vi Essentials

Copy/Paste (e.g. Windows Clipboard to a VIM on linux via putty) with correct indentations

Sometimes when pasting formated text (source code) from Windows via Putty into a VIM buffer, Vim indents again, so that lines will be padded with too much space.

Solution:

1. Set paste mode

:set paste

2. Enable insert mode (:i)
3. Paste the code (e.g. shift-insert)
4. Unset paste mode
:set nopaste

Source: http://vim.wikia.com/wiki/VimTip330

vim
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License