vim 粘贴文本_Vim:在粘贴模式下按Vim粘贴文本

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(将“粘贴”选项关闭)。

Answered by anonymous.
匿名回答。

翻译自: https://www.systutorials.com/vim-pasting-text-as-is-in-vim-in-paste-mode/

vim 粘贴文本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值