Skip to content

Instantly share code, notes, and snippets.

@mmisono
Created July 14, 2010 11:04
Show Gist options
  • Save mmisono/475293 to your computer and use it in GitHub Desktop.
Save mmisono/475293 to your computer and use it in GitHub Desktop.
command! -nargs=* -complete=help MyHelp call s:MyHelp("help",<f-args>)
command! -nargs=* -complete=help MyvHelp call s:MyHelp("vertical belowright help",<f-args>)
command! -nargs=1 -complete=help MyHelpW call s:MyHelpW(<f-args>)
autocmd MyAutoCmd BufEnter * if &ft == 'help' | setl bt=help | endif
nnoremap <C-h> :<C-u>MyHelp<Space>
nnoremap <C-h>v :<C-u>MyvHelp<Space>
nnoremap <C-h>w :<C-u>MyHelpW<Space>
function! s:MyHelp(cmd,...) "{{{
if a:0
for i in a:000
call s:helpBufReset()
exe a:cmd . " " . i
endfor
exe "wincmd ="
else
call s:helpBufReset()
exe a:cmd
endif
endfunction "}}}
function! s:MyHelpW(arg) "{{{
exe "MyHelp " . a:arg . "@ja"
exe "MyvHelp " . a:arg . "@en"
endfunction "}}}
function! s:helpBufReset() "{{{
let wincount = winnr('$')
let i = 1
while i <= wincount
if getwinvar(i,'&ft') == 'help'
call setwinvar(i,'&bt','')
endif
let i += 1
endwhile
endfunction "}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment