mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 22:30:04 +08:00
commit
5a41e3d838
13
.SpaceVim.d/autoload/SpaceVim/dev/g.vim
Normal file
13
.SpaceVim.d/autoload/SpaceVim/dev/g.vim
Normal file
@ -0,0 +1,13 @@
|
||||
function! SpaceVim#dev#g#updatedoc()
|
||||
let keys = keys(g:_spacevim_mappings_g)
|
||||
let lines = []
|
||||
for key in keys
|
||||
if key == '`'
|
||||
let line = '`` g' . key . ' `` | ' . g:_spacevim_mappings_g[key][1]
|
||||
else
|
||||
let line = '`g' . key . '` | ' . g:_spacevim_mappings_g[key][1]
|
||||
endif
|
||||
call add(lines, line)
|
||||
endfor
|
||||
call append(line('.'), lines)
|
||||
endfunction
|
@ -459,6 +459,7 @@ function! SpaceVim#end() abort
|
||||
call SpaceVim#mapping#leader#defindglobalMappings()
|
||||
call SpaceVim#mapping#leader#defindKEYs()
|
||||
call SpaceVim#mapping#space#init()
|
||||
call SpaceVim#mapping#g#init()
|
||||
if !SpaceVim#mapping#guide#has_configuration()
|
||||
let g:leaderGuide_map = {}
|
||||
call SpaceVim#mapping#guide#register_prefix_descriptions('', 'g:leaderGuide_map')
|
||||
|
@ -301,8 +301,6 @@ function! SpaceVim#default#SetMappings() abort
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'q', ':<C-u>call zvim#util#SmartClose()<cr>',
|
||||
\ 'Smart close windows',
|
||||
\ 'call zvim#util#SmartClose()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'gf', ':call zvim#gf()<CR>', 'Jump to a file under cursor', '')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'gd', ':call SpaceVim#mapping#gd()<CR>', 'Goto declaration', '')
|
||||
endfunction
|
||||
|
||||
fu! s:tobur(num) abort
|
||||
|
101
autoload/SpaceVim/mapping/g.vim
Normal file
101
autoload/SpaceVim/mapping/g.vim
Normal file
@ -0,0 +1,101 @@
|
||||
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']
|
||||
nnoremap g<c-g> g<c-g>
|
||||
let g:_spacevim_mappings_g['&'] = ['call feedkeys("g&", "n")', 'repeat last ":s" on all lines']
|
||||
nnoremap g& g&
|
||||
|
||||
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']
|
||||
nnoremap g` g`
|
||||
|
||||
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']
|
||||
nnoremap g- g-
|
||||
let g:_spacevim_mappings_g[','] = ['call feedkeys("g,", "n")', 'newer position in change list']
|
||||
nnoremap g, g,
|
||||
let g:_spacevim_mappings_g[';'] = ['call feedkeys("g;", "n")', 'older position in change list']
|
||||
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']
|
||||
nnoremap g$ g$
|
||||
let g:_spacevim_mappings_g['<End>'] = ['call feedkeys("g$", "n")', 'go to rightmost character']
|
||||
nnoremap g<End> g<End>
|
||||
let g:_spacevim_mappings_g['0'] = ['call feedkeys("g0", "n")', 'go to leftmost character']
|
||||
nnoremap g0 g0
|
||||
let g:_spacevim_mappings_g['<Home>'] = ['call feedkeys("g0", "n")', 'go to leftmost character']
|
||||
nnoremap g<Home> g<Home>
|
||||
let g:_spacevim_mappings_g['e'] = ['call feedkeys("ge", "n")', 'go to end of previous word']
|
||||
nnoremap ge ge
|
||||
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']
|
||||
nnoremap gf gf
|
||||
let g:_spacevim_mappings_g['F'] = ['call feedkeys("gF", "n")', 'edit file under cursor(jump to line after name)']
|
||||
nnoremap gF gF
|
||||
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']
|
||||
nnoremap gk gk
|
||||
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']
|
||||
nnoremap gE gE
|
||||
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']
|
||||
nnoremap gH gH
|
||||
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']
|
||||
nnoremap gI gI
|
||||
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']
|
||||
nnoremap gJ gJ
|
||||
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']
|
||||
nnoremap gn gn
|
||||
let g:_spacevim_mappings_g['Q'] = ['call feedkeys("gQ", "n")', 'switch to Ex mode']
|
||||
nnoremap gQ gQ
|
||||
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']
|
||||
nnoremap gT gT
|
||||
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']
|
||||
nnoremap g] g]
|
||||
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']
|
||||
nnoremap g_ g_
|
||||
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']
|
||||
nnoremap ga ga
|
||||
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']
|
||||
nnoremap gm gm
|
||||
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']
|
||||
nnoremap gs gs
|
||||
|
||||
|
||||
|
||||
|
||||
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', '')
|
||||
|
||||
|
||||
endfunction
|
@ -365,8 +365,12 @@ function! s:wait_for_input() " {{{
|
||||
let fsel = get(s:lmap, inp)
|
||||
if !empty(fsel)
|
||||
let s:prefix_key_inp = inp
|
||||
call s:handle_input(fsel)
|
||||
else
|
||||
let s:prefix_key_inp = ''
|
||||
call s:winclose()
|
||||
doautocmd WinEnter
|
||||
endif
|
||||
call s:handle_input(fsel)
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! s:winopen() " {{{
|
||||
@ -467,9 +471,9 @@ function! s:handle_submode_mapping(cmd) " {{{
|
||||
elseif a:cmd ==? '<LGCMD>win_close'
|
||||
call s:winclose()
|
||||
else
|
||||
call feedkeys("\<c-c>", "n")
|
||||
redraw!
|
||||
call s:wait_for_input()
|
||||
call feedkeys("\<c-c>", "n")
|
||||
redraw!
|
||||
call s:wait_for_input()
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! s:submode_mappings() " {{{
|
||||
@ -568,6 +572,10 @@ call SpaceVim#mapping#guide#register_prefix_descriptions(
|
||||
call SpaceVim#mapping#guide#register_prefix_descriptions(
|
||||
\ '[KEYs]',
|
||||
\ 'g:_spacevim_mappings_prefixs')
|
||||
|
||||
call SpaceVim#mapping#guide#register_prefix_descriptions(
|
||||
\ 'g',
|
||||
\ 'g:_spacevim_mappings_g')
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
|
@ -291,6 +291,8 @@ function! SpaceVim#mapping#leader#getName(key) abort
|
||||
return '[denite]'
|
||||
elseif a:key == ' '
|
||||
return '[SPC]'
|
||||
elseif a:key == 'g'
|
||||
return '[g]'
|
||||
else
|
||||
return '<leader>'
|
||||
endif
|
||||
|
@ -64,6 +64,7 @@ title: "Documentation"
|
||||
* [File tree](#file-tree)
|
||||
* [File tree navigation](#file-tree-navigation)
|
||||
* [Open file with file tree.](#open-file-with-file-tree)
|
||||
* [Commands starting with `g`](#commands-starting-with-g)
|
||||
* [Auto-saving](#auto-saving)
|
||||
* [Searching](#searching)
|
||||
* [Editing](#editing)
|
||||
@ -855,6 +856,59 @@ Key Binding | Description
|
||||
`sg` | open file in an vertically split window
|
||||
`sv` | open file in an horizontally split window
|
||||
|
||||
### Commands starting with `g`
|
||||
|
||||
after pressing prefix `g` in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with `g`.
|
||||
|
||||
Key Binding | Description
|
||||
-----------| -----------
|
||||
`g#` | search under cursor backward
|
||||
`g$` | go to rightmost character
|
||||
`g&` | repeat last ":s" on all lines
|
||||
`g'` | jump to mark
|
||||
`g*` | search under cursor forward
|
||||
`g+` | newer text state
|
||||
`g,` | newer position in change list
|
||||
`g-` | older text state
|
||||
`g/` | stay incsearch
|
||||
`g0` | go to leftmost character
|
||||
`g;` | older position in change list
|
||||
`g<` | last page of previous command output
|
||||
`g<Home>` | go to leftmost character
|
||||
`gE` | end of previous word
|
||||
`gF` | edit file under cursor(jump to line after name)
|
||||
`gH` | select line mode
|
||||
`gI` | insert text in column 1
|
||||
`gJ` | join lines without space
|
||||
`gN` | visually select previous match
|
||||
`gQ` | switch to Ex mode
|
||||
`gR` | enter VREPLACE mode
|
||||
`gT` | previous tag page
|
||||
`gU` | make motion text uppercase
|
||||
`g]` | tselect cursor tag
|
||||
`g^` | go to leftmost no-white character
|
||||
`g_` | go to last char
|
||||
`` g` `` | jump to mark
|
||||
`ga` | print ascii value of cursor character
|
||||
`gd` | goto definition
|
||||
`ge` | go to end of previous word
|
||||
`gf` | edit file under cursor
|
||||
`gg` | go to line N
|
||||
`gh` | select mode
|
||||
`gi` | insert text after '^ mark
|
||||
`gj` | move cursor down screen line
|
||||
`gk` | move cursor up screen line
|
||||
`gm` | go to middle of screenline
|
||||
`gn` | visually select next match
|
||||
`go` | goto byte N in the buffer
|
||||
`gs` | sleep N seconds
|
||||
`gt` | next tag page
|
||||
`gu` | make motion text lowercase
|
||||
`g~` | swap case for Nmove text
|
||||
`g<End>` | go to rightmost character
|
||||
`g<C-G>` | show cursor info
|
||||
|
||||
|
||||
### Auto-saving
|
||||
|
||||
### Searching
|
||||
|
Loading…
Reference in New Issue
Block a user