我希望能够搜索带有@符号和gf
的单词具有相同模式的文件,例如 foo@bar。
set iskeyword-=@
(或更改设置 iskeyword=@,48-57,_,192-255,.
至iskeyword=48-57,_,192-255,.
允许我使用*
搜索 foo@bar 实例,但如果我这样做 set isfname-=@
,我还是不行gf
到它(假设 foo@bar 是路径中的一个文件)。
如何制作foo@bar
可以GF吗?
最佳答案
如果您有一个名为 foo@bar
的文件,并且想要编辑它,请在其路径上点击 gf
,您可以添加 @
字符到 'isfname'
选项,如下所示:
set isf+=@-@
请注意,对于 'isfname'
和 'iskeyword'
选项,@
并不代表 @
字符,代表 isalpha()
返回 true 的所有字符。
来自 :h 'isf
的相关部分:
If the character is '@', all characters where isalpha() returns TRUE
are included. Normally these are the characters a to z and A to Z,
plus accented characters. To include '@' itself use "@-@".
关于vim - 带@符号的文件名和标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44868898/