1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 06:20:05 +08:00
SpaceVim/bundle/vim-choosewin/plugin/choosewin.vim
2020-06-13 14:06:35 +08:00

38 lines
832 B
VimL

" GUARD:
if expand("%:p") ==# expand("<sfile>:p")
unlet! g:loaded_choosewin
endif
if exists('g:loaded_choosewin')
finish
endif
let g:loaded_choosewin = 1
let s:old_cpo = &cpo
set cpo&vim
" Main:
augroup plugin-choosewin
autocmd!
autocmd ColorScheme,SessionLoadPost * call choosewin#color#refresh()
augroup END
" KeyMap:
nnoremap <silent> <Plug>(choosewin)
\ :<C-u>call choosewin#start(range(1, winnr('$')))<CR>
" Command:
function! s:win_all()
return range(1, winnr('$'))
endfunction
command! -bar ChooseWin
\ call choosewin#start(s:win_all())
command! -bar ChooseWinSwap
\ call choosewin#start(s:win_all(), {'swap': 1, 'swap_stay': 0 })
command! -bar ChooseWinSwapStay
\ call choosewin#start(s:win_all(), {'swap': 1, 'swap_stay': 1 })
" Finish:
let &cpo = s:old_cpo
" vim: foldmethod=marker