1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-15 08:09:11 +08:00

pref(guide): format g prefix key binding guide

This commit is contained in:
Shidong Wang 2021-10-28 16:38:42 +08:00
parent cd2fee0a0e
commit 0a89a58d51
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
3 changed files with 59 additions and 57 deletions

View File

@ -275,8 +275,6 @@ function! SpaceVim#default#keyBindings() abort
nnoremap <silent><M-Right> :<C-U>call <SID>tobur("next")<CR>
nnoremap <silent><M-Left> :<C-U>call <SID>tobur("prev")<CR>
call SpaceVim#mapping#def('nnoremap <silent>','g=',':call SpaceVim#mapping#format()<cr>','format current buffer','call SpaceVim#mapping#format()')
endfunction
fu! s:tobur(num) abort

View File

@ -143,9 +143,6 @@ function! SpaceVim#layers#core#config() abort
nnoremap <silent> [p P
nnoremap <silent> ]p p
" Select last paste
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'call call('
\ . string(s:_function('s:save_current_file')) . ', [])',
\ 'save-current-file', 1)

View File

@ -10,113 +10,120 @@ function! SpaceVim#mapping#g#init() abort
nnoremap <silent><nowait> [G] :<c-u>LeaderGuide "g"<CR>
nmap g [G]
let g:_spacevim_mappings_g = {}
let g:_spacevim_mappings_g['<C-G>'] = ['call feedkeys("g\<c-g>", "n")', 'show cursor info']
let g:_spacevim_mappings_g['<C-G>'] = ['call feedkeys("g\<c-g>", "n")', 'show-cursor-info']
nnoremap g<c-g> g<c-g>
let g:_spacevim_mappings_g['&'] = ['call feedkeys("g&", "n")', 'repeat last ":s" on all lines']
let g:_spacevim_mappings_g['&'] = ['call feedkeys("g&", "n")', 'repeat-last-:s-on-buffer']
nnoremap g& g&
let g:_spacevim_mappings_g["'"] = ['call feedkeys("g' . "'" . '", "n")', 'jump to mark']
let g:_spacevim_mappings_g["'"] = ['call feedkeys("g' . "'" . '", "n")', 'jump-to-mark-`']
nnoremap g' g'
let g:_spacevim_mappings_g['`'] = ['call feedkeys("g' . '`' . '", "n")', 'jump to mark']
let g:_spacevim_mappings_g['`'] = ['call feedkeys("g' . '`' . '", "n")', "jump-to-mark-'"]
nnoremap g` g`
let g:_spacevim_mappings_g['+'] = ['call feedkeys("g+", "n")', 'newer text state']
let g:_spacevim_mappings_g['+'] = ['call feedkeys("g+", "n")', 'newer-text-state']
nnoremap g+ g+
let g:_spacevim_mappings_g['-'] = ['call feedkeys("g-", "n")', 'older text state']
let g:_spacevim_mappings_g['-'] = ['call feedkeys("g-", "n")', 'older-text-state']
nnoremap g- g-
let g:_spacevim_mappings_g[','] = ['call feedkeys("g,", "n")', 'newer position in change list']
let g:_spacevim_mappings_g[','] = ['call feedkeys("g,", "n")', 'newer-change-position']
nnoremap g, g,
let g:_spacevim_mappings_g[';'] = ['call feedkeys("g;", "n")', 'older position in change list']
let g:_spacevim_mappings_g[';'] = ['call feedkeys("g;", "n")', 'older-change-position']
nnoremap g; g;
let g:_spacevim_mappings_g['@'] = ['call feedkeys("g@", "n")', 'call operatorfunc']
let g:_spacevim_mappings_g['@'] = ['call feedkeys("g@", "n")', 'call-operatorfunc']
nnoremap g@ g@
let g:_spacevim_mappings_g['#'] = ['call feedkeys("\<Plug>(incsearch-nohl-g#)")', 'search under cursor backward']
let g:_spacevim_mappings_g['*'] = ['call feedkeys("\<Plug>(incsearch-nohl-g*)")', 'search under cursor forward']
let g:_spacevim_mappings_g['/'] = ['call feedkeys("\<Plug>(incsearch-stay)")', 'stay incsearch']
let g:_spacevim_mappings_g['$'] = ['call feedkeys("g$", "n")', 'go to rightmost character']
let g:_spacevim_mappings_g['#'] = ['call feedkeys("\<Plug>(incsearch-nohl-g#)")', 'backward-search-cword']
let g:_spacevim_mappings_g['*'] = ['call feedkeys("\<Plug>(incsearch-nohl-g*)")', 'forward-search-cword']
let g:_spacevim_mappings_g['/'] = ['call feedkeys("\<Plug>(incsearch-stay)")', 'stay-incsearch']
let g:_spacevim_mappings_g['$'] = ['call feedkeys("g$", "n")', 'rightmost-character']
nnoremap g$ g$
let g:_spacevim_mappings_g['<End>'] = ['call feedkeys("g$", "n")', 'go to rightmost character']
let g:_spacevim_mappings_g['<End>'] = ['call feedkeys("g$", "n")', 'rightmost-character']
nnoremap g<End> g<End>
let g:_spacevim_mappings_g['0'] = ['call feedkeys("g0", "n")', 'go to leftmost character']
let g:_spacevim_mappings_g['0'] = ['call feedkeys("g0", "n")', 'leftmost-character']
nnoremap g0 g0
let g:_spacevim_mappings_g['<Home>'] = ['call feedkeys("g0", "n")', 'go to leftmost character']
let g:_spacevim_mappings_g['<Home>'] = ['call feedkeys("g0", "n")', 'leftmost-character']
nnoremap g<Home> g<Home>
let g:_spacevim_mappings_g['e'] = ['call feedkeys("ge", "n")', 'go to end of previous word']
let g:_spacevim_mappings_g['e'] = ['call feedkeys("ge", "n")', 'end-of-previous-word']
nnoremap ge ge
let g:_spacevim_mappings_g['<'] = ['call feedkeys("g<", "n")', 'last page of previous command output']
let g:_spacevim_mappings_g['<'] = ['call feedkeys("g<", "n")', 'last-page-of-previous-command-output']
nnoremap g< g<
let g:_spacevim_mappings_g['f'] = ['call feedkeys("gf", "n")', 'edit file under cursor']
let g:_spacevim_mappings_g['f'] = ['call feedkeys("gf", "n")', 'edit-file-under-cursor']
nnoremap gf gf
let g:_spacevim_mappings_g['F'] = ['call feedkeys("gF", "n")', 'edit file withline under cursor']
let g:_spacevim_mappings_g['F'] = ['call feedkeys("gF", "n")', 'edit-file-withline-under-cursor']
nnoremap gF gF
let g:_spacevim_mappings_g['j'] = ['call feedkeys("gj", "n")', 'move cursor down screen line']
let g:_spacevim_mappings_g['j'] = ['call feedkeys("gj", "n")', 'move-cursor-down-screen-line']
nnoremap gj gj
let g:_spacevim_mappings_g['k'] = ['call feedkeys("gk", "n")', 'move cursor up screen line']
let g:_spacevim_mappings_g['k'] = ['call feedkeys("gk", "n")', 'move-cursor-up-screen-line']
nnoremap gk gk
let g:_spacevim_mappings_g['u'] = ['call feedkeys("gu", "n")', 'make motion text lowercase']
let g:_spacevim_mappings_g['u'] = ['call feedkeys("gu", "n")', 'make-motion-text-lowercase']
nnoremap gu gu
let g:_spacevim_mappings_g['E'] = ['call feedkeys("gE", "n")', 'end of previous word']
let g:_spacevim_mappings_g['E'] = ['call feedkeys("gE", "n")', 'end-of-previous-word']
nnoremap gE gE
let g:_spacevim_mappings_g['U'] = ['call feedkeys("gU", "n")', 'make motion text uppercase']
let g:_spacevim_mappings_g['U'] = ['call feedkeys("gU", "n")', 'make-motion-text-uppercase']
nnoremap gU gU
let g:_spacevim_mappings_g['H'] = ['call feedkeys("gH", "n")', 'select line mode']
let g:_spacevim_mappings_g['H'] = ['call feedkeys("gH", "n")', 'select-line-mode']
nnoremap gH gH
let g:_spacevim_mappings_g['h'] = ['call feedkeys("gh", "n")', 'select mode']
let g:_spacevim_mappings_g['h'] = ['call feedkeys("gh", "n")', 'select-mode']
nnoremap gh gh
let g:_spacevim_mappings_g['I'] = ['call feedkeys("gI", "n")', 'insert text in column 1']
let g:_spacevim_mappings_g['I'] = ['call feedkeys("gI", "n")', 'insert-text-in-column-1']
nnoremap gI gI
let g:_spacevim_mappings_g['i'] = ['call feedkeys("gi", "n")', "insert text after '^ mark"]
let g:_spacevim_mappings_g['i'] = ['call feedkeys("gi", "n")', "insert-text-after-'^-mark"]
nnoremap gi gi
let g:_spacevim_mappings_g['J'] = ['call feedkeys("gJ", "n")', 'join lines without space']
let g:_spacevim_mappings_g['J'] = ['call feedkeys("gJ", "n")', 'join-lines-without-space']
nnoremap gJ gJ
let g:_spacevim_mappings_g['N'] = ['call feedkeys("gN", "n")', 'visually select previous match']
let g:_spacevim_mappings_g['N'] = ['call feedkeys("gN", "n")', 'visually-select-previous-match']
nnoremap gN gN
let g:_spacevim_mappings_g['n'] = ['call feedkeys("gn", "n")', 'visually select next match']
let g:_spacevim_mappings_g['n'] = ['call feedkeys("gn", "n")', 'visually-select-next-match']
nnoremap gn gn
let g:_spacevim_mappings_g['Q'] = ['call feedkeys("gQ", "n")', 'switch to Ex mode']
let g:_spacevim_mappings_g['Q'] = ['call feedkeys("gQ", "n")', 'switch-to-Ex-mode']
nnoremap gQ gQ
let g:_spacevim_mappings_g['q'] = ['call feedkeys("gq", "n")', 'format Nmove text']
let g:_spacevim_mappings_g['q'] = ['call feedkeys("gq", "n")', 'format-Nmove-text']
nnoremap gq gq
let g:_spacevim_mappings_g['R'] = ['call feedkeys("gR", "n")', 'enter VREPLACE mode']
let g:_spacevim_mappings_g['R'] = ['call feedkeys("gR", "n")', 'enter-VREPLACE-mode']
nnoremap gR gR
let g:_spacevim_mappings_g['T'] = ['call feedkeys("gT", "n")', 'previous tag page']
let g:_spacevim_mappings_g['T'] = ['call feedkeys("gT", "n")', 'previous-tag-page']
nnoremap gT gT
let g:_spacevim_mappings_g['t'] = ['call feedkeys("gt", "n")', 'next tag page']
let g:_spacevim_mappings_g['t'] = ['call feedkeys("gt", "n")', 'next-tag-page']
nnoremap gt gt
let g:_spacevim_mappings_g[']'] = ['call feedkeys("g]", "n")', 'tselect cursor tag']
let g:_spacevim_mappings_g[']'] = ['call feedkeys("g]", "n")', 'tselect-cursor-tag']
nnoremap g] g]
let g:_spacevim_mappings_g['^'] = ['call feedkeys("g^", "n")', 'go to leftmost no-white character']
let g:_spacevim_mappings_g['^'] = ['call feedkeys("g^", "n")', 'go-to-leftmost-no-white-character']
nnoremap g^ g^
let g:_spacevim_mappings_g['_'] = ['call feedkeys("g_", "n")', 'go to last char']
let g:_spacevim_mappings_g['_'] = ['call feedkeys("g_", "n")', 'go-to-last-char']
nnoremap g_ g_
let g:_spacevim_mappings_g['~'] = ['call feedkeys("g~", "n")', 'swap case for Nmove text']
let g:_spacevim_mappings_g['~'] = ['call feedkeys("g~", "n")', 'swap-case-for-Nmove-text']
nnoremap g~ g~
let g:_spacevim_mappings_g['a'] = ['call feedkeys("ga", "n")', 'print ascii value of cursor character']
let g:_spacevim_mappings_g['a'] = ['call feedkeys("ga", "n")', 'print-ascii-value-of-cursor-character']
nnoremap ga ga
let g:_spacevim_mappings_g['g'] = ['call feedkeys("gg", "n")', 'go to line N']
let g:_spacevim_mappings_g['g'] = ['call feedkeys("gg", "n")', 'go-to-line-N']
nnoremap gg gg
let g:_spacevim_mappings_g['m'] = ['call feedkeys("gm", "n")', 'go to middle of screenline']
let g:_spacevim_mappings_g['m'] = ['call feedkeys("gm", "n")', 'go-to-middle-of-screenline']
nnoremap gm gm
let g:_spacevim_mappings_g['o'] = ['call feedkeys("go", "n")', 'goto byte N in the buffer']
let g:_spacevim_mappings_g['o'] = ['call feedkeys("go", "n")', 'goto-byte-N-in-the buffer']
nnoremap go go
let g:_spacevim_mappings_g.s = ['call feedkeys("gs", "n")', 'sleep N seconds']
let g:_spacevim_mappings_g.s = ['call feedkeys("gs", "n")', 'sleep-N-seconds']
nnoremap gs gs
let g:_spacevim_mappings_g['v'] = ['call feedkeys("gv", "n")', 'reselect the previous Visual area']
let g:_spacevim_mappings_g['v'] = ['call feedkeys("gv", "n")', 'reselect-the-previous-Visual-area']
nnoremap gv gv
let g:_spacevim_mappings_g['<C-]>'] = ['call feedkeys("g<c-]>", "n")', 'jump to tag under cursor']
let g:_spacevim_mappings_g['<C-]>'] = ['call feedkeys("g<c-]>", "n")', 'jump-to-tag-under-cursor']
nnoremap g<c-]> g<c-]>
let g:_spacevim_mappings_g['d'] = ['call SpaceVim#mapping#gd()', 'goto definition']
let g:_spacevim_mappings_g['d'] = ['call SpaceVim#mapping#gd()', 'goto-definition']
call SpaceVim#mapping#def('nnoremap <silent>', 'gd', ':call SpaceVim#mapping#gd()<CR>', 'Goto declaration', '')
let g:_spacevim_mappings_g['='] = ['call SpaceVim#mapping#format()', 'format-current-buffer']
call SpaceVim#mapping#def('nnoremap <silent>','g=',':call SpaceVim#mapping#format()<cr>','format current buffer','call SpaceVim#mapping#format()')
" Tabs
nnoremap <silent>g0 :<C-u>tabfirst<CR>
let g:_spacevim_mappings_g['0'] = ['tabfirst', 'jump to first tab']
let g:_spacevim_mappings_g['0'] = ['tabfirst', 'jump-to-first-tab']
" Select last paste
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
let g:_spacevim_mappings_g['p'] = ["exe 'normal! ' . '`['.strpart(getregtype(), 0, 1).'`]'", 'select-last-paste']
nnoremap <silent>g$ :<C-u>tablast<CR>
let g:_spacevim_mappings_g['$'] = ['tablast', 'jump to last tab']
let g:_spacevim_mappings_g['$'] = ['tablast', 'jump-to-last-tab']
nnoremap <silent><expr> gr tabpagenr('#') > 0 ? ':exe "tabnext " . tabpagenr("#")<cr>' : ''
let g:_spacevim_mappings_g['r'] = ['call call('
\ . string(s:_function('s:preview_tab')) . ', [])', 'jump to preview tab']
\ . string(s:_function('s:preview_tab')) . ', [])', 'jump-to-preview-tab']
endfunction
function! s:preview_tab() abort