mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 02:20:03 +08:00
Add describe for SPC b n
This commit is contained in:
parent
bd5454a300
commit
9d7ac05d12
@ -10,6 +10,12 @@ function! s:self.nr2name(nr) abort
|
||||
if type(a:nr) == 0
|
||||
if a:nr == 32
|
||||
return 'SPC'
|
||||
elseif a:nr == 4
|
||||
return '<C-d>'
|
||||
elseif a:nr == 9
|
||||
return '<Tab>'
|
||||
elseif a:nr == 27
|
||||
return '<Esc>'
|
||||
else
|
||||
return nr2char(a:nr)
|
||||
endif
|
||||
|
@ -222,6 +222,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
\ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}'
|
||||
elseif &filetype ==# 'TransientState'
|
||||
return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'HelpDescribe'
|
||||
return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
endif
|
||||
if a:0 > 0
|
||||
return s:active()
|
||||
|
@ -63,7 +63,13 @@ function! SpaceVim#mapping#space#init() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'u'], 'call SpaceVim#plugins#windowsmanager#UndoQuitWin()', 'undo quieted window', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'U'], 'call SpaceVim#plugins#windowsmanager#RedoQuitWin()', 'redo quieted window', 1)
|
||||
nnoremap <silent> [SPC]bn :bnext<CR>
|
||||
let g:_spacevim_mappings_space.b.n = ['bnext', 'next buffer']
|
||||
let g:_spacevim_mappings_space.b.n = ['bnext', 'next buffer',
|
||||
\ [
|
||||
\ 'SPC b n is running :bnext, jump to next buffer',
|
||||
\ 'which is a vim build in command',
|
||||
\ 'It is bound to SPC b n, ] b,',
|
||||
\ ]
|
||||
\ ]
|
||||
call SpaceVim#mapping#menu('Open next buffer', '[SPC]bn', 'bp')
|
||||
nnoremap <silent> [SPC]bp :bp<CR>
|
||||
let g:_spacevim_mappings_space.b.p = ['bp', 'previous buffer']
|
||||
@ -260,13 +266,29 @@ function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd, ...) abort
|
||||
endif
|
||||
endif
|
||||
if len(a:keys) == 2
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
|
||||
if type(a:desc) == 1
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
|
||||
else
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc[0], a:desc[1]]
|
||||
endif
|
||||
elseif len(a:keys) == 3
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]][a:keys[2]] = [lcmd, a:desc]
|
||||
if type(a:desc) == 1
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]][a:keys[2]] = [lcmd, a:desc]
|
||||
else
|
||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]][a:keys[2]] = [lcmd, a:desc[0], a:desc[1]]
|
||||
endif
|
||||
elseif len(a:keys) == 1
|
||||
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
|
||||
if type(a:desc) == 1
|
||||
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
|
||||
else
|
||||
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc[0], a:desc[1]]
|
||||
endif
|
||||
endif
|
||||
if type(a:desc) == 1
|
||||
call SpaceVim#mapping#menu(a:desc, '[SPC]' . join(a:keys, ''), lcmd)
|
||||
else
|
||||
call SpaceVim#mapping#menu(a:desc[0], '[SPC]' . join(a:keys, ''), lcmd)
|
||||
endif
|
||||
call SpaceVim#mapping#menu(a:desc, '[SPC]' . join(a:keys, ''), lcmd)
|
||||
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
|
||||
endfunction
|
||||
|
||||
|
@ -26,6 +26,7 @@ function! SpaceVim#plugins#help#describe_key()
|
||||
let root = root[name]
|
||||
if type(root) == 3
|
||||
if len(root) == 3
|
||||
redraw!
|
||||
call s:open_describe_buffer(root[-1])
|
||||
else
|
||||
call s:build_mpt(['can not find describe for ', join(keys, ' - ')])
|
||||
@ -36,7 +37,9 @@ function! SpaceVim#plugins#help#describe_key()
|
||||
endif
|
||||
else
|
||||
redraw!
|
||||
echohl Comment
|
||||
echo join(keys, ' - ') . ' is undfinded'
|
||||
echohl NONE
|
||||
let definded = 0
|
||||
endif
|
||||
endwhile
|
||||
@ -44,14 +47,23 @@ endfunction
|
||||
|
||||
function! s:build_mpt(mpt) abort
|
||||
redraw!
|
||||
echohl Comment
|
||||
if type(a:mpt) == 1
|
||||
echo a:mpt
|
||||
elseif type(a:mpt) == 3
|
||||
echo join(a:mpt)
|
||||
endif
|
||||
echohl NONE
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:open_describe_buffer(desc) abort
|
||||
|
||||
noautocmd botright split __help_describe__
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber nocursorline
|
||||
set filetype=HelpDescribe
|
||||
call setline(1, a:desc)
|
||||
let lines = &lines * 30 / 100
|
||||
if lines < winheight(0)
|
||||
exe 'resize ' . lines
|
||||
endif
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user