vim 粘贴文本
Pasting code from another application to Vim is a nightmare. The autoindent features of Vim drive you crazy. How to make it easier to use?
将代码从另一个应用程序粘贴到Vim是一场噩梦。 Vim的自动缩进功能使您发疯。 如何使其更易于使用?
Pasting code from another application to Vim is a nightmare. The autoindent features of Vim will drive you crazy. What help you out is the “paste mode”.
将代码从另一个应用程序粘贴到Vim是一场噩梦。 Vim的自动缩进功能会使您发疯。 帮助您解决问题的是“粘贴模式”。
To paste code as is:
按原样粘贴代码:
:set paste
Past code to vim
过去的代码到vim
:set nopaste
But typing so many characters is not convenient enough. We can turn auto indenting for pastes on and off with pastetoggle:
但是,键入这么多字符还不够方便。 我们可以使用pastetoggle打开和关闭粘贴的自动缩进:
Add to ~/.vimrc
:
添加到~/.vimrc
:
set pastetoggle=<F2>
The to paste code (in insert mode, of course):
粘贴代码( 当然是在插入模式下):
Press F2 (toggles the ‘paste’ option on).
Paste code.
Press F2 (toggles the ‘paste’ option off).
按F2(启用“粘贴”选项)。
粘贴代码。
按F2(将“粘贴”选项关闭)。
翻译自: https://www.systutorials.com/vim-pasting-text-as-is-in-vim-in-paste-mode/
vim 粘贴文本