vim 插件

Ctags的使用

下载地址:http://ctags.sourceforge.net
解压下载包 ctags-5.8.tar.gz
解压命令 tar -xzvf ctags-5.8.tar.gz
在解压文件夹下执行命令 ./configure 生成 makefile 后执行 make 生成 ctags 执行文件
然后把生成的 ctags 命令放入 /bin/ 下面
这样就可以通过命令 ctags -R(命令应该在工程环境的目录或者父目录中) 自动为工程生成 tags 了
不过还有一个小瑕疵, 你修改程序后, 比如增加了函数定义, 删除了变量定义, tags文件不能自动rebuild, 你必须手动再运行一下命令:
$ ctags -R
ctags 使用说明参考链接: http://blog.xuyu.org/?p=1082

taglist

下载地址 http://www.vim.org/scripts/script.php?script_id=273
手册:help taglist.txt
下载包在 ~/.vimrc 或者 $VIM/vimfiles 下解压
后在 vimrc 中添加如几句话句话:

let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
set tags=tags
set autochir

后打开 vim 在命令行模式下输入 :Tlist 就可以看 taglist 的窗口了

NERDTree

下载地址 http://www.vim.org/scripts/script.php?script_id=1658
下载包在 ~/.vimrc 或者 $VIM/vimfiles 下解压
后打开 vim 在命令行模式下输入 :NERDTree 就是可以看到文件树结构的窗口了

WinManager

下载地址 http://www.vim.org/scripts/script.php?script_id=95
下载包在 ~/.vimrc 或者 $VIM/vimfiles 下解压
手册  :help winmanager
后在 vimrc 中加:

let g:winManagerWindowLayout='FileExplorer|TagList,NERDTree'
nmap wm :WMToggle<cr>

cvim

下载地址 http://www.vim.org/scripts/script.php?script_id=213
下载包在 ~/.vimrc 或者 $VIM/vimfiles 下解压

cpp.vim

作用: 加强c/c++类名, 函数等高亮

下载地址: http://www.vim.org/scripts/script.php?script_id=1640

安装方法: 把 cpp.vim 放置到 syntax 目录下

自动补全插件 omincppcomplete

下载地址 http://www.vim.org/scripts/script.php?script_id=1520

对 vimrc 的设置加入
filetype plugin on   "开启插件
set nocp               "关闭兼容模式
set completeopt=menu,menuone 
let OmniCpp_MayCompleteDot = 1 " autocomplete with . 
let OmniCpp_MayCompleteArrow = 1 " autocomplete with -> 
let OmniCpp_MayCompleteScope = 1 " autocomplete with :: 
let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert) 
let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files 
let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype in popup window 
let OmniCpp_GlobalScopeSearch=1 
let OmniCpp_DisplayMode=1 
let OmniCpp_DefaultNamespaces=["std"]

在生成 ctags 生成 tags 时候记得加参数命令如下,生成的 tags 有类的继承信息和成员信息

  • ctags -R --c++-kinds=+p --fields=+iaS --extra=+q

也可以在 vimrc 建立映射

  • nmap tags :w<cr>!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q<cr><cr>

说明:

  • --c++-kinds=+p : 为标签添加函数原型(prototype)信息
  • --fields=+iaS : 为标签添加继承信息(inheritance),访问控制(access)信息,函数特征(function Signature,如参数表或原型等)
  • --extra=+q : 为类成员标签添加类标识

相关插件说明文章

http://blog.xuyu.org/?p=1207


a.vim 在头文件与cpp文件中跳转

下载地址: http://www.vim.org/scripts/script.php?script_id=31

使用方法,只要在vim中输入以下命令即可完成相应的功能:

  • :A switches to the header file corresponding to the current file being edited (or vise versa) 
  • :AS splits and switches 
  • :AV vertical splits and switches 
  • :AT new tab and switches 
  • :AN cycles through matches 
  • :IH switches to file under cursor 
  • :IHS splits and switches 
  • :IHV vertical splits and switches 
  • :IHT new tab and switches 
  • :IHN cycles through matches 

cpp 语法检查:(linux下)

下载地址: http://www.vim.org/scripts/script.php?script_id=4205

在 vimrc 下插入

let g:include_path=":../include:./include:./tinyxml" 
let g:compile_flag="-D_LINUX_" 
let g:cpp_compiler="/usr/bin/g++" 
let g:enable_warning=1 

参考链接

把 vim 改成属于 C/C++ 的 IDE 环境: http://blog.csdn.net/huagong_adu/article/details/7560259

vim + gdb : http://blog.csdn.net/jackyvan/article/details/5193693

用Gvim建立IDE编程环境: http://hi.baidu.com/qaxfbrxdqbfmtzr/item/8028dc6235154331ad3e8374

VIM常用插件收集: http://linux.chinaunix.net/techdoc/desktop/2006/06/02/933610.shtml

常用插件大全: http://www.aitilife.com/2011/04/10/vim-common-plugins

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值