Vim Part20 ..
[2ch|▼Menu]
49:名無しさん@お腹いっぱい。
11/12/16 23:26:26.60
gfを拡張して、環境変数(${ENV}など)を含んだパスに対しても、gfでジャンプできるように
したいですが、下記だとうまく行きません。
どうすればいいか教えてください。
ちなみに、mapを未定義のものにすればうまく行きます。。。。

function! GoFileWithEnv()
try
normal gf
" catch /^Vim:Interrupt$/
catch
let orgfilepath = expand("<cWORD>")
while (orgfilepath =~ "\\${.*}")
let env = matchstr(orgfilepath,"${.\\{-\\}}")
let expandedenv = expand(expand(env))
let orgfilepath = substitute(orgfilepath,env,expandedenv,"")
endwhile
exe "edit ".orgfilepath
endtry
endfunc

nnoremap gf :call GoFileWithEnv()<CR>



次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4978日前に更新/132 KB
担当:undef