gpt4 book ai didi

vim - 如何在vim中像:! echo命令一样将寄存器值输出到stdout?

转载 作者:行者123 更新时间:2023-12-03 19:53:13 26 4
gpt4 key购买 nike

我已经这样做了:

:reg 一个

"a   iabc

我想输出寄存器 a 中的值,例如 :w !xargs -n1 echo命令,但并非所有缓冲区内容只是寄存器值。

Thx 先进!

最佳答案

:echo getreg('a')

getreg([{regname} [, 1 [, {list}]]])

The result is a String, which is the contents of register {regname}. Example:

:let cliptext = getreg('*') 

When {regname} was not set the result is an empty string.

getreg('=') returns the last evaluated value of the expression register. (For use in maps.) getreg('=', 1) returns the expression itself, so that it can be restored with setreg(). For other registers the extra argument is ignored, thus you can always give it. If {list} is present and TRUE, the result type is changed to List. Each list item is one text line. Use it if you care about zero bytes possibly present inside register: without third argument both NLs and zero bytes are represented as NLs (see NL-used-for-Nul). When the register was not set an empty list is returned. If {regname} is not specified, v:register is used.

关于vim - 如何在vim中像:! echo命令一样将寄存器值输出到stdout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42036991/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com