English 中文(简体)
Vim: 管道注册到外部命令
原标题:Vim: pipe register to external command
  • 时间:2012-05-28 06:49:17
  •  标签:
  • vim

我怎样才能将注册簿的内容与外部指令的标准输入连接起来? 我直觉地尝试了以下内容,但是它行不通(也许可以说明我的需要 ) :

:"0w !some_command
最佳回答

如果登记簿的内容没有附带含有NULL的登记内容,那么它就简单到

call system( some_command , @r)

。一旦您承认注册内容可能包含 NUL 字节, 问题就不那么简单: 在此情况下, 您需要使用 < code> getreg () 并强制它生成注册列表形式( 这是第二个 < code> 1 到 < code> gettreg () ) 。

call system( some_command , getreg( r , 0, 1) + (getregtype( r ) isnot#  v  ? [  ] : []))

。此窗体将保存可能碰巧在登记册中的 NUL 。 注意, 尽管 gettreg( r, 0, 1) 将不会有尾行新行, 即使您复制文本的方式是线性模式, 这就是为什么我写了 < code\\\ (getregty( r) isnot# v? [ ]: [ ] < ) 来添加它( form < code\\\\\\r 没有这个问题 ) 。

列表窗体是代表预示引入 blobs 时间的二进制数据的一种方式。 要将随机的二进制数据转换成此形式, 您可以在 NL 字节上分割它( 保存由此产生的空字符串), 然后将全部 NUL 字节替换为 NL 。

问题回答

暂无回答




相关问题
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 ...

热门标签