vim as a IDE

构造 c++ IDE(linux)

作者: blueoceanli   来 源: 博客园   发布时 间:2009-04-27 11:58  阅读:172 次   原文链接    [收藏]   

(修改~/.vimrc,没有创建之)
set encoding=utf-8
syntax enable
syntax on
filetype on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set cindent
set autoindent
filetype plugin indent on

1.Alternate (http://www.vim.org/scripts/script.php?script_id=31 )
在 对应的头文件和代码文件中快速地切换
cp a.vim ~/.vim/plugin(没有此目录创建之)

2.ctags(自带的都有)
最方便的功能是把光标定位在某个变量或函数,按下Ctrl+],这样vim就能直接跳到这个变量或函数定义的 源文件中,Ctrl+T是Ctrl+]的反操作,可以退回原来的地方,我们可以连续按N次Ctrl+]查找变量或函数,然后再按N次Ctrl+T返回开始 的地方.
(统一使用:ctags -R --c++-kinds=+p --fields=+iaS --extra=+q)

3.taglist (http://www.vim.org/scripts/script.php?script_id=273 )
用 于浏览文件,结构体等.
cd ~/.vim
unzip taglist.zip

4.OmniCppComplete (http://www.vim.org/scripts/script.php?script_id=1520 )
自 动补全.
cd ~/.vim
unzip OmniCppComplete_sample.zip
~/.vimrc中需有如下设置
set nocp
filetype plugin on
set completeopt=menu
运行vim,插件已经自动加载,需手 动把插件文档加入vim help中:
:helptags ~/.vim/doc
打开omnicppcomplete帮助确认安装成功
:h omnicppcomplete
下载STL (http://www.sgi.com/tech/stl/download.html )到/tmp中
(生成C++头文件tags,特别使用 ctags -f ~/.vim/stltags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=c++ /tmp/*
set tags+=~/.vim/stltags)

5.Supretab (http://www.vim.org/scripts/script.php?script_id=1643 )
按 下tab键完成insert completion (:help ins-completion),与omnicppcomplete配合使用,效果更佳
cp supertab.vim ~/.vim/plugin

6.c.vim (http://www.vim.org/scripts/script.php?script_id=213 )
a. 用于生成注释文件
b. 用于生成main函数
c. 用于注释和解注释语句,方便调试
d. 用于插入函数,格式化函数.
cd ~/.vim
unzip cvim.zip

7.code_complete.vim(http://www.vim.org/scripts/script.php?script_id=1764 ). 关注 snipMate  && SnippetsEmu.
代码片断, 省事不少啊.
cp code_complete.vim ~/.vim/plugin
(统一使用:ctags -R --c++-kinds=+p --fields=+iaS --extra=+q)

8.echofunc.vim (http://www.vim.org/scripts/script.php?script_id=1735 )
When you type ‘(‘ after a function name in insert mode, the function declaration will be displayed in the command line automatically. Then use Alt+-, Alt+= to cycle between function declarations (if exists)
cp echofunc.vim !/.vim/plugin
(统一使用:ctags -R --c++-kinds=+p --fields=+iaS --extra=+q)

9.NERD_tree(http://www.vim.org/scripts/script.php?script_id=1658
NERD tree允许你在Vim编辑器中以树状方式浏览系统中的文件和目录,支持快捷键与鼠标操作,使用起来十分方便。NERD tree能够以不同颜色高亮显示节点类型,并包含书签、过滤等实用功能。
cd ~/.vim
unzip NERD_tree.zip

10.NERD Commenter (http://www.vim.org/scripts/script.php?script_id=1218
是 一个非常棒的给程序增减注释的plugin.
cd ~/.vim
unzip NERD_commenter.zip

11.lookupfile (http://www.vim.org/scripts/script.php?script_id=1581 )
需 要genutils (http://www.vim.org/scripts/script.php?script_id=197 )

12.vimball && GetLatestScript(关注)

 

 

上面说了很多插件,但是要注意vimrc文件的配置,里面的配置不对是没法发挥这些插件的功能

我贴一个我的vimrc文件,大家懂的,我就不解析了

set encoding=utf-8
syntax enable
syntax on
filetype on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set cindent
set autoindent
set number
filetype plugin indent on
set nocp
filetype plugin on
set completeopt=menu
map <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .
set path=~/public/imageproc

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值