您的位置:首页 > 其它

windows环境中vim插件配置

2014-06-04 09:48 507 查看
打开vim的文件类型自动检测功能:filetype on,就是在vimrc文件中加上filetype on

ctags

ctags功能:

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

注:Taglist是配合ctags来适用的!!!

ctags用法:

在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




ctags配置:

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

ctags使用过程:

1. 在shell中 ctags -R + 工程路径。此时工程里面应该错了一个tags名的文件

2. vim中 :set tags = [tagsPath]。

3. 现在找个函数然后 ctrl ] , and then ctrl t

已经完事了

tagList:

tagList功能:

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




tagList使用方法:

vim中 :Tlist, :TlistOpen :TlistClose

tagList配置:

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'
endif
    let Tlist_Show_One_File = 1            "不同时显示多个文件的tag,只显示当前文件的
    let Tlist_Exit_OnlyWindow = 1          "如果taglist窗口是最后一个窗口,则退出vim
    let Tlist_Use_Left_Window = 1          "在左侧窗口中显示taglist窗口

tagList使用全过程:

1.安装ctags,以便可以生成工程tags

2.taglist下载配置

3.:Tlist

完事了……

未完待续...............................
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: