您的位置:首页 > 其它

windows环境中vim插件配置(便利的vim)

2014-06-04 00:00 495 查看
摘要: 有没有觉得csdn做的很恶心……以后再也不去那了。。。。我只会过去看看。。打开vim的文件类型自动检测功能:filetype on,就是在vimrc文件中加上filetype on

1.ctags

1.1ctags功能:

tags是个exe文件,在shell中执行来在工程目录中创建tags(就是函数的映射关系),适用ctrl ],和ctrl T 来寻找函数定义。注:Taglist是配合ctags来适用的!!!

1.2ctags用法:

在shell中ctags [options] [file(s)]
<pre name="code" class="javascript">Usage: ctags [options] [file(s)]
-e Output tag file for use with Emacs.
Write tags to specified file. Value of "-" writes tags to stdout
-F Use forward searching patterns (/.../) (default).
Specify list of file extensions to be treated as include files.
A list of tokens to be specially handled is read from either the
A list of source file names are read from the specified file.
-n Equivalent to --excmd=number.
-N Equivalent to --excmd=pattern.
-R Equivalent to --recurse.
-u Equivalent to --sort=no.
-x Print a tabular cross reference file to standard output.
Should tags should be appended to existing tag file [no]?
Include reference to 'file' in Emacs-style tag file (requires -e).
Exclude files and directories matching 'pattern'.
Uses the specified type of EX command to locate tags [mix].
Include extra tag entries for selected information (flags: "fq").
Include selected extension fields (flags: "afmikKlnsStz") [fks].
Should tags scoped only for a single file (e.g. "static" tags
Behave as a filter, reading file names from standard input and
--filter-terminator=string
Specify string to print to stdout following the tags for each file
Force output of specified tag file format [2].
--if0=[yes|no]
Should C code within #if 0 conditional branches be parsed [no]?
Enable/disable tag kinds for language <LANG>.
Define a new language to be parsed with regular expressions.
Override default mapping of language to source file extension.
Force all files to be interpreted using specified language.
Restrict files scanned for tags to those mapped to langauges
specified in the comma-separated 'list'. The list can contain any
Print details of software license.
Should #line directives be processed [no]?
Indicate whether symbolic links should be followed [yes].
Output a list of all tag kinds for specified language or all.
--list-maps=[language|all]
Output list of language mappings.
Specify file from which command line options should be read.
Recurse into directories supplied on command line [no].
Define regular expression for locating tags in specific language.
Should tags be sorted (optionally ignoring case) [yes]?.
Should paths be relative to location of tag file [no; yes when -e]?
Print statistics about source and tag files [no].
Enable verbose messages describing actions on each source file.
Print version identifier to standard output.
-a   Append the tags to an existing tag file.
-B   Use backward searching patterns (?...?).
-f <name>
["tags"; or "TAGS" when -e supplied].
-h <list>
[".h.H.hh.hpp.hxx.h++"].
-I <list|@file>
command line or the specified file.
-L <file>
If specified as "-", then standard input is read.
-o   Alternative for -f.
-V   Equivalent to --verbose.
--append=[yes|no]
--etags-include=file
--exclude=pattern
--excmd=number|pattern|mix
--extra=[+|-]flags
--fields=[+|-]flags
--file-scope=[yes|no]
be included in the output [yes]?
--filter=[yes|no]
writing tags to standard output [no].
parsed when --filter is enabled.
--format=level
--help
Print this option summary.
--<LANG>-kinds=[+|-]kinds
--langdef=name
--langmap=map(s)
--language-force=language
--languages=[+|-]list
built-in or user-defined language [all].
--license
--line-directives=[yes|no]
--links=[yes|no]
--list-kinds=[language|all]
--list-languages
Output list of supported languages.
--options=file
--recurse=[yes|no]
--regex-<LANG>=/line_pattern/name_pattern/[flags]
--sort=[yes|no|foldcase]
--tag-relative=[yes|no]
--totals=[yes|no]
--verbose=[yes|no]
--version

1.3ctags配置:

下载一个ctags http://ctags.sourceforge.net/,windows版的,将ctags.exe放到环境变量path中。

1.4ctags使用过程:

1. 在shell中 ctags -R + 工程路径。此时工程里面应该错了一个tags名的文件2. vim中 :set tags = [tagsPath]。3. 现在找个函数然后 ctrl ] , and then ctrl t已经完事了

2.tagList:

2.1tagList功能:

将已经配置好的tags,以分裂窗口的形式出现在vim中。注:一定是ctags命令产生了tags文件后才可以用。里面包括全局变量,宏,typedef,函数,类……

2.2tagList使用方法:

vim中 :Tlist, :TlistOpen :TlistClose

2.3tagList配置:

http://www.vim.org/scripts/script.php?script_id=273下载,没版本,都行。解压后将plugin和doc中的文件分别放在vim安装目录中的doc和plugin中 然后在vimrc中
if MySys() == "windows"                "设定windows系统中ctags程序的位置let Tlist_Ctags_Cmd = 'ctags'elseif MySys() == "linux"              "设定linux系统中ctags程序的位置let Tlist_Ctags_Cmd = '/usr/bin/ctags'endiflet Tlist_Show_One_File = 1            "不同时显示多个文件的tag,只显示当前文件的let Tlist_Exit_OnlyWindow = 1          "如果taglist窗口是最后一个窗口,则退出vimlet Tlist_Use_Left_Window = 1          "在左侧窗口中显示taglist窗口

2.4tagList使用全过程:

1.安装ctags,以便可以生成工程tags2.taglist下载配置3.:Tlist完事了……

3.WinManager:

3.1WinManager功能:

此插件的作用是将TagList窗口和netrw窗口整合起来

3.2配置方法:

http://www.vim.org/scripts/script.php?script_id=159 下一个,解压放到vim74/plugin里面,可以了。我的vimrc中是这样设置的,参考http://blog.csdn.net/minico/article/details/1938050
"把gui的工具栏去掉(要去掉,把等号前面的加号变成一个减号即可)set guioptions+=T"把gui的右边的滑动条去掉set guioptions+=r"把gui的左边的滑动条去掉set guioptions-=L"把gui的菜单去掉set guioptions+=mfiletype onlet Tlist_Show_Menu = 1"通过WinManager插件来将TagList窗口和netrw窗口整合起来let g:winManagerWindowLayout='FileExplorer|TagList'nmap wm :WMToggle<cr>
此时按F2就可以出现Tlist了,然后wm就直接WMToggle了。so easy

3.3使用:

注意一定要先有ctags,Tlist和WinManager都是根据ctags生成的tags文件来生成窗口的。在用ctags生成tags以后再vim中:WMToggle看看粗来了啥?最上面那行显示*.cpp文件的那个窗口时MiniBufExplore一会介绍,左下是Tlist窗口,左上是Flie list,是 WinManager干的

3.4WinManager使用全过程

1.工程目录下要有已经生成好的tags文件2.要有Tlist插件3.配置,然后我都会了

4.MiniBufExplore

就是下载然后放到vim74/plugin中。然后就可以看到你想看的了

5.omnicppcomplete

5.1功能说明:

这玩意是按tab自动补全的,同样首先都要有tags文件,同事他要配合supertab来实现。我就是用不好,谁有详细的方法请赐教

5.2配置

下载解压放到vimfile里面的相似路径中,因为加压文件中有doc,ftplugin,autoload……在vimrc中加入
"打开文件类型检测filetype plugin indent on:set nocp

6.supertab

6.1功能说明

同omnicppcomplete一起使用,前提有tags文件!!!直接下载插件放到plugin中。就可以用了

7.a

7.1功能说明

搞笑的名字~,可以再.cpp和.h之间闪电转换。

7.2配制方法

直接下载,将a.vim放到plugin中现在插件就这么多.....................基本上在网上都可以找到,也是最基本的最实用的了,谁有好的可以告诉,谢谢了

7.3使用

就是:A,就跳了

8.括号自动补齐

这个不是插件,是几句vim的脚本........:inoremap { {}<ESC>i:inoremap [ []<ESC>i:inoremap ( ()<ESC>i在vimrc中加上这几句,完了你的vim就可以哈哈了。想要复杂的戳这里未完待续...............................
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vim插件