windows環境でdicwin-vimのウィンドウが広い問題

香り屋版vimdicwinなる英和辞書が標準で使えるということを最近知ったので使ってみました。
dicwinの詳しい説明は以下を参考にしてください。

名無しのvim使い - dicwin.vimでvimエディタに英和辞書を組み込む。

我が家のmacにて動かしてみたところ結構良い感じに動いてくれました。

f:id:saihoooooooo:20120726214102j:image:w640

ふんふん、なるほどなるほど、ほへー、って感じ。
ところが別のwindowsマシンで見てみると。

f:id:saihoooooooo:20120726122006j:image:w640

ウィンドウでか!
大体翻訳結果がどこにあるのかわからん。
憤りを感じながら解決策は無いものかとソースを眺めていると以下の記述を発見。

function! s:DetermineDictpath()
  " Search default dictionary
  if !exists('g:dicwin_dictpath')
    let s:dict = 'gene.txt'
    let g:dicwin_dictpath = s:GlobPath(&rtp, 'dict/'.s:dict)
    if g:dicwin_dictpath == ''
      let g:dicwin_dictpath = s:GlobPath(&rtp, s:dict)
    endif
    unlet s:dict
  endif
  " Windows return '\\' as directory separator in globpath(), replace it.
  "let g:dicwin_dictpath = substitute(g:dicwin_dictpath, '\\', '/', 'g')
endfunction

きっちりコメントに書いてあった。
windowsの場合はディレクトリセパレータを\から/にしろと。
他の箇所も見ると、ウィンドウサイズの変更は辞書ファイルのパス名を指定したautocmdにて実行されていました。
その為、パスに\が入っていると正しく動作しないようです。
コメントアウトを外せばいいだけのようですが、.vimrcに書いちゃった方が管理が楽そうなので以下を追記。

" 香り屋版vimの場合はhas('kaoriya')が1
if has('kaoriya') && (has('win32') || has('win64'))
    let g:dicwin_dictpath = substitute($HOME, '\', '/', 'g') . '/vimfiles/dict/gene.txt'
endif

という訳で無事翻訳結果ウィンドウが見やすくなりました。
めでたしめでたし。

補足

使ってて他にもつまずいた部分があったので追記。

<C-k><C-k>

で動くと書いてるのに何も動作しなかった。
原因はg:mapleaderを設定していたため。
以下、キーマップ設定部分のソース。

" Kemaps
function! s:SetupKeymap()
  let s:use_mapleader = 0
  if !exists('g:mapleader')
    let g:mapleader = "\<C-k>"
    let s:use_mapleader = 1
  endif
  nnoremap <silent> <Leader>k :call <SID>OpenDictionary(g:dicwin_dictpath, expand('<cword>'))<CR>
  nnoremap <silent> <Leader>n :call <SID>Search(g:dicwin_dictpath, 0)<CR>
  nnoremap <silent> <Leader>p :call <SID>Search(g:dicwin_dictpath, 1)<CR>
  nnoremap <silent> <Leader>w :call <SID>GoDictWindow()<CR>
  nnoremap <silent> <Leader>c :call <SID>Close()<CR>
  nnoremap <silent> <Leader>/ :call <SID>Query()<CR>
  nnoremap <silent> <Leader><C-k> :call <SID>OpenDictionary(g:dicwin_dictpath, expand('<cword>'))<CR>
  nnoremap <silent> <Leader><C-n> :call <SID>Search(g:dicwin_dictpath, 0)<CR>
  nnoremap <silent> <Leader><C-p> :call <SID>Search(g:dicwin_dictpath, 1)<CR>
  nnoremap <silent> <Leader><C-w> :call <SID>GoDictWindow()<CR>
  if s:use_mapleader > 0
    unlet s:use_mapleader
    unlet g:mapleader
  endif
endfunction

.vimrcでg:mapleaderを設定している場合はそのキーを基にキーマップが設定される模様。
例えば

let g:mapleader = ','

とした場合は

,<C-k>

で動く。

以上。