vimscript 复制粘贴变量

发布于 2024-10-10 06:43:19 字数 174 浏览 0 评论 0原文

我的 .vimrc 中有以下命令:

nmap gtb texecute "!perl /home/hermann/hi.pl ".shellescape(getline('.'), 1)

它执行一个 perl 脚本并发送光标所在的行,到它。
我如何将复制粘贴缓冲区中的内容发送到脚本?

i have the following command in my .vimrc:

nmap gtb texecute "!perl /home/hermann/hi.pl ".shellescape(getline('.'), 1)

it executes a perl script and sends whichever line the cursor is over, to it.
how do i send to the script whatever is in the copy-paste buffer instead?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘿嘿嘿 2024-10-17 06:43:19

Vim 中没有单个“复制粘贴”缓冲区,而是有一组命名寄存器。您可以使用 getreg 函数获取寄存器的内容 - 它有一个参数,即寄存器名称。例如,使用它来获取默认的复制/粘贴缓冲区的内容:

getreg('0')

There is no single 'copy-paste' buffer in Vim, there is a set of named registers instead. You can get the contents of a register using getreg function - it has a single argument, register name. For example, use this to get the contents of a default yank/paste buffer:

getreg('0')
爱你不解释 2024-10-17 06:43:19

您可以使用“正常”功能粘贴剪贴板内容。

   function MyPastingFunc()
     "paste from clipboard
     normal! "+p
     "do more stuff 
   endfunction

you can use the 'normal' function to paste the clipboard contents.

   function MyPastingFunc()
     "paste from clipboard
     normal! "+p
     "do more stuff 
   endfunction
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文