1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 03:10:06 +08:00

Add some mappings with z prefix

This commit is contained in:
wsdjeg 2017-06-27 14:16:07 +08:00
parent 7b09c2b77a
commit 3ade552032
2 changed files with 74 additions and 1 deletions

View File

@ -2,6 +2,18 @@ function! SpaceVim#mapping#z#init() abort "{{{
nnoremap <silent><nowait> [z] :<c-u>LeaderGuide "z"<CR>
nmap z [z]
let g:_spacevim_mappings_z = {}
let g:_spacevim_mappings_z['<CR>'] = ['call feedkeys("z\<CR>", "n")', 'cursor line to top']
nnoremap z<CR> z<CR>
let g:_spacevim_mappings_z['+'] = ['call feedkeys("z+", "n")', 'cursor to screen top line N']
nnoremap z+ z+
let g:_spacevim_mappings_z['-'] = ['call feedkeys("z-", "n")', 'cursor to screen bottom line N']
nnoremap z- z-
let g:_spacevim_mappings_z['^'] = ['call feedkeys("z^", "n")', 'cursor to screen bottom line N']
nnoremap z^ z^
let g:_spacevim_mappings_z['.'] = ['call feedkeys("z.", "n")', 'cursor line to center']
nnoremap z. z.
let g:_spacevim_mappings_z['='] = ['call feedkeys("z=", "n")', 'spelling suggestions']
nnoremap z= z=
let g:_spacevim_mappings_z['A'] = ['call feedkeys("zA", "n")', 'toggle folds recursively']
nnoremap zA zA
let g:_spacevim_mappings_z['C'] = ['call feedkeys("zC", "n")', 'close folds recursively']
@ -14,6 +26,10 @@ function! SpaceVim#mapping#z#init() abort "{{{
nnoremap zF zF
let g:_spacevim_mappings_z['G'] = ['call feedkeys("zG", "n")', 'mark good spelled(update internal-wordlist)']
nnoremap zG zG
let g:_spacevim_mappings_z['H'] = ['call feedkeys("zH", "n")', 'scroll half a screenwidth to the right']
nnoremap zH zH
let g:_spacevim_mappings_z['L'] = ['call feedkeys("zL", "n")', 'scroll half a screenwidth to the left']
nnoremap zL zL
let g:_spacevim_mappings_z['M'] = ['call feedkeys("zM", "n")', 'set `foldlevel` to zero']
nnoremap zM zM
let g:_spacevim_mappings_z['N'] = ['call feedkeys("zN", "n")', 'set `foldenable`']
@ -34,14 +50,26 @@ function! SpaceVim#mapping#z#init() abort "{{{
nnoremap zc zc
let g:_spacevim_mappings_z['d'] = ['call feedkeys("zd", "n")', 'delete a fold']
nnoremap zd zd
let g:_spacevim_mappings_z['e'] = ['call feedkeys("ze", "n")', 'right scroll horizontally to cursor position']
nnoremap ze ze
let g:_spacevim_mappings_z['f'] = ['call feedkeys("zf", "n")', 'create a fold for motion']
nnoremap zf zf
let g:_spacevim_mappings_z['g'] = ['call feedkeys("zg", "n")', 'mark good spelled']
nnoremap zg zg
let g:_spacevim_mappings_z['h'] = ['call feedkeys("zh", "n")', 'scroll screen N characters to right']
nnoremap zh zh
let g:_spacevim_mappings_z['<Left>'] = ['call feedkeys("zh", "n")', 'scroll screen N characters to right']
nnoremap z<Left> zh
let g:_spacevim_mappings_z['i'] = ['call feedkeys("zi", "n")', 'toggle foldenable']
nnoremap zi zi
let g:_spacevim_mappings_z['j'] = ['call feedkeys("zj", "n")', 'mode to start of next fold']
nnoremap zj zj
let g:_spacevim_mappings_z['k'] = ['call feedkeys("zk", "n")', 'mode to end of previous fold']
nnoremap zk zk
let g:_spacevim_mappings_z['l'] = ['call feedkeys("zl", "n")', 'scroll screen N characters to left']
nnoremap zl zl
let g:_spacevim_mappings_z['<Right>'] = ['call feedkeys("zl", "n")', 'scroll screen N characters to left']
nnoremap z<Right> zl
let g:_spacevim_mappings_z['m'] = ['call feedkeys("zm", "n")', 'subtract one from `foldlevel`']
nnoremap zm zm
let g:_spacevim_mappings_z['n'] = ['call feedkeys("zn", "n")', 'reset `foldenable`']
@ -50,6 +78,14 @@ function! SpaceVim#mapping#z#init() abort "{{{
nnoremap zo zo
let g:_spacevim_mappings_z['r'] = ['call feedkeys("zr", "n")', 'add one to `foldlevel`']
nnoremap zr zr
let g:_spacevim_mappings_z.s = ['call feedkeys("zs", "n")', 'left scroll horizontally to cursor position']
nnoremap zs zs
let g:_spacevim_mappings_z['t'] = ['call feedkeys("zt", "n")', 'cursor line at top of window']
nnoremap zt zt
let g:_spacevim_mappings_z['v'] = ['call feedkeys("zv", "n")', 'open enough folds to view cursor line']
nnoremap zv zv
let g:_spacevim_mappings_z['x'] = ['call feedkeys("zx", "n")', 're-apply foldlevel and do "zV"']
nnoremap zx zx
" smart scroll
let g:_spacevim_mappings_z['z'] = ['call feedkeys("zz", "n")', 'smart scroll']
nnoremap zz zz

View File

@ -924,12 +924,49 @@ after pressing prefix `z` in normal mode, if you do not remember the mappings, y
Key Binding | Description
-----------| -----------
`z<Right>` | scroll screen N characters to left
`z+` | cursor to screen top line N
`z-` | cursor to screen bottom line N
`z.` | cursor line to center
`z<CR>` | cursor line to top
`z=` | spelling suggestions
`zA` | toggle folds recursively
`zC` | close folds recursively
`zD` | delete folds recursively
`zE` | eliminate all folds
`zF` | create a fold for N lines
`zG` | mark good spelled
`zG` | mark good spelled(update internal-wordlist)
`zH` | scroll half a screenwidth to the right
`zL` | scroll half a screenwidth to the left
`zM` | set `foldlevel` to zero
`zN` | set `foldenable`
`zO` | open folds recursively
`zR` | set `foldlevel` to deepest fold
`zW` | mark wrong spelled
`zX` | re-apply `foldleve`
`z^` | cursor to screen bottom line N
`za` | toggle a fold
`zb` | redraw, cursor line at bottom
`zc` | close a fold
`zd` | delete a fold
`ze` | right scroll horizontally to cursor position
`zf` | create a fold for motion
`zg` | mark good spelled
`zh` | scroll screen N characters to right
`zi` | toggle foldenable
`zj` | mode to start of next fold
`zk` | mode to end of previous fold
`zl` | scroll screen N characters to left
`zm` | subtract one from `foldlevel`
`zn` | reset `foldenable`
`zo` | open fold
`zr` | add one to `foldlevel`
`zs` | left scroll horizontally to cursor position
`zt` | cursor line at top of window
`zv` | open enough folds to view cursor line
`zx` | re-apply foldlevel and do "zV"
`zz` | smart scroll
`z<Left>` | scroll screen N characters to right
### Auto-saving