1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Merge branch 'leader' into dev

This commit is contained in:
wsdjeg 2017-01-12 14:09:47 +08:00
commit 22470d807c
6 changed files with 95 additions and 43 deletions

View File

@ -59,6 +59,7 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h
- Neovim-centric
- [Modular configuration](#modular-configuration)
- [multiple leader mode](#multiple-leader-mode)
- Lazy-load 90% of plugins with [dein.vim]
- Robust, yet light weight
- [Unite centric work-flow](#unite-centric-work-flow)
@ -96,16 +97,19 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h
here is an example:
```viml
" here are some basic customizations, please refer to the top of the vimrc file for all possible options
" here are some basic customizations, please refer to the top of the vimrc
" file for all possible options
let g:spacevim_default_indent = 3
let g:spacevim_max_column = 80
let g:spacevim_colorscheme = 'my_awesome_colorscheme'
let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug
" change the default directory where all miscellaneous persistent files go
let g:spacevim_cache_dir = "/some/place/else"
" by default it is ~/.cache/vimfiles
let g:spacevim_plugin_bundle_dir = "/some/place/else"
" by default, language specific plugins are not loaded. this can be changed with the following:
" by default, language specific plugins are not loaded. this can be changed
" with the following:
let g:spacevim_plugin_groups_exclude = ['ruby', 'python']
" if there are groups you want always loaded, you can use this:
@ -114,7 +118,8 @@ let g:spacevim_plugin_groups_include = ['go']
" alternatively, you can set this variable to load exactly what you want
let g:spacevim_plugin_groups = ['core', 'web']
" if there is a particular plugin you don't like, you can define this variable to disable them entirely
" if there is a particular plugin you don't like, you can define this
" variable to disable them entirely
let g:spacevim_disabled_plugins=['vim-foo', 'vim-bar']
" if you want to add some custom plugins, use this options.
let g:spacevim_custom_plugins = [
@ -127,6 +132,17 @@ set wildignore+=\*/node_modules/\*
set guifont=Wingdings:h10
```
#### multiple leader mode
##### global origin vim leader, default : `\`
vim's origin global leader can be used in all the mode.
##### local origin vim leader, default : `,`
vim's origin local leader can be used in all the mode.
##### windows function leader, default : `s`
windows function leader can only be used in normal mode.
for the list of mappings see the [link](#window-management)
##### unite work flow leader, default : `f`
unite work flow leader can only be used in normal mode. unite leader need unite groups.
#### Unite centric work-flow
- List all the plugins has been installed, fuzzy find what you want,
default action is open the github website of current plugin. default key is `<leader>lp`

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,12 @@ 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 !empty(g:spacevim_unite_leader)
call SpaceVim#mapping#leader#defindUniteLeader(g:spacevim_unite_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,46 @@
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
function! SpaceVim#mapping#leader#defindUniteLeader(key) abort
if !empty(a:key)
" The prefix key.
nnoremap [unite] <Nop>
exe 'nmap ' .a:key . ' [unite]'
nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir
\ -buffer-name=files buffer bookmark file<CR>
nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir
\ -buffer-name=files -prompt=%\ buffer bookmark file<CR>
nnoremap <silent> [unite]r :<C-u>Unite
\ -buffer-name=register register<CR>
nnoremap <silent> [unite]o :<C-u>Unite -buffer-name=outline -start-insert -auto-preview -split outline<CR>
nnoremap <silent> [unite]s :<C-u>Unite session<CR>
nnoremap <silent> [unite]n :<C-u>Unite session/new<CR>
nnoremap <silent> [unite]fr
\ :<C-u>Unite -buffer-name=resume resume<CR>
nnoremap <silent> [unite]ma
\ :<C-u>Unite mapping<CR>
nnoremap <silent> [unite]me
\ :<C-u>Unite output:message<CR>
nnoremap [unite]f :<C-u>Unite source<CR>
nnoremap <silent> [unite]w
\ :<C-u>Unite -buffer-name=files -no-split
\ jump_point file_point buffer_tab
\ file_rec:! file file/new<CR>
nnoremap <silent>[unite]<Space> :Unite -silent -ignorecase -winheight=17 -start-insert menu:CustomKeyMaps<CR>
endif
endfunction

View File

@ -229,30 +229,6 @@ nnoremap <silent><leader>y :<C-u>Unite -no-split -buffer-name=yank history/yank<
" :Unite neobundle/search
"for Unite menu{
nnoremap <silent><leader>ug :Unite -silent -start-insert menu:git<CR>
" The prefix key.
nnoremap [unite] <Nop>
nmap f [unite]
nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir
\ -buffer-name=files buffer bookmark file<CR>
nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir
\ -buffer-name=files -prompt=%\ buffer bookmark file<CR>
nnoremap <silent> [unite]r :<C-u>Unite
\ -buffer-name=register register<CR>
nnoremap <silent> [unite]o :<C-u>Unite -buffer-name=outline -start-insert -auto-preview -split outline<CR>
nnoremap <silent> [unite]s :<C-u>Unite session<CR>
nnoremap <silent> [unite]n :<C-u>Unite session/new<CR>
nnoremap <silent> [unite]fr
\ :<C-u>Unite -buffer-name=resume resume<CR>
nnoremap <silent> [unite]ma
\ :<C-u>Unite mapping<CR>
nnoremap <silent> [unite]me
\ :<C-u>Unite output:message<CR>
nnoremap [unite]f :<C-u>Unite source<CR>
nnoremap <silent> [unite]w
\ :<C-u>Unite -buffer-name=files -no-split
\ jump_point file_point buffer_tab
\ file_rec:! file file/new<CR>
nnoremap <silent>[unite]<Space> :Unite -silent -ignorecase -winheight=17 -start-insert menu:CustomKeyMaps<CR>
nnoremap <silent><Leader>ls :Unite -silent -ignorecase -winheight=17 -start-insert menu:MyStarredrepos<CR>
nnoremap <silent><Leader>lm :Unite -silent -ignorecase -winheight=17 -start-insert menu:MpvPlayer<CR>
call zvim#util#loadMusics()

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: