vim环境配置

ctags

ctags对浏览代码很是的方便,能够在函数、变量之间跳来跳去等等.php

下载

下载路径:http://ctags.sourceforge.net/html

我已经下载过了,路径:/home1/fujun/software/ctags-5.8.tar.gzlinux

编译&安装

$ tar -xzvf ctags-5.8.tar.gz
$ cd ctags-5.8
$ ./configure
# make
# make install

配置

在.vimrc中须要加入如下配置:git

set tags=/home1/fujun/opt/bin/ctags #本地编译的ctags,将该文件放在了个人home目录的指定目录,仅对本用户有效
set tags=tags;
set autochdir

使用

而后去你的工程目录,若是你的工程是多层的目录,就去最上层的目录,在该目录下运行命令: ctags -Rgithub

那么在当前目录及其子目录下就会生成tags文件。正则表达式

Ctrl + ] 跳到函数func()的定义处;shell

Ctrl + T 跳回func()的调用处;vim

变量, 结构, 宏, 等等, 均可以的函数

更多用法, 在vim命令模式输入 :help usr_29 查看便可.ui

taglist

高效地浏览源码,其功能就像vc中的workpace,那里面列出了当前文件中的全部宏,全局变量,函数名等。

下载

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

安装

下载taglist压缩包,而后把解压的两个文件taglist.vim 和 taglist.txt 分别放到

/usr/share/vim/vim74/doc/

/usr/share/vim/vim74/plugin/

使用

进入vim后用下面的命令打开taglist窗口.

:Tlist

mark.vim

多个单词高亮

下载

路径:http://www.vim.org/scripts/script.php?script_id=1238

安装

将mark.vim文件添加到相应路径下,个人是/usr/share/vim/vim74plugin下

使用

\m 用来使得光标处的单词着色

\n 使得原先着色的单词取消着色

\r 输入\r后再输入正则表达式,能够高亮匹配的相关单词

输入\r 而后再输入S->.*

有时候 \m 不起做用时,须要在.vimrc中加入

img

Vundle

下载&安装

若是目录.vim/bundle不存在请先建立,

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vundle
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'


" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

打开vim,运行 :PluginInstall 命令来自动安装插件。

YouCompleteMe

YouCompleteMe是vim中一个强大的自动补全、提示引擎。

下载

在~/.vimrc中的Vundle插件列表区域中添加YouCompleteMe的源位置,

Plugin 'Valloric/YouCompleteMe'

保存后退出,再打开vim,运行:PluginInstall命令下载。

安装

参考:https://github.com/Valloric/YouCompleteMe#linux-64-bit

问题

安装完成后,终端输入vim使用底部会报这样的错:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). YCM core library not detected; you need to compile YCM before using it. Follow the instructions in the documentation.

解决办法:

cd .vim/bundle/YouCompleteMe
./install.py

Doxygen

安装&下载

在~/.vimrc中的Vundle插件列表区域中添加DoxygenToolkit的源位置

Plugin 'vim-scripts/DoxygenToolkit.vim'

保存后退出,再打开vim,运行:PluginInstall命令安装。

使用

安装好Doxygen后,打开代码文件,便可经过:DoxLic,:DoxAuthor,:Dox添加license说明、做者版本说明和函数说明。

默认的配置在~/.vim/bundle/DoxygenToolkit.vim/plugin/DoxygenToolkit.vim文件。

vim建立文件自动生成头部注释

参考个人博客:http://www.javashuo.com/article/p-zlbjbpjz-hu.html

相关文章
相关标签/搜索