vim运行perl脚本,光标下的单词作为参数

Her*_*son 1 vim arguments function shortcut cursor

是否可以通过键入快捷方式将光标下的单词发送到perl脚本?

我怎么做?

ZyX*_*ZyX 5

如果光标下的单词包含特殊字符,则上述解决方案不安全.你应该用

nnoremap <F2> :execute "!/path/to/script.pl ".shellescape(expand("<cword>"), 1)<CR>
Run Code Online (Sandbox Code Playgroud)

代替.

整条生产线,更换expand("<cword>")getline('.').对于光标使用下的文件名expand("<cfile>").