手机版
你好,游客 登录 注册
背景:
阅读新闻

Vim代码折叠命令简介

[日期:2014-10-19] 来源:Linux社区  作者:zhanhailiang [字体: ]

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    向上移动到前一折叠的结束处。关闭的折叠也被计入

--------------------------------------分割线 --------------------------------------

把VIM打造成一个简单实用的IDE http://www.linuxidc.com/Linux/2011-06/37032.htm

Vim学习指南 http://www.linuxidc.com/Linux/2013-08/89096.htm

快速学会 Vi编辑器 http://www.linuxidc.com/Linux/2013-08/88586.htm

强大的Vim 编辑器 http://www.linuxidc.com/Linux/2013-07/87544.htm

CentOS 6.2上搭建Vim开发环境 http://www.linuxidc.com/Linux/2013-07/87363.htm

CentOS 5.4 安装高亮Vim编辑工具 http://www.linuxidc.com/Linux/2013-06/86508.htm

Vim技巧分享:C语言设置 http://www.linuxidc.com/Linux/2012-12/77124.htm

Ubuntu中设置Vim的行号 http://www.linuxidc.com/Linux/2012-12/75485.htm

Vim编辑器使用基础教程 http://www.linuxidc.com/Linux/2013-05/84031.htm

--------------------------------------分割线 --------------------------------------

本文永久更新链接地址http://www.linuxidc.com/Linux/2014-10/108204.htm

linux
相关资讯       Vim命令  Vim代码折叠 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款