From ddecdd7bdb641194e237d2b3f3397d920a1a5c91 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 15 Sep 2019 14:30:49 +0800 Subject: [PATCH] Update hint desc (#3050) --- autoload/SpaceVim/layers/checkers.vim | 16 +++--- autoload/SpaceVim/layers/core.vim | 10 ++-- autoload/SpaceVim/layers/cscope.vim | 28 ++++----- autoload/SpaceVim/layers/edit.vim | 81 +++++++++++++++++++++------ autoload/SpaceVim/layers/gtags.vim | 14 ++--- autoload/SpaceVim/mapping/leader.vim | 22 ++++---- autoload/SpaceVim/mapping/space.vim | 66 ++++++++++------------ 7 files changed, 139 insertions(+), 98 deletions(-) diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index a3782a633..9abd126bb 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -66,18 +66,18 @@ function! SpaceVim#layers#checkers#config() abort call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], 'call call(' \ . string(s:_function('s:clear_errors')) . ', [])', - \ 'clear all errors', 1) - call SpaceVim#mapping#space#def('nnoremap', ['e', 'h'], '', 'describe a syntax checker', 1) - call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], '', 'verify syntax checker setup', 1) + \ 'clear-all-errors', 1) + call SpaceVim#mapping#space#def('nnoremap', ['e', 'h'], '', 'describe-a-syntax-checker', 1) + call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], '', 'verify-syntax-checker-setup', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'n'], 'call call(' \ . string(s:_function('s:jump_to_next_error')) . ', [])', \ 'next-error', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'call call(' \ . string(s:_function('s:toggle_show_error')) . ', [0])', - \ 'toggle showing the error list', 1) + \ 'toggle-showing-the-error-list', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'L'], 'call call(' \ . string(s:_function('s:toggle_show_error')) . ', [1])', - \ 'toggle showing the error list', 1) + \ 'toggle-showing-the-error-list', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'p'], 'call call(' \ . string(s:_function('s:jump_to_previous_error')) . ', [])', \ 'previous-error', 1) @@ -86,16 +86,16 @@ function! SpaceVim#layers#checkers#config() abort \ 'previous-error', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], 'call call(' \ . string(s:_function('s:verify_syntax_setup')) . ', [])', - \ 'verify syntax setup', 1) + \ 'verify-syntax-setup', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', '.'], 'call call(' \ . string(s:_function('s:error_transient_state')) . ', [])', \ 'error-transient-state', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 's'], 'call call(' \ . string(s:_function('s:toggle_syntax_checker')) . ', [])', - \ 'toggle syntax checker', 1) + \ 'toggle-syntax-checker', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'e'], 'call call(' \ . string(s:_function('s:explain_the_error')) . ', [])', - \ 'explain the error', 1) + \ 'explain-the-error', 1) augroup SpaceVim_layer_checker autocmd! if g:spacevim_enable_neomake diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 0ef1f4966..aa838bb40 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -256,21 +256,21 @@ function! SpaceVim#layers#core#config() abort \ ] \ , 1) let g:vimproc#download_windows_dll = 1 - call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'call SpaceVim#plugins#projectmanager#current_root()', 'find project root', 1) - call SpaceVim#mapping#space#def('nnoremap', ['p', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill all project buffers', 1) - call SpaceVim#mapping#space#def('nnoremap', ['p', 'p'], 'call SpaceVim#plugins#projectmanager#list()', 'List all projects', 1) + call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'call SpaceVim#plugins#projectmanager#current_root()', 'find-project-root', 1) + call SpaceVim#mapping#space#def('nnoremap', ['p', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill-all-project-buffers', 1) + call SpaceVim#mapping#space#def('nnoremap', ['p', 'p'], 'call SpaceVim#plugins#projectmanager#list()', 'list-all-projects', 1) call SpaceVim#mapping#space#def('nnoremap', ['p', '/'], 'Grepper', 'fuzzy search for text in current project', 1) call SpaceVim#mapping#space#def('nnoremap', ['q', 'q'], 'qa', 'prompt-kill-vim', 1) call SpaceVim#mapping#space#def('nnoremap', ['q', 'Q'], 'qa!', 'kill-vim', 1) if has('nvim') && s:SYS.isWindows call SpaceVim#mapping#space#def('nnoremap', ['q', 'R'], 'call call(' \ . string(s:_function('s:restart_neovim_qt')) . ', [])', - \ 'restrat neovim-qt', 1) + \ 'restrat-neovim-qt', 1) else call SpaceVim#mapping#space#def('nnoremap', ['q', 'R'], '', 'restart-vim(TODO)', 1) endif call SpaceVim#mapping#space#def('nnoremap', ['q', 'r'], '', 'restart-vim-resume-layouts(TODO)', 1) - call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill current tab', 1) + call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill-current-tab', 1) call SpaceVim#mapping#gd#add('HelpDescribe', function('s:gotodef')) let g:_spacevim_mappings_space.c = {'name' : '+Comments'} diff --git a/autoload/SpaceVim/layers/cscope.vim b/autoload/SpaceVim/layers/cscope.vim index 11b12debf..386a88e55 100644 --- a/autoload/SpaceVim/layers/cscope.vim +++ b/autoload/SpaceVim/layers/cscope.vim @@ -16,18 +16,18 @@ endfunction function! SpaceVim#layers#cscope#config() abort let g:_spacevim_mappings_space.m.c = {'name' : '+cscope'} - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'c'], 'call cscope#find("d", expand(""))', 'find functions called by this function', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'C'], 'call cscope#find("c", expand(""))', 'find functions calling this function', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'd'], 'call cscope#find("g", expand(""))', 'find global definition of a symbol', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'r'], 'call cscope#find("s", expand(""))', 'find references of a symbol', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'f'], 'call cscope#find("f", expand(""))', 'find files', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'F'], 'call cscope#find("i", expand(""))', 'find files including this file', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'e'], 'call cscope#find("e", expand(""))', 'Find this egrep pattern', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 't'], 'call cscope#find("t", expand(""))', 'find this text string', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', '='], 'call cscope#find("a", expand(""))', 'find assignments to this symbol', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'u'], 'call cscope#update_databeses()', 'create cscope index', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'i'], 'call cscope#create_databeses()', 'create cscope databases', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'l'], 'call cscope#list_databases()', 'list cscope databases', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'm'], 'call cscope#clear_databases(SpaceVim#plugins#projectmanager#current_root())', 'remove current cscope databases', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'M'], 'call cscope#clear_databases()', 'remove all cscope databases', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'c'], 'call cscope#find("d", expand(""))', 'find-functions-called-by-this-function', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'C'], 'call cscope#find("c", expand(""))', 'find-functions-calling-this-function', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'd'], 'call cscope#find("g", expand(""))', 'find-global-definition-of-a-symbol', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'r'], 'call cscope#find("s", expand(""))', 'find-references-of-a-symbol', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'f'], 'call cscope#find("f", expand(""))', 'find-files', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'F'], 'call cscope#find("i", expand(""))', 'find-files-including-this-file', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'e'], 'call cscope#find("e", expand(""))', 'Find-this-egrep-pattern', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 't'], 'call cscope#find("t", expand(""))', 'find-this-text-string', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', '='], 'call cscope#find("a", expand(""))', 'find-assignments-to-this-symbol', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'u'], 'call cscope#update_databeses()', 'create-cscope-index', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'i'], 'call cscope#create_databeses()', 'create-cscope-databases', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'l'], 'call cscope#list_databases()', 'list-cscope-databases', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'm'], 'call cscope#clear_databases(SpaceVim#plugins#projectmanager#current_root())', 'remove-current-cscope-databases', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'M'], 'call cscope#clear_databases()', 'remove-all-cscope-databases', 1) endfunction diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 5c3604bb8..6a3f4427c 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -134,8 +134,12 @@ function! SpaceVim#layers#edit#config() abort call SpaceVim#mapping#space#def('vnoremap', ['x', 'U'], 'gU', 'set the selected text to up case', 0) " word - let g:_spacevim_mappings_space.x.w = {'name' : '+word'} + let g:_spacevim_mappings_space.x.w = {'name' : '+Word'} call SpaceVim#mapping#space#def('vnoremap', ['x', 'w', 'c'], "normal! " . ":'<,'>s/\\\w\\+//gn" . "\", 'count the words in the select region', 1) + let g:_spacevim_mappings_space.x.s = {'name' : '+String'} + call SpaceVim#mapping#space#def('nnoremap', ['x', 's', 'j'], 'call call(' + \ . string(s:_function('s:join_string_with')) . ', [])', + \ 'join-string-with', 1) let g:_spacevim_mappings_space.i = {'name' : '+Insertion'} let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'} @@ -143,60 +147,60 @@ function! SpaceVim#layers#edit#config() abort let g:_spacevim_mappings_space.i.U = {'name' : '+UUID'} call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 1], 'call call(' \ . string(s:_function('s:insert_simple_password')) . ', [])', - \ 'insert simple password', 1) + \ 'insert-simple-password', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 2], 'call call(' \ . string(s:_function('s:insert_stronger_password')) . ', [])', - \ 'insert stronger password', 1) + \ 'insert-stronger-password', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 3], 'call call(' \ . string(s:_function('s:insert_paranoid_password')) . ', [])', - \ 'insert password for paranoids', 1) + \ 'insert-password-for-paranoids', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'p'], 'call call(' \ . string(s:_function('s:insert_phonetically_password')) . ', [])', - \ 'insert a phonetically easy password', 1) + \ 'insert-a-phonetically-easy-password', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'n'], 'call call(' \ . string(s:_function('s:insert_numerical_password')) . ', [])', - \ 'insert a numerical password', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'u'], 'Unite unicode', 'search and insert unicode', 1) + \ 'insert-a-numerical-password', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'u'], 'Unite unicode', 'search-and-insert-unicode', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'U', 'U'], 'call call(' \ . string(s:_function('s:uuidgen_U')) . ', [])', \ 'uuidgen-4', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'l'], 'call call(' \ . string(s:_function('s:insert_lorem_ipsum_list')) . ', [])', - \ 'insert lorem-ipsum list', 1) + \ 'insert-lorem-ipsum-list', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'p'], 'call call(' \ . string(s:_function('s:insert_lorem_ipsum_paragraph')) . ', [])', - \ 'insert lorem-ipsum paragraph', 1) + \ 'insert-lorem-ipsum-paragraph', 1) call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call(' \ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])', - \ 'insert lorem-ipsum sentence', 1) + \ 'insert-lorem-ipsum-sentence', 1) " move line call SpaceVim#mapping#space#def('nnoremap', ['x', 'J'], 'call call(' \ . string(s:_function('s:move_text_down_transient_state')) . ', [])', - \ 'move text down(enter transient state)', 1) + \ 'move-text-down(enter-transient-state)', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'K'], 'call call(' \ . string(s:_function('s:move_text_up_transient_state')) . ', [])', - \ 'move text up(enter transient state)', 1) + \ 'move-text-up(enter-transient-state)', 1) " transpose let g:_spacevim_mappings_space.x.t = {'name' : '+transpose'} call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call(' \ . string(s:_function('s:transpose_with_previous')) . ', ["character"])', - \ 'swap current character with previous one', 1) + \ 'swap-current-character-with-previous-one', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'w'], 'call call(' \ . string(s:_function('s:transpose_with_previous')) . ', ["word"])', - \ 'swap current word with previous one', 1) + \ 'swap-current-word-with-previous-one', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'l'], 'call call(' \ . string(s:_function('s:transpose_with_previous')) . ', ["line"])', - \ 'swap current line with previous one', 1) + \ 'swap-current-line-with-previous-one', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'C'], 'call call(' \ . string(s:_function('s:transpose_with_next')) . ', ["character"])', - \ 'swap current character with next one', 1) + \ 'swap-current-character-with-next-one', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'W'], 'call call(' \ . string(s:_function('s:transpose_with_next')) . ', ["word"])', - \ 'swap current word with next one', 1) + \ 'swap-current-word-with-next-one', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'L'], 'call call(' \ . string(s:_function('s:transpose_with_next')) . ', ["line"])', - \ 'swap current line with next one', 1) + \ 'swap-current-line-with-next-one', 1) endfunction @@ -592,6 +596,47 @@ function! s:align_at_regular_expression() abort endif endfunction + +function! s:join_string_with() abort + if s:is_string(line('.'), col('.')) + let c = col('.') + let a = 0 + let b = 0 + let _c = c + while c > 0 + if s:is_string(line('.'), c) + let c -= 1 + else + let a = c + break + endif + endwhile + let c = _c + while c > 0 + if s:is_string(line('.'), c) + let c += 1 + else + let b = c + break + endif + endwhile + let l:save_register_m = @m + let line = getline('.')[:a] . join(split(getline('.')[a+1 : b]), '-') . getline('.')[b :] + call setline('.', line) + let @m = l:save_register_m + endif +endfunction + +let s:string_hi = { + \ 'c' : 'cCppString', + \ 'cpp' : 'cCppString', + \ } + +function! s:is_string(l, c) abort + return synIDattr(synID(a:l, a:c, 1), 'name') == get(s:string_hi, &filetype, &filetype . 'String') +endfunction + + " function() wrapper if v:version > 703 || v:version == 703 && has('patch1170') function! s:_function(fstr) abort diff --git a/autoload/SpaceVim/layers/gtags.vim b/autoload/SpaceVim/layers/gtags.vim index 46b2fe951..69c9ad76b 100644 --- a/autoload/SpaceVim/layers/gtags.vim +++ b/autoload/SpaceVim/layers/gtags.vim @@ -14,13 +14,13 @@ endfunction function! SpaceVim#layers#gtags#config() abort let g:_spacevim_mappings_space.m.g = {'name' : '+gtags'} - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'c'], 'GtagsGenerate!', 'create a gtags database', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'u'], 'GtagsGenerate', 'update tag database', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'p'], 'Gtags -p', 'list all file in GTAGS', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'd'], 'exe "Gtags -d " . expand("")', 'find definitions', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'r'], 'exe "Gtags -r " . expand("")', 'find references', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 's'], 'exe "Gtags -s " . expand("")', 'find cursor symbol', 1) - call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'g'], 'exe "Gtags -g " . expand("")', 'find cursor string', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'c'], 'GtagsGenerate!', 'create-a-gtags-database', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'u'], 'GtagsGenerate', 'update-tag-database', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'p'], 'Gtags -p', 'list-all-file-in-GTAGS', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'd'], 'exe "Gtags -d " . expand("")', 'find-definitions', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'r'], 'exe "Gtags -r " . expand("")', 'find-references', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 's'], 'exe "Gtags -s " . expand("")', 'find-cursor-symbol', 1) + call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'g'], 'exe "Gtags -g " . expand("")', 'find-cursor-string', 1) call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'f'], 'Gtags -f %', 'list of objects', 1) let g:gtags_gtagslabel = s:gtagslabel augroup spacevim_layer_tags diff --git a/autoload/SpaceVim/mapping/leader.vim b/autoload/SpaceVim/mapping/leader.vim index 46698fe00..4f75228c3 100644 --- a/autoload/SpaceVim/mapping/leader.vim +++ b/autoload/SpaceVim/mapping/leader.vim @@ -18,7 +18,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :split let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.v = ['split', - \ 'split window', + \ 'split-window', \ [ \ '[WIN v] is to split windows, switch to the new window', \ '', @@ -29,7 +29,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :split +bp let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.V = ['split +bp', - \ 'split previous buffer', + \ 'split-previous-buffer', \ [ \ '[WIN V] is to split previous buffer, switch to the new window', \ '', @@ -40,7 +40,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :vsplit let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.g = ['vsplit', - \ 'vsplit window', + \ 'vsplit-window', \ [ \ '[WIN g] is to split previous buffer vertically, switch to the new window', \ '', @@ -51,7 +51,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :vsplit +bp let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.G = ['vsplit +bp', - \ 'vsplit previous buffer', + \ 'vsplit-previous-buffer', \ [ \ '[WIN G] is to split windows vertically, switch to the new window', \ '', @@ -62,7 +62,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :tabnew let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.t = ['tabnew', - \ 'create new tab', + \ 'create-new-tab', \ [ \ '[WIN t] is to create new tab', \ '', @@ -73,7 +73,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :onlydoautocmd WinEnter let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.o = ['only | doautocmd WinEnter', - \ 'Close other windows', + \ 'close-other-windows', \ [ \ '[WIN o] is to close all other windows', \ '', @@ -84,7 +84,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :call SpaceVim#mapping#BufferEmpty() let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.x = ['call SpaceVim#mapping#BufferEmpty()', - \ 'Empty current buffer', + \ 'empty-current-buffer', \ [ \ '[WIN x] is to empty current buffer', \ '', @@ -95,7 +95,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :b# let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows['\'] = ['b#', - \ 'Switch to the last buffer', + \ 'switch-to-the-last-buffer', \ [ \ '[WIN \] is to switch to the last buffer', \ '', @@ -106,7 +106,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :close let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.Q = ['close', - \ 'Close current windows', + \ 'close-current-windows', \ [ \ '[WIN Q] is to close current windows', \ '', @@ -117,7 +117,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :call SpaceVim#mapping#close_current_buffer() let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.q = ['call SpaceVim#mapping#close_current_buffer()', - \ 'delete current windows', + \ 'delete-current-windows', \ [ \ '[WIN q] is to delete current windows', \ '', @@ -128,7 +128,7 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ :call SpaceVim#mapping#clear_buffers() let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.c = ['call SpaceVim#mapping#clear_buffers()', - \ 'Clear all the buffers', + \ 'clear-all-the-buffers', \ [ \ '[WIN c] is to clear all the buffers', \ '', diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 3f95904d3..40797546c 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -56,7 +56,7 @@ function! SpaceVim#mapping#space#init() abort let s:lnum = expand('') + s:funcbeginline call SpaceVim#mapping#space#def('nnoremap', ['w', '.'], 'call call(' \ . string(s:_function('s:windows_transient_state')) . ', [])', - \ ['buffer transient state', + \ ['buffer-transient-state', \ [ \ '[SPC w .] is to open the buffer transient state', \ '', @@ -76,7 +76,7 @@ function! SpaceVim#mapping#space#init() abort \ , 1) let s:lnum = expand('') + s:funcbeginline call SpaceVim#mapping#space#def('nnoremap', ['w', 'D'], 'ChooseWin | close | wincmd w', - \ ['delete window (other windows)', + \ ['delete-window-(other-windows)', \ [ \ '[SPC w D] is to select a windows to close', \ '', @@ -86,7 +86,7 @@ function! SpaceVim#mapping#space#init() abort \ , 1) let s:lnum = expand('') + s:funcbeginline call SpaceVim#mapping#space#def('nnoremap', ['w', 'f'], 'tabnew', - \ ['create new tab', + \ ['create-new-tab', \ [ \ '[SPC w f] is to create new tab', \ '', @@ -98,7 +98,7 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#space#def('nnoremap', ['w', 'F'], 'call call(' \ . string(function('s:create_new_named_tab')) \ . ', [])', - \ ['create new named tab', + \ ['create-new-named-tab', \ [ \ '[SPC w F] is to create new named tab', \ '', @@ -297,7 +297,7 @@ 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) let s:lnum = expand('') + s:funcbeginline - call SpaceVim#mapping#space#def('nnoremap', ['b', 'n'], 'bnext', ['next buffer', + call SpaceVim#mapping#space#def('nnoremap', ['b', 'n'], 'bnext', ['next-buffer', \ [ \ '[SPC b n] is running :bnext, jump to next buffer', \ 'which is a vim build in command', @@ -308,7 +308,7 @@ function! SpaceVim#mapping#space#init() abort \ ] \ , 1) let s:lnum = expand('') + 3 - call SpaceVim#mapping#space#def('nnoremap', ['b', 'p'], 'bp', ['previous buffer', + 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', @@ -323,54 +323,55 @@ function! SpaceVim#mapping#space#init() abort let g:_spacevim_mappings_space.B = {'name' : '+Global buffers'} if g:spacevim_relativenumber nnoremap [SPC]tn :setlocal nonumber! norelativenumber! - let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle line number'] + let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle-line-number'] call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'set nu!') else nnoremap [SPC]tn :setlocal number! - let g:_spacevim_mappings_space.t.n = ['setlocal number!', 'toggle line number'] + let g:_spacevim_mappings_space.t.n = ['setlocal number!', 'toggle-line-number'] call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'setlocal number!') endif call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {})) " Searching in current buffer call SpaceVim#mapping#space#def('nnoremap', ['s', 's'], "call SpaceVim#plugins#flygrep#open({'input' : input(\"grep pattern:\"), 'files': bufname(\"%\")})", - \ 'grep in current buffer', 1) + \ 'grep-in-current-buffer', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'S'], "call SpaceVim#plugins#flygrep#open({'input' : expand(\"\"), 'files': bufname(\"%\")})", - \ 'grep cursor word in current buffer', 1) + \ 'grep-cword-in-current-buffer', 1) " Searching in all loaded buffers call SpaceVim#mapping#space#def('nnoremap', ['s', 'b'], "call SpaceVim#plugins#flygrep#open({'input' : input(\"grep pattern:\"), 'files':'@buffers'})", - \ 'grep in all loaded buffers', 1) + \ 'grep-in-all-buffers', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'B'], "call SpaceVim#plugins#flygrep#open({'input' : expand(\"\"), 'files':'@buffers'})", - \ 'grep cursor word in all loaded buffers', 1) + \ 'grep-cword-in-all-buffers', 1) " Searching in buffer directory call SpaceVim#mapping#space#def('nnoremap', ['s', 'd'], "call SpaceVim#plugins#flygrep#open({'input' :" \ . " input(\"grep pattern:\"), 'dir' : fnamemodify(expand('%'), ':p:h')})", - \ 'grep in buffer directory', 1) + \ 'grep-in-buffer-directory', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'D'], "call SpaceVim#plugins#flygrep#open({'input' :" \ . " expand(\"\"), 'dir' : fnamemodify(expand('%'), ':p:h')})", - \ 'grep cursor word in buffer directory', 1) + \ 'grep-cword-in-buffer-directory', 1) " Searching in files in an arbitrary directory call SpaceVim#mapping#space#def('nnoremap', ['s', 'f'], "call SpaceVim#plugins#flygrep#open({'input' :" \ . " input(\"grep pattern:\"), 'dir' : input(\"arbitrary dir:\", '', 'dir')})", - \ 'grep in arbitrary directory', 1) - call SpaceVim#mapping#space#def('nnoremap', ['s', 'F'], "call SpaceVim#plugins#flygrep#open({'input' :" + \ 'grep-in-arbitrary-directory', 1) + call SpaceVim#mapping#space#def('nnoremap', ['s', 'F'], + \ "call SpaceVim#plugins#flygrep#open({'input' :" \ . " expand(\"\"), 'dir' : input(\"arbitrary dir:\", '', 'dir')})", - \ 'grep cursor word in arbitrary directory', 1) + \ 'grep-cword-in-arbitrary-directory', 1) " Searching in project call SpaceVim#mapping#space#def('nnoremap', ['s', 'p'], \ 'call SpaceVim#plugins#flygrep#open(' . \ "{'input' : input(\"grep pattern:\"), 'dir' : get(b:, \"rootDir\", getcwd())})", - \ 'grep in project', 1) + \ 'grep-in-project', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'P'], \ "call SpaceVim#plugins#flygrep#open({'input' : expand(\"\"), 'dir' : get(b:, \"rootDir\", getcwd())})", - \ 'grep cursor word in project', 1) + \ 'grep-cword-in-project', 1) " Searching background call SpaceVim#mapping#space#def('nnoremap', ['s', 'j'], - \ 'call SpaceVim#plugins#searcher#find("", SpaceVim#mapping#search#default_tool()[0])', 'Background search keywords in project', 1) + \ 'call SpaceVim#plugins#searcher#find("", SpaceVim#mapping#search#default_tool()[0])', 'background-search-in-project', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'J'], \ 'call SpaceVim#plugins#searcher#find(expand(""),SpaceVim#mapping#search#default_tool()[0])', - \ 'Background search cursor words in project', 1) - call SpaceVim#mapping#space#def('nnoremap', ['s', 'l'], 'call SpaceVim#plugins#searcher#list()', 'List all searching results', 1) + \ 'background-search-cwords-in-project', 1) + call SpaceVim#mapping#space#def('nnoremap', ['s', 'l'], 'call SpaceVim#plugins#searcher#list()', 'list-all-searching-results', 1) " Searching tools " ag @@ -490,32 +491,27 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#space#def('nnoremap', ['s', 't', 'J'], 'call SpaceVim#plugins#searcher#find(expand(""), "pt")', \ 'Background search cursor words in project with pt', 1) - call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'G'], 'call SpaceVim#plugins#flygrep#open({})', - \ 'grep on the fly', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', '/'], 'call SpaceVim#plugins#flygrep#open({})', - \ 'grep on the fly', 1) + \ 'grep-on-the-fly', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'c'], 'noh', - \ 'clear search highlight', 1) + \ 'clear-search-highlight', 1) "Symbol nnoremap SpaceVim-plugin-iedit :call SpaceVim#plugins#iedit#start() xnoremap SpaceVim-plugin-iedit :call SpaceVim#plugins#iedit#start(1) call SpaceVim#mapping#space#def('nmap', ['s', 'e'], 'SpaceVim-plugin-iedit', - \ 'start iedit mode', 0, 1) + \ 'start-iedit-mode', 0, 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'H'], 'call SpaceVim#plugins#highlight#start(1)', - \ 'highlight all symbols', 1) + \ 'highlight-all-symbols', 1) call SpaceVim#mapping#space#def('nnoremap', ['s', 'h'], 'call SpaceVim#plugins#highlight#start(0)', - \ 'highlight current symbols', 1) + \ 'highlight-current-symbols', 1) " Getting help - let g:_spacevim_mappings_space.h.d = {'name' : '+help-describe'} - call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'b'], - \ 'call SpaceVim#plugins#help#describe_bindings()', - \ 'describe key bindings', 1) + let g:_spacevim_mappings_space.h.d = {'name' : '+help describe'} call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'k'], \ 'call SpaceVim#plugins#help#describe_key()', - \ 'describe key bindings', 1) - call SpaceVim#custom#SPC('nnoremap', ['a', 'o'], 'call SpaceVim#plugins#todo#list()', 'Open todo manager', 1) + \ 'describe-key-bindings', 1) + call SpaceVim#custom#SPC('nnoremap', ['a', 'o'], 'call SpaceVim#plugins#todo#list()', 'open-todo-manager', 1) endfunction function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd, ...) abort