1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:00:04 +08:00

Add help desc

This commit is contained in:
wsdjeg 2017-08-26 21:45:38 +08:00
parent f33fbfd391
commit 4005a767dc
3 changed files with 140 additions and 106 deletions

View File

@ -2,12 +2,15 @@
" @section Default, default
" @parentsection layers
let s:filename = expand('<sfile>:~')
function! SpaceVim#layers#default#plugins() abort
let plugins = []
return plugins
endfunction
let s:lnum = expand('<slnum>') + 3
function! SpaceVim#layers#default#config() abort
" Unimpaired bindings
" Quickly add empty lines
@ -47,7 +50,20 @@ function! SpaceVim#layers#default#config() abort
" Select last paste
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')", 'Find files in the directory of the current buffer', 1)
let lnum = expand('<slnum>') + s:lnum - 1
call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'],
\ "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')",
\ ['Find files in the directory of the current buffer',
\ [
\ '[SPC f f] is to find files in the directory of the current buffer',
\ 'vim with +python3 support will use denite',
\ 'vim with +python support will use leaderf',
\ 'otherwise will use ctrlp',
\ '',
\ 'Definition: ' . s:filename . ':' . lnum,
\ ]
\ ]
\ , 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1)
call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1)
@ -286,7 +302,7 @@ function! s:delete_current_buffer_file() abort
endif
endif
redraw!
endfunction
function! s:swap_buffer_with_nth_win(nr) abort
@ -317,102 +333,102 @@ function! s:buffer_transient_state() abort
call state.set_title('Buffer Selection Transient State')
call state.defind_keys(
\ {
\ 'layout' : 'vertical split',
\ 'left' : [
\ {
\ 'key' : {
\ 'name' : 'C-1..C-9',
\ 'pos' : [[1,4], [6,9]],
\ 'handles' : [
\ ["\<C-1>" , ''],
\ ["\<C-2>" , ''],
\ ["\<C-3>" , ''],
\ ["\<C-4>" , ''],
\ ["\<C-5>" , ''],
\ ["\<C-6>" , ''],
\ ["\<C-7>" , ''],
\ ["\<C-8>" , ''],
\ ["\<C-9>" , ''],
\ ],
\ },
\ 'desc' : 'goto nth window',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : {
\ 'name' : '1..9',
\ 'pos' : [[1,2], [4,5]],
\ 'handles' : [
\ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'],
\ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'],
\ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'],
\ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'],
\ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'],
\ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'],
\ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'],
\ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'],
\ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'],
\ ],
\ },
\ 'desc' : 'move buffer to nth window',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : {
\ 'name' : 'M-1..M-9',
\ 'pos' : [[1,4], [6,9]],
\ 'handles' : [
\ ["\<M-1>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
\ ["\<M-2>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
\ ["\<M-3>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
\ ["\<M-4>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
\ ["\<M-5>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
\ ["\<M-6>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
\ ["\<M-7>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
\ ["\<M-8>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
\ ["\<M-9>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'],
\ ],
\ },
\ 'desc' : 'swap buffer with nth window',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ ],
\ 'right' : [
\ {
\ 'key' : 'n',
\ 'desc' : 'next buffer',
\ 'func' : '',
\ 'cmd' : 'bnext',
\ 'exit' : 0,
\ },
\ {
\ 'key' : ['N', 'p'],
\ 'desc' : 'previous buffer',
\ 'func' : '',
\ 'cmd' : 'bp',
\ 'exit' : 0,
\ },
\ {
\ 'key' : 'd',
\ 'desc' : 'kill buffer',
\ 'func' : '',
\ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()',
\ 'exit' : 0,
\ },
\ {
\ 'key' : 'q',
\ 'desc' : 'quit',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ ],
\ 'layout' : 'vertical split',
\ 'left' : [
\ {
\ 'key' : {
\ 'name' : 'C-1..C-9',
\ 'pos' : [[1,4], [6,9]],
\ 'handles' : [
\ ["\<C-1>" , ''],
\ ["\<C-2>" , ''],
\ ["\<C-3>" , ''],
\ ["\<C-4>" , ''],
\ ["\<C-5>" , ''],
\ ["\<C-6>" , ''],
\ ["\<C-7>" , ''],
\ ["\<C-8>" , ''],
\ ["\<C-9>" , ''],
\ ],
\ },
\ 'desc' : 'goto nth window',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : {
\ 'name' : '1..9',
\ 'pos' : [[1,2], [4,5]],
\ 'handles' : [
\ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'],
\ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'],
\ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'],
\ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'],
\ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'],
\ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'],
\ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'],
\ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'],
\ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'],
\ ],
\ },
\ 'desc' : 'move buffer to nth window',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ {
\ 'key' : {
\ 'name' : 'M-1..M-9',
\ 'pos' : [[1,4], [6,9]],
\ 'handles' : [
\ ["\<M-1>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
\ ["\<M-2>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
\ ["\<M-3>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
\ ["\<M-4>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
\ ["\<M-5>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
\ ["\<M-6>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
\ ["\<M-7>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
\ ["\<M-8>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
\ ["\<M-9>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'],
\ ],
\ },
\ 'desc' : 'swap buffer with nth window',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 0,
\ },
\ ],
\ 'right' : [
\ {
\ 'key' : 'n',
\ 'desc' : 'next buffer',
\ 'func' : '',
\ 'cmd' : 'bnext',
\ 'exit' : 0,
\ },
\ {
\ 'key' : ['N', 'p'],
\ 'desc' : 'previous buffer',
\ 'func' : '',
\ 'cmd' : 'bp',
\ 'exit' : 0,
\ },
\ {
\ 'key' : 'd',
\ 'desc' : 'kill buffer',
\ 'func' : '',
\ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()',
\ 'exit' : 0,
\ },
\ {
\ 'key' : 'q',
\ 'desc' : 'quit',
\ 'func' : '',
\ 'cmd' : '',
\ 'exit' : 1,
\ },
\ ],
\ }
\ )
call state.open()

View File

@ -1,3 +1,4 @@
let s:file = expand('<sfile>:~')
function! SpaceVim#mapping#space#init() abort
if s:has_map_to_spc()
return
@ -63,19 +64,28 @@ function! SpaceVim#mapping#space#init() abort
call SpaceVim#mapping#space#def('nnoremap', ['w', 'W'], 'ChooseWin', 'select 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)
nnoremap <silent> [SPC]bn :bnext<CR>
let g:_spacevim_mappings_space.b.n = ['bnext', 'next buffer',
let s:lnum = expand('<slnum>') + 3
call SpaceVim#mapping#space#def('nnoremap', ['b', 'n'], 'bnext', ['next buffer',
\ [
\ 'SPC b n is running :bnext, jump to 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,',
\ '',
\ 'Definition: ' . s:file . ':' . s:lnum,
\ ]
\ ]
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']
call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bp', 'bp')
\ , 1)
let s:lnum = expand('<slnum>') + 3
call SpaceVim#mapping#space#def('nnoremap', ['b', 'p'], 'bp', ['previous buffer',
\ [
\ 'SPC b p is running :bp, jump to previous buffer',
\ 'which is a vim build in command',
\ 'It is bound to SPC b p, [ b,',
\ '',
\ 'Definition: ' . s:file . ':' . s:lnum,
\ ]
\ ]
\ , 1)
"
" Comments sections
"

8
syntax/HelpDescribe.vim Normal file
View File

@ -0,0 +1,8 @@
if exists("b:current_syntax")
finish
endif
let b:current_syntax = "HelpDescribe"
syntax case ignore
syn match FileName /[^:]*:\d\+:/
hi def link FileName Comment