English 中文(简体)
粘贴选定文本时如何保留登记内容? [重复]
原标题:How can vim keep the content of register when pasting over selected text? [duplicate]

我有一行我拉动的文本。 现在我要用此文本替换其他几个地方的行。 麻烦在于, 当我选择 < code> V < /code> 替换的行, 并粘贴 < code> p 时, 选中的文本会自动被拉动! 这就是我不想看到的 。

更改登记册不起作用, 因为粘贴和扬克都是用新选中的登记册完成的 。

在粘贴选定文本时保存登记册内容的命令是什么?

最佳回答

每次您对某事物 p 进行 p 访问时,它都会进入默认的登记册。

要围绕此特性工作, 您必须使用 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

vnoremap <leader>p "_dP

它删除选中的内容, 并在黑洞注册簿中将其丢弃( 这意味着选中的文字会永远消失), 并放置默认注册簿的内容以取代先前选中的文本, 同时保留默认注册簿的完整 。

我经常用它来代替在几个地方用另一处的软骨替换大肠杆菌, 设计一个 < code>// 将太麻烦了。

问题回答

您的原始选择应该保留在注册簿 0 。 这样您就可以通过文件移动, 并在其它行上粘贴您的有色线, 使用 : V" 0p





相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签