mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-15 08:09:11 +08:00
Merge pull request #225 from ZSaberLv0/dev
add "fold by regexp" and "cursor move by indent"
This commit is contained in:
commit
c6e4bd7256
21
autoload/SpaceVim/layers/cursor_move_by_indent.vim
Normal file
21
autoload/SpaceVim/layers/cursor_move_by_indent.vim
Normal 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
|
||||
|
29
autoload/SpaceVim/layers/fold_by_regexp.vim
Normal file
29
autoload/SpaceVim/layers/fold_by_regexp.vim
Normal 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user