upwing 2014-10-18
1. 通过fdm实现代码折叠:set fdm=xxx
有以下6种方式实现折叠:
|fold-manual| manual Folds are created manually.
|fold-indent| indent Lines with equal indent form a fold.
|fold-expr| expr 'foldexpr' gives the fold level of a line.
|fold-marker| marker Markers are used to specify folds.
|fold-syntax| syntax Syntax highlighting items specify folds.
|fold-diff| diff Fold text that is not changed. 2. 如下配置set fdm=syntax以语法块实现折叠:
[root@~/wade/codeReview/redis-2.8.17/src]# cat ~/.vimrc
set nocompatible
set nu
"" ctags
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
"" taglist
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
nnoremap <F8> :TlistToggle<CR>
"" 代码折叠
set fdm=syntax3. 折叠基本快捷键说明:
zc 折叠
zC 对所在范围内所有嵌套的折叠点进行折叠
zo 展开折叠
zO 对所在范围内所有嵌套的折叠点展开
[z 到当前打开的折叠的开始处
]z 到当前打开的折叠的末尾处
zj 向下移动。到达下一个折叠的开始处。关闭的折叠也被计入
zk 向上移动到前一折叠的结束处。关闭的折叠也被计入
--------------------------------------分割线 --------------------------------------
--------------------------------------分割线 --------------------------------------