1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-15 08:09:11 +08:00

Add config for windows leader

This commit is contained in:
wsdjeg 2017-01-11 23:00:28 +08:00
parent 8462ff1f08
commit caf108e3c1
4 changed files with 43 additions and 15 deletions

View File

@ -36,6 +36,17 @@ let g:spacevim_enable_guicolors = 1
" let g:spacevim_enable_googlesuggest = 1
" <
let g:spacevim_enable_googlesuggest = 0
""
" Windows function leader of SpaceVim, default is `s`, set to empty to disable
" this feature, or you can set to other char.
" >
" let g:spacevim_windows_leader = ''
" <
let g:spacevim_windows_leader = 's'
""
" Unite work flow leader of SpaceVim, default is `f`, set to empty to disable
" this feature, or you can set to other char.
let g:spacevim_unite_leader = 'f'
let g:spacevim_neobundle_installed = 0
let g:spacevim_dein_installed = 0
let g:spacevim_vim_plug_installed = 0
@ -121,7 +132,7 @@ let g:spacevim_plugin_groups_exclude = []
""
" groups of plugins should be loaded.
" groups of plugins should be loaded.
"
" example: >
" let g:spacevim_plugin_groups = ['core', 'lang']
@ -230,6 +241,9 @@ function! SpaceVim#Layer(layer) abort
endfunction
function! SpaceVim#end() abort
if !empty(g:spacevim_windows_leader)
call SpaceVim#mapping#leader#defindWindowsLeader(g:spacevim_windows_leader)
endif
if g:spacevim_simple_mode
let g:spacevim_plugin_groups = ['core']
else

View File

@ -347,22 +347,8 @@ function! SpaceVim#default#SetMappings() abort
\ ':<c-u>call zvim#util#CopyToClipboard(3)<cr>',
\ 'Yank the github link of current selection to X11 clipboard',
\ 'call zvim#util#CopyToClipboard(3)')
" Window prefix
call zvim#util#defineMap('nnoremap', '[Window]', '<Nop>' , 'Defind window prefix' ,'normal [Window]')
call zvim#util#defineMap('nmap' , 's' , '[Window]', 'Use s as window prefix' ,'normal s')
call zvim#util#defineMap('nnoremap <silent>', '<Tab>', ':wincmd w<CR>', 'Switch to next window or tab','wincmd w')
call zvim#util#defineMap('nnoremap <silent>', '<S-Tab>', ':wincmd p<CR>', 'Switch to previous window or tab','wincmd p')
call zvim#util#defineMap('nnoremap <silent>', '[Window]p', ':<C-u>vsplit<CR>:wincmd w<CR>',
\'vsplit vertically,switch to next window','vsplit | wincmd w')
call zvim#util#defineMap('nnoremap <silent>', '[Window]v', ':<C-u>split<CR>', 'split window','split')
call zvim#util#defineMap('nnoremap <silent>', '[Window]g', ':<C-u>vsplit<CR>', 'vsplit window','vsplit')
call zvim#util#defineMap('nnoremap <silent>', '[Window]t', ':<C-u>tabnew<CR>', 'Create new tab','tabnew')
call zvim#util#defineMap('nnoremap <silent>', '[Window]o', ':<C-u>only<CR>', 'Close other windows','only')
call zvim#util#defineMap('nnoremap <silent>', '[Window]x', ':<C-u>call zvim#util#BufferEmpty()<CR>',
\'Empty current buffer','call zvim#util#BufferEmpty()')
call zvim#util#defineMap('nnoremap <silent>', '[Window]\', ':<C-u>b#<CR>', 'Switch to the last buffer','b#')
call zvim#util#defineMap('nnoremap <silent>', '[Window]q', ':<C-u>close<CR>', 'Close current windows','close')
call zvim#util#defineMap('nnoremap <silent>', 'q', ':<C-u>call zvim#util#SmartClose()<cr>',
\ 'Smart close windows',
\ 'call zvim#util#SmartClose()')

View File

@ -0,0 +1,17 @@
function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort
if !empty(a:key)
call zvim#util#defineMap('nnoremap', '[Window]', '<Nop>' , 'Defind window prefix' ,'normal [Window]')
call zvim#util#defineMap('nmap' , a:key, '[Window]', 'Use ' . a:key . ' as window prefix' ,'normal ' . a:key)
call zvim#util#defineMap('nnoremap <silent>', '[Window]p', ':<C-u>vsplit<CR>:wincmd w<CR>',
\'vsplit vertically,switch to next window','vsplit | wincmd w')
call zvim#util#defineMap('nnoremap <silent>', '[Window]v', ':<C-u>split<CR>', 'split window','split')
call zvim#util#defineMap('nnoremap <silent>', '[Window]g', ':<C-u>vsplit<CR>', 'vsplit window','vsplit')
call zvim#util#defineMap('nnoremap <silent>', '[Window]t', ':<C-u>tabnew<CR>', 'Create new tab','tabnew')
call zvim#util#defineMap('nnoremap <silent>', '[Window]o', ':<C-u>only<CR>', 'Close other windows','only')
call zvim#util#defineMap('nnoremap <silent>', '[Window]x', ':<C-u>call zvim#util#BufferEmpty()<CR>',
\'Empty current buffer','call zvim#util#BufferEmpty()')
call zvim#util#defineMap('nnoremap <silent>', '[Window]\', ':<C-u>b#<CR>', 'Switch to the last buffer','b#')
call zvim#util#defineMap('nnoremap <silent>', '[Window]q', ':<C-u>close<CR>', 'Close current windows','close')
endif
endfunction

View File

@ -42,6 +42,17 @@ you can enable it by:
let g:spacevim_enable_googlesuggest = 1
<
*g:spacevim_windows_leader*
Windows function leader of SpaceVim, default is `s`, set to empty to disable
this feature, or you can set to other char.
>
let g:spacevim_windows_leader = ''
<
*g:spacevim_unite_leader*
Unite work flow leader of SpaceVim, default is `f`, set to empty to disable
this feature, or you can set to other char.
*g:spacevim_plugin_bundle_dir*
Set the cache dir of plugins, by default, it is `~/.cache/vimfiles`. you can
set it by: