我想打开一个 URL,xdg-open当光标停留在指向有效字符串的某个字符串上时,例如folder
通过按某个键,它将启动xdg-open the_valid_url。
那可能吗 ?
我希望它甚至可以space在本地 url 中工作。
谢谢 !
尝试下一个映射:
:noremap ,o :!xdg-open <cfile><CR>
Run Code Online (Sandbox Code Playgroud)
现在,在里面vim把光标放在你的字符串上,然后按,o正常模式。在我的电脑 (linux) 中用于dolphin打开本地文件夹和konqueror打开 url。
编辑:
要打开带空格的文件,请在选项中添加空格字符isfname(32 是空格字符的十进制数):
:set isfname+=32
Run Code Online (Sandbox Code Playgroud)
并使用这个不同的地图:
:noremap ,o :execute ":!xdg-open " . shellescape( '<cfile>' )<CR>
Run Code Online (Sandbox Code Playgroud)