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

Merge branch 'master' of github.com:SpaceVim/SpaceVim

This commit is contained in:
alanding 2019-04-03 10:43:38 +08:00
commit 707f4d3e14
6 changed files with 96 additions and 2 deletions

View File

@ -91,6 +91,22 @@ let g:spacevim_relativenumber = 1
" < " <
let g:spacevim_max_column = 120 let g:spacevim_max_column = 120
""
" @section max_column, options-home_files_number
" @parentsection options
" Change the list number of files for SpaceVim home. Default is 6.
" >
" home_files_number = 6
" <
""
" Change the list number of files for SpaceVim home. Default is 6.
" >
" let g:spacevim_home_files_number = 6
" <
let g:spacevim_home_files_number = 6
"" ""
" @section enable_guicolors, options-enable_guicolors " @section enable_guicolors, options-enable_guicolors
" @parentsection options " @parentsection options

View File

@ -425,3 +425,39 @@ function! s:helptags(...) abort
\ 'down': '40%' \ 'down': '40%'
\ })) \ }))
endfunction endfunction
" fzf menu command
function! SpaceVim#layers#fzf#complete_menu(ArgLead, CmdLine, CursorPos) abort
return join(keys(g:unite_source_menu_menus), "\n")
endfunction
command! -nargs=* -complete=custom,SpaceVim#layers#fzf#complete_menu FzfMenu call <SID>menu(<q-args>)
function! s:menu_action(e) abort
let action = get(s:menu_action, a:e, '')
exe action
endfunction
function! s:menu(name) abort
let s:source = 'menu'
let s:menu_name = a:name
let s:menu_action = {}
function! s:menu_content() abort
let menu = get(g:unite_source_menu_menus, s:menu_name, {})
if has_key(menu, 'command_candidates')
let rt = []
for item in menu.command_candidates
call add(rt, item[0])
call extend(s:menu_action, {item[0] : item[1]}, 'force')
endfor
return rt
else
return []
endif
endfunction
call fzf#run(fzf#wrap('menu', {
\ 'source': reverse(<sid>menu_content()),
\ 'sink': function('s:menu_action'),
\ 'options': '+m',
\ 'down': '40%'
\ }))
endfunction

View File

@ -39,3 +39,13 @@ function! SpaceVim#layers#test#config() abort
let g:test#custom_strategies = {'spacevim': function('SpaceVim#plugins#runner#open')} let g:test#custom_strategies = {'spacevim': function('SpaceVim#plugins#runner#open')}
let g:test#strategy = 'spacevim' let g:test#strategy = 'spacevim'
endfunction endfunction
function! SpaceVim#layers#test#set_variable(var) abort
let l:override = get(a:var, 'override_config', {})
if !empty(l:override)
for l:option in keys(l:override)
let l:varname = 'test#'.substitute(l:option, '_', '#', 'g')
execute 'let g:'.l:varname.' = '."'".l:override[l:option]."'"
endfor
endif
endfunction

View File

@ -36,8 +36,19 @@ let g:unite_source_menu_menus.Projects = {'description':
let g:unite_source_menu_menus.Projects.command_candidates = let g:unite_source_menu_menus.Projects.command_candidates =
\ get(g:unite_source_menu_menus.Projects,'command_candidates', []) \ get(g:unite_source_menu_menus.Projects,'command_candidates', [])
" this function will use fuzzy find layer, now only denite and unite are
" supported.
function! SpaceVim#plugins#projectmanager#list() abort function! SpaceVim#plugins#projectmanager#list() abort
Unite menu:Projects if SpaceVim#layers#isLoaded('unite')
Unite menu:Projects
elseif SpaceVim#layers#isLoaded('denite')
Denite menu:Projects
elseif SpaceVim#layers#isLoaded('fzf')
FzfMenu Projects
else
call SpaceVim#logger#warn('fuzzy find layer is needed to find project!')
endif
endfunction endfunction
function! SpaceVim#plugins#projectmanager#open(project) abort function! SpaceVim#plugins#projectmanager#open(project) abort

View File

@ -24,7 +24,7 @@ fu! s:update_logo()
endif endif
endf endf
let g:startify_session_dir = $HOME . '/.data/' . ( has('nvim') ? 'nvim' : 'vim' ) . '/session' let g:startify_session_dir = $HOME . '/.data/' . ( has('nvim') ? 'nvim' : 'vim' ) . '/session'
let g:startify_files_number = 6 let g:startify_files_number = g:spacevim_home_files_number
let g:startify_list_order = [ let g:startify_list_order = [
\ [' My most recently used files in the current directory:'], \ [' My most recently used files in the current directory:'],
\ 'dir', \ 'dir',

View File

@ -26,6 +26,27 @@ To use this configuration layer, add following snippet to your custom configurat
name = "test" name = "test"
``` ```
## Configuration
To set or override any configuration ([see supported settings here](https://github.com/janko/vim-test)) you may use the `override_config`:
```toml
[[layers]]
name = "test"
[layers.override_config]
java_runner = "gradletest"
java_gradletest_executable = "./gradlew test"
```
In the example above is equivalent to adding the following in viml:
```viml
let test#java#runner = "gradletest"
let test#java#gradletest#executable = "./gradlew test"
```
In essence, it replaces `_` with `#` and prepends `test#` to the keys inside `override_config`.
## Key bindings ## Key bindings
| Key Binding | Description | | Key Binding | Description |