I'm working on some Firefox extensions and I'm trying to set up my vim to open modules using the gf keys.
An inclusion looks like this: Components.utils.import("resource://grwmodules/EventProvider.jsm", scope);
which should be modules/EventProvider.jsm
I created a file to set up the environment. Here is what I have so far:
function! s:GetModuleName(name)
let l:output = a:name
if(a:name =~ "^resource://grwmodules")
let output = substitute(a:name, "resource://grwmodules", "modules", "")
endif
return l:output
endfunction
function! GetGrwFNName(name)
let l:output = s:GetModuleName(a:name)
return l:output
endfunction
set includeexpr=GetGrwFNName(v:fname)
set isf+=:
set inclu开发者_运维问答de=Components.utils.import("resource[:/]\+.\+")
After added the isf+=: line, the :checkpath command works. But when I press gf on the file, the vim opens a new file which name would be resource://grwmodules/EventProvider.jsm. So it looks like when I press the gf it doesn't convert the name using GetGrwFNName.
Any ideas?
You'd have to create an autocommand FileReadCmd
, e.g. what netrw has for http:// urls:
:verbose au FileReadCmd
HTH
精彩评论