从 Vim 中保存选定的文本(部分行) [英] Save selected text (partial line) from Vim
本文介绍了从 Vim 中保存选定的文本(部分行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试从 Vim 中保存一些选定的文本(一行的一部分).这是行:
I try to save some selected text (part of a line) from Vim. Here is the line:
此测试字符串 - SELECTED_TARGET_WORLD
其中粗体表示选择的文本.我这样做:
where the bold represents the select text. I do this:
:'<,'> w! test/selected_text
但在文件 selected_text
中我找到了字符串:
but in the file selected_text
I find the string:
THIS TEST STRING - SELECTED_TARGET_WORLD
如何让它只保存该行的选定部分?
How do I make it save only the selected part of the line?
推荐答案
:[range]w filename
仅适用于行,因此……您必须将所选文本放在自己的行上.
:[range]w filename
only works with lines so… you have to put the selected text on its own line.
另一种使用 :help :redir
:
:'<,'>"ay
:redir filename
:echo @a
:redir END
这篇关于从 Vim 中保存选定的文本(部分行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文