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

Merge pull request #1585 from wsdjeg/spc-h-i

Fix SPC h i key binding
This commit is contained in:
Wang Shidong 2018-04-01 13:45:03 +08:00 committed by GitHub
commit c7b85d5f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 5 deletions

View File

@ -86,11 +86,6 @@ function! SpaceVim#layers#core#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1)
" help mappings
call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Report an issue of SpaceVim', 1)
if has('python3')
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1)
else
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
endif
call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1)

View File

@ -12,6 +12,7 @@ function! SpaceVim#layers#ctrlp#plugins() abort
\ ['FelikZ/ctrlp-py-matcher'],
\ ['mattn/ctrlp-register', {'on_cmd' : 'CtrlPRegister'}],
\ ['DeaR/ctrlp-jumps', {'on_cmd' : 'CtrlPJump'}],
\ ['SpaceVim/vim-ctrlp-help', {'on_cmd' : 'CtrlPHelp'}],
\ ]
return plugins
endfunction
@ -19,6 +20,9 @@ endfunction
let s:filename = expand('<sfile>:~')
let s:lnum = expand('<slnum>') + 2
function! SpaceVim#layers#ctrlp#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'call call('
\ . string(s:_function('s:get_help_with_cursor_symbol')) . ', [])',
\ 'get help with the symbol at point', 1)
let lnum = expand('<slnum>') + s:lnum - 1
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'],
\ 'CtrlP',
@ -49,6 +53,13 @@ function! SpaceVim#layers#ctrlp#config() abort
\ , 1)
endfunction
function! s:get_help_with_cursor_symbol() abort
let save_ctrlp_default_input = get(g:, 'ctrlp_default_input', '')
let g:ctrlp_default_input = expand('<cword>')
CtrlPHelp
let g:ctrlp_default_input = save_ctrlp_default_input
endfunction
let s:file = expand('<sfile>:~')
let s:unite_lnum = expand('<slnum>') + 3
function! s:defind_fuzzy_finder() abort
@ -96,3 +107,19 @@ function! s:defind_fuzzy_finder() abort
\ ]
\ ]
endfunction
" function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170')
function! s:_function(fstr) abort
return function(a:fstr)
endfunction
else
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
let s:_s = '<SNR>' . s:_SID() . '_'
function! s:_function(fstr) abort
return function(substitute(a:fstr, 's:', s:_s, 'g'))
endfunction
endif

View File

@ -50,6 +50,7 @@ function! SpaceVim#layers#denite#config() abort
\ ]
\ ]
\ , 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1)
endfunction
let s:file = expand('<sfile>:~')

View File

@ -48,6 +48,7 @@ endfunction
let s:filename = expand('<sfile>:~')
let s:lnum = expand('<slnum>') + 2
function! SpaceVim#layers#unite#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
if has('nvim')
let cmd = 'Unite file_rec/neovim'
else