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

add "fold by regexp" and "cursor move by indent"

This commit is contained in:
ZSaberLv0 2017-02-10 22:44:59 +08:00
parent 2b4cc95914
commit 07f9078566
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,21 @@
function! SpaceVim#layers#cursor_move_by_indent#plugins() abort
return [
\ ['ZSaberLv0/ZFVimIndentMove'],
\ ]
endfunction
function! SpaceVim#layers#cursor_move_by_indent#config() abort
nnoremap E <nop>
nnoremap EE ``
nnoremap EH :call ZF_IndentMoveParent('n')<cr>
xnoremap EH :<c-u>call ZF_IndentMoveParent('v')<cr>
nnoremap EL :call ZF_IndentMoveParentEnd('n')<cr>
xnoremap EL :<c-u>call ZF_IndentMoveParentEnd('v')<cr>
nnoremap EK :call ZF_IndentMovePrev('n')<cr>
xnoremap EK :<c-u>call ZF_IndentMovePrev('v')<cr>
nnoremap EJ :call ZF_IndentMoveNext('n')<cr>
xnoremap EJ :<c-u>call ZF_IndentMoveNext('v')<cr>
nnoremap EI :call ZF_IndentMoveChild('n')<cr>
xnoremap EI :<c-u>call ZF_IndentMoveChild('v')<cr>
endfunction

View File

@ -0,0 +1,29 @@
function! SpaceVim#layers#fold_by_regexp#plugins() abort
return [
\ ['ZSaberLv0/ZFVimFoldBlock'],
\ ]
endfunction
function! SpaceVim#layers#fold_by_regexp#config() abort
nnoremap ZB q::call ZF_FoldBlockTemplate()<cr>
nnoremap ZF :ZFFoldBlock //<left>
function! ZF_Plugin_ZFVimFoldBlock_comment()
let expr='\(^\s*\/\/\)'
if &filetype=='vim'
let expr.='\|\(^\s*"\)'
endif
if &filetype=='c' || &filetype=='cpp'
let expr.='\|\(^\s*\(\(\/\*\)\|\(\*\)\)\)'
endif
if &filetype=='make'
let expr.='\|\(^\s*#\)'
endif
let disableE2vSaved = g:ZFVimFoldBlock_disableE2v
let g:ZFVimFoldBlock_disableE2v = 1
call ZF_FoldBlock("/" . expr . "//")
let g:ZFVimFoldBlock_disableE2v = disableE2vSaved
echo "comments folded"
endfunction
nnoremap ZC :call ZF_Plugin_ZFVimFoldBlock_comment()<cr>
endfunction