复制时如何清除Vim中的行号? [英] How to clear the line number in Vim when copying?

查看:74
本文介绍了复制时如何清除Vim中的行号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vim中将一些代码从一个文件的一部分复制到另一部分,发现每行都有行号,格式不见了,如何将正确的格式设置为原点?

I copy some code from one part of one file to another part in vim, I find that, there are line numbers in each line and the format is gone, how to set correct format as origin ?

像这样:

            40         root /opt/release/current/public;
 67             41         passenger_enabled on;
 68              42 

推荐答案

如果您有行号,我很确定您没有使用Vim的yank/put操作(这些操作从不复制行号,折叠栏,图标等),因为就编辑缓冲区而言,它们不存在.

If you have line numbers, I'm quite sure you are not using Vim's yank/put operations (these will never copy the linenumbers, foldcolumn, icons etc) because in terms of the edit buffer, they don't exist.

我的猜测是您正在终端仿真器中工作,并使用鼠标将内容复制到剪贴板,剪贴板可能会选择屏幕的外部"空间(包括末尾的虚拟空间,行号,折叠标记等)

My guess is you are working in a terminal emulator and using the mouse to copy stuff to the clipboard, which possibly selects the 'extraneous' room of the screen (including virtual spaces at the end, line numbers, fold markers etc)

您可能有运气设置

:se mouse+=a

以便获得您期望的鼠标行为.否则,请使用 V <movement>... y (yanky,对应于"copy")进行选择

in order to get the behaviour of the mouse like you expect it. Otherwise, do the selection with V<movement>...y (y for yank, which corresponds to 'copy')

然后在目标位置使用 p (在光标处放置)或 P (在光标前放置)

Then on the destination use p (put at cursor), or P (put before cursor)

让我知道这对您有帮助还是您需要更多信息

Let me know if that helped or you need more info

这篇关于复制时如何清除Vim中的行号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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