mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:20:04 +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 type(a:nr) == 0
|
||||||
if a:nr == 32
|
if a:nr == 32
|
||||||
return 'SPC'
|
return 'SPC'
|
||||||
|
elseif a:nr == 4
|
||||||
|
return '<C-d>'
|
||||||
|
elseif a:nr == 9
|
||||||
|
return '<Tab>'
|
||||||
|
elseif a:nr == 27
|
||||||
|
return '<Esc>'
|
||||||
else
|
else
|
||||||
return nr2char(a:nr)
|
return nr2char(a:nr)
|
||||||
endif
|
endif
|
||||||
|
@ -222,6 +222,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
|||||||
\ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}'
|
\ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}'
|
||||||
elseif &filetype ==# 'TransientState'
|
elseif &filetype ==# 'TransientState'
|
||||||
return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
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
|
endif
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
return s:active()
|
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#UndoQuitWin()', 'undo quieted window', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['w', 'U'], 'call SpaceVim#plugins#windowsmanager#RedoQuitWin()', 'redo 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>
|
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')
|
call SpaceVim#mapping#menu('Open next buffer', '[SPC]bn', 'bp')
|
||||||
nnoremap <silent> [SPC]bp :bp<CR>
|
nnoremap <silent> [SPC]bp :bp<CR>
|
||||||
let g:_spacevim_mappings_space.b.p = ['bp', 'previous buffer']
|
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
|
||||||
endif
|
endif
|
||||||
if len(a:keys) == 2
|
if len(a:keys) == 2
|
||||||
|
if type(a:desc) == 1
|
||||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
|
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc]
|
||||||
elseif len(a:keys) == 3
|
else
|
||||||
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]][a:keys[2]] = [lcmd, a:desc]
|
let g:_spacevim_mappings_space[a:keys[0]][a:keys[1]] = [lcmd, a:desc[0], a:desc[1]]
|
||||||
elseif len(a:keys) == 1
|
|
||||||
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
|
|
||||||
endif
|
endif
|
||||||
|
elseif len(a:keys) == 3
|
||||||
|
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
|
||||||
|
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)
|
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 extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
|
call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {}))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ function! SpaceVim#plugins#help#describe_key()
|
|||||||
let root = root[name]
|
let root = root[name]
|
||||||
if type(root) == 3
|
if type(root) == 3
|
||||||
if len(root) == 3
|
if len(root) == 3
|
||||||
|
redraw!
|
||||||
call s:open_describe_buffer(root[-1])
|
call s:open_describe_buffer(root[-1])
|
||||||
else
|
else
|
||||||
call s:build_mpt(['can not find describe for ', join(keys, ' - ')])
|
call s:build_mpt(['can not find describe for ', join(keys, ' - ')])
|
||||||
@ -36,7 +37,9 @@ function! SpaceVim#plugins#help#describe_key()
|
|||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
redraw!
|
redraw!
|
||||||
|
echohl Comment
|
||||||
echo join(keys, ' - ') . ' is undfinded'
|
echo join(keys, ' - ') . ' is undfinded'
|
||||||
|
echohl NONE
|
||||||
let definded = 0
|
let definded = 0
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
@ -44,14 +47,23 @@ endfunction
|
|||||||
|
|
||||||
function! s:build_mpt(mpt) abort
|
function! s:build_mpt(mpt) abort
|
||||||
redraw!
|
redraw!
|
||||||
|
echohl Comment
|
||||||
if type(a:mpt) == 1
|
if type(a:mpt) == 1
|
||||||
echo a:mpt
|
echo a:mpt
|
||||||
elseif type(a:mpt) == 3
|
elseif type(a:mpt) == 3
|
||||||
echo join(a:mpt)
|
echo join(a:mpt)
|
||||||
endif
|
endif
|
||||||
|
echohl NONE
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:open_describe_buffer(desc) abort
|
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
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user