将代码粘贴到Mac OS X上的终端窗口到vim中 [英] Pasting code into terminal window into vim on Mac OS X

查看:186
本文介绍了将代码粘贴到Mac OS X上的终端窗口到vim中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将代码粘贴到Mac OS X终端窗口中的vim中时,它会缩进每一行.每行添加一个缩进,因此文本看起来像这样...

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."

我当前的解决方法是先将文本粘贴到textmate文本编辑器中,以保持正确的格式.然后,我保存该文件并在vim中打开它.然后我用vim yank粘贴它.
我的.vimrc中是否存在可以更改此行为的设置?还是这是一个终端问题?

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?

推荐答案

在vim中:

:set paste

将Vim置于粘贴模式.如果您想剪切或复制,这很有用 从一个窗口中输入一些文本并将其粘贴到Vim中.这样可以避免 意外的效果.

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.

这篇关于将代码粘贴到Mac OS X上的终端窗口到vim中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆