vim高亮

转载 2015年07月09日 10:15:38

原文地址http://blog.csdn.net/g_brightboy/article/details/14229139

简介】

      为了更加方便的学习和研究一个开源c++项目(当然linux环境下),特地花了一两周的时间研究vim及其插件的配置和使用方法,整理出来:一来做个记录便于日后回顾查看,二来分享出来为大家提供方便。
vim是什么
      vim是一款功能强大、支持各种插件、配置极为灵活的编辑器,且支持多种主流OS(linux、Unix、mac、windows),可用来各种编程预言的coding和文件编辑,用习惯了vim,你会体会到它是如此的高效和便捷。引用官网(
www.vim.org)上vim的自我介绍说:
Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE. It's not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files. Despite what the above comic suggests, Vim can be configured to work in a very simple (Notepad-like) way, called evim or Easy Vim.”
      本文主要通过一些示例介绍下如何定制自己专属的基于vim的IDE编程环境(主要针对c/c++,其他语言亦可采用相同的思路)。下面我们就一步一步来介绍,一砖一瓦从零开始建造我们基于VIM的友好的IDE环境。

【vim的下载与安装】

1. 在线安装

直接shell中输入如下命令:

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. sudo apt-get install vim (ubuntu)  
  2. yum install vim (redHat/Fedora/CentOS)  

linux会自动检测并下载安装。

2 手动下载编译安装

      截止当前最新版本是7.4(vim-7.4.tar.bz2),可在windows环境下载好,拷贝至linux环境安装,或直接linux命令行下载。这里给出 linux直接下载并编译安装(以下均为shell命令):
1). wget下载
wget 
ftp://ftp.vim.org/ftp/pub/vim/unix/vim-7.4.tar.bz2
(或用ftp命令登陆ftp://ftp.vim.org,get命令获取)

2). 解压 
bunzip2 vim-7.4.tar.bz2

3). 解压 
tar xvf vim-7.4.tar

4). 进入vim74(解压后的)目录,执行
./configure --disable-selinux --enable-cscope
(./configure -help 查看后面参数选项的含义)

5). 编译
make

6). 安装
make install

只要不出现error即代表成功安装,也可直接用vim命令来检测,或whatis vim(whereis vim)查看。通常情况下,许多发行版会默认安装vim,则可省略上述步骤。

【vim的初始化配置.vimrc】

1. 存放位置

      linux环境下vim的初始化配置文件为.vimrc, 通常有两个:系统版本和用户版本,前者不同发行版linux会有不同,一般位于/etc/vimrc,是整个系统vim的默认配置;后者位于~/.vimrc,是当前用户的vim配置,会覆盖系统配置。关于vim的其他配置参数文件位于/usr/local/share/vim/下,可进入vim,在命令模式下键入
:version (查看基本配置路径)
:echo $VIM
:echo $HOME(查看具体路径值)
~/.vimrc有时并不存在,此时用户可以建立一个.vimrc,放入主目录以实现自己的vim配置。

2. 主要命令参数
      .vimrc通常用于指定vim的编辑参数和外观环境。下面列出常用的命令参数及其含义:

<a target=_blank id="L1" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L1" rel="#L1" style="color: rgb(102, 102, 102); text-decoration: none;">   1</a>
<a target=_blank id="L2" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L2" rel="#L2" style="color: rgb(102, 102, 102); text-decoration: none;">   2</a>
<a target=_blank id="L3" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L3" rel="#L3" style="color: rgb(102, 102, 102); text-decoration: none;">   3</a>
<a target=_blank id="L4" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L4" rel="#L4" style="color: rgb(102, 102, 102); text-decoration: none;">   4</a>
<a target=_blank id="L5" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L5" rel="#L5" style="color: rgb(102, 102, 102); text-decoration: none;">   5</a>
<a target=_blank id="L6" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L6" rel="#L6" style="color: rgb(102, 102, 102); text-decoration: none;">   6</a>
<a target=_blank id="L7" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L7" rel="#L7" style="color: rgb(102, 102, 102); text-decoration: none;">   7</a>
<a target=_blank id="L8" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L8" rel="#L8" style="color: rgb(102, 102, 102); text-decoration: none;">   8</a>
<a target=_blank id="L9" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L9" rel="#L9" style="color: rgb(102, 102, 102); text-decoration: none;">   9</a>
<a target=_blank id="L10" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L10" rel="#L10" style="color: rgb(102, 102, 102); text-decoration: none;">  10</a>
<a target=_blank id="L11" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L11" rel="#L11" style="color: rgb(102, 102, 102); text-decoration: none;">  11</a>
<a target=_blank id="L12" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L12" rel="#L12" style="color: rgb(102, 102, 102); text-decoration: none;">  12</a>
<a target=_blank id="L13" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L13" rel="#L13" style="color: rgb(102, 102, 102); text-decoration: none;">  13</a>
<a target=_blank id="L14" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L14" rel="#L14" style="color: rgb(102, 102, 102); text-decoration: none;">  14</a>
<a target=_blank id="L15" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L15" rel="#L15" style="color: rgb(102, 102, 102); text-decoration: none;">  15</a>
<a target=_blank id="L16" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L16" rel="#L16" style="color: rgb(102, 102, 102); text-decoration: none;">  16</a>
<a target=_blank id="L17" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L17" rel="#L17" style="color: rgb(102, 102, 102); text-decoration: none;">  17</a>
<a target=_blank id="L18" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L18" rel="#L18" style="color: rgb(102, 102, 102); text-decoration: none;">  18</a>
<a target=_blank id="L19" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L19" rel="#L19" style="color: rgb(102, 102, 102); text-decoration: none;">  19</a>
<a target=_blank id="L20" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L20" rel="#L20" style="color: rgb(102, 102, 102); text-decoration: none;">  20</a>
<a target=_blank id="L21" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L21" rel="#L21" style="color: rgb(102, 102, 102); text-decoration: none;">  21</a>
<a target=_blank id="L22" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L22" rel="#L22" style="color: rgb(102, 102, 102); text-decoration: none;">  22</a>
<a target=_blank id="L23" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L23" rel="#L23" style="color: rgb(102, 102, 102); text-decoration: none;">  23</a>
<a target=_blank id="L24" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L24" rel="#L24" style="color: rgb(102, 102, 102); text-decoration: none;">  24</a>
<a target=_blank id="L25" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L25" rel="#L25" style="color: rgb(102, 102, 102); text-decoration: none;">  25</a>
<a target=_blank id="L26" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L26" rel="#L26" style="color: rgb(102, 102, 102); text-decoration: none;">  26</a>
<a target=_blank id="L27" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L27" rel="#L27" style="color: rgb(102, 102, 102); text-decoration: none;">  27</a>
<a target=_blank id="L28" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L28" rel="#L28" style="color: rgb(102, 102, 102); text-decoration: none;">  28</a>
<a target=_blank id="L29" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L29" rel="#L29" style="color: rgb(102, 102, 102); text-decoration: none;">  29</a>
<a target=_blank id="L30" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L30" rel="#L30" style="color: rgb(102, 102, 102); text-decoration: none;">  30</a>
<a target=_blank id="L31" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L31" rel="#L31" style="color: rgb(102, 102, 102); text-decoration: none;">  31</a>
<a target=_blank id="L32" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L32" rel="#L32" style="color: rgb(102, 102, 102); text-decoration: none;">  32</a>
<a target=_blank id="L33" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L33" rel="#L33" style="color: rgb(102, 102, 102); text-decoration: none;">  33</a>
<a target=_blank id="L34" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L34" rel="#L34" style="color: rgb(102, 102, 102); text-decoration: none;">  34</a>
<a target=_blank id="L35" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L35" rel="#L35" style="color: rgb(102, 102, 102); text-decoration: none;">  35</a>
<a target=_blank id="L36" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L36" rel="#L36" style="color: rgb(102, 102, 102); text-decoration: none;">  36</a>
<a target=_blank id="L37" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L37" rel="#L37" style="color: rgb(102, 102, 102); text-decoration: none;">  37</a>
<a target=_blank id="L38" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L38" rel="#L38" style="color: rgb(102, 102, 102); text-decoration: none;">  38</a>
<a target=_blank id="L39" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L39" rel="#L39" style="color: rgb(102, 102, 102); text-decoration: none;">  39</a>
<a target=_blank id="L40" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L40" rel="#L40" style="color: rgb(102, 102, 102); text-decoration: none;">  40</a>
<a target=_blank id="L41" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L41" rel="#L41" style="color: rgb(102, 102, 102); text-decoration: none;">  41</a>
<a target=_blank id="L42" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L42" rel="#L42" style="color: rgb(102, 102, 102); text-decoration: none;">  42</a>
<a target=_blank id="L43" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L43" rel="#L43" style="color: rgb(102, 102, 102); text-decoration: none;">  43</a>
<a target=_blank id="L44" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L44" rel="#L44" style="color: rgb(102, 102, 102); text-decoration: none;">  44</a>
<a target=_blank id="L45" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L45" rel="#L45" style="color: rgb(102, 102, 102); text-decoration: none;">  45</a>
<a target=_blank id="L46" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L46" rel="#L46" style="color: rgb(102, 102, 102); text-decoration: none;">  46</a>
<a target=_blank id="L47" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L47" rel="#L47" style="color: rgb(102, 102, 102); text-decoration: none;">  47</a>
<a target=_blank id="L48" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L48" rel="#L48" style="color: rgb(102, 102, 102); text-decoration: none;">  48</a>
<a target=_blank id="L49" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L49" rel="#L49" style="color: rgb(102, 102, 102); text-decoration: none;">  49</a>
<a target=_blank id="L50" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L50" rel="#L50" style="color: rgb(102, 102, 102); text-decoration: none;">  50</a>
<a target=_blank id="L51" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L51" rel="#L51" style="color: rgb(102, 102, 102); text-decoration: none;">  51</a>
<a target=_blank id="L52" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L52" rel="#L52" style="color: rgb(102, 102, 102); text-decoration: none;">  52</a>
<a target=_blank id="L53" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L53" rel="#L53" style="color: rgb(102, 102, 102); text-decoration: none;">  53</a>
<a target=_blank id="L54" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L54" rel="#L54" style="color: rgb(102, 102, 102); text-decoration: none;">  54</a>
<a target=_blank id="L55" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L55" rel="#L55" style="color: rgb(102, 102, 102); text-decoration: none;">  55</a>
<a target=_blank id="L56" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L56" rel="#L56" style="color: rgb(102, 102, 102); text-decoration: none;">  56</a>
<a target=_blank id="L57" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L57" rel="#L57" style="color: rgb(102, 102, 102); text-decoration: none;">  57</a>
<a target=_blank id="L58" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L58" rel="#L58" style="color: rgb(102, 102, 102); text-decoration: none;">  58</a>
<a target=_blank id="L59" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L59" rel="#L59" style="color: rgb(102, 102, 102); text-decoration: none;">  59</a>
<a target=_blank id="L60" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L60" rel="#L60" style="color: rgb(102, 102, 102); text-decoration: none;">  60</a>
<a target=_blank id="L61" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L61" rel="#L61" style="color: rgb(102, 102, 102); text-decoration: none;">  61</a>
<a target=_blank id="L62" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L62" rel="#L62" style="color: rgb(102, 102, 102); text-decoration: none;">  62</a>
<a target=_blank id="L63" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L63" rel="#L63" style="color: rgb(102, 102, 102); text-decoration: none;">  63</a>
<a target=_blank id="L64" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L64" rel="#L64" style="color: rgb(102, 102, 102); text-decoration: none;">  64</a>
<a target=_blank id="L65" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L65" rel="#L65" style="color: rgb(102, 102, 102); text-decoration: none;">  65</a>
<a target=_blank id="L66" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L66" rel="#L66" style="color: rgb(102, 102, 102); text-decoration: none;">  66</a>
<a target=_blank id="L67" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L67" rel="#L67" style="color: rgb(102, 102, 102); text-decoration: none;">  67</a>
<a target=_blank id="L68" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L68" rel="#L68" style="color: rgb(102, 102, 102); text-decoration: none;">  68</a>
<a target=_blank id="L69" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L69" rel="#L69" style="color: rgb(102, 102, 102); text-decoration: none;">  69</a>
<a target=_blank id="L70" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L70" rel="#L70" style="color: rgb(102, 102, 102); text-decoration: none;">  70</a>
<a target=_blank id="L71" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L71" rel="#L71" style="color: rgb(102, 102, 102); text-decoration: none;">  71</a>
<a target=_blank id="L72" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L72" rel="#L72" style="color: rgb(102, 102, 102); text-decoration: none;">  72</a>
<a target=_blank id="L73" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L73" rel="#L73" style="color: rgb(102, 102, 102); text-decoration: none;">  73</a>
<a target=_blank id="L74" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L74" rel="#L74" style="color: rgb(102, 102, 102); text-decoration: none;">  74</a>
<a target=_blank id="L75" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L75" rel="#L75" style="color: rgb(102, 102, 102); text-decoration: none;">  75</a>
<a target=_blank id="L76" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L76" rel="#L76" style="color: rgb(102, 102, 102); text-decoration: none;">  76</a>
<a target=_blank id="L77" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L77" rel="#L77" style="color: rgb(102, 102, 102); text-decoration: none;">  77</a>
<a target=_blank id="L78" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L78" rel="#L78" style="color: rgb(102, 102, 102); text-decoration: none;">  78</a>
<a target=_blank id="L79" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L79" rel="#L79" style="color: rgb(102, 102, 102); text-decoration: none;">  79</a>
<a target=_blank id="L80" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L80" rel="#L80" style="color: rgb(102, 102, 102); text-decoration: none;">  80</a>
<a target=_blank id="L81" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L81" rel="#L81" style="color: rgb(102, 102, 102); text-decoration: none;">  81</a>
<a target=_blank id="L82" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L82" rel="#L82" style="color: rgb(102, 102, 102); text-decoration: none;">  82</a>
<a target=_blank id="L83" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L83" rel="#L83" style="color: rgb(102, 102, 102); text-decoration: none;">  83</a>
<a target=_blank id="L84" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L84" rel="#L84" style="color: rgb(102, 102, 102); text-decoration: none;">  84</a>
<a target=_blank id="L85" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L85" rel="#L85" style="color: rgb(102, 102, 102); text-decoration: none;">  85</a>
<a target=_blank id="L86" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L86" rel="#L86" style="color: rgb(102, 102, 102); text-decoration: none;">  86</a>
<a target=_blank id="L87" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L87" rel="#L87" style="color: rgb(102, 102, 102); text-decoration: none;">  87</a>
<a target=_blank id="L88" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L88" rel="#L88" style="color: rgb(102, 102, 102); text-decoration: none;">  88</a>
<a target=_blank id="L89" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L89" rel="#L89" style="color: rgb(102, 102, 102); text-decoration: none;">  89</a>
<a target=_blank id="L90" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L90" rel="#L90" style="color: rgb(102, 102, 102); text-decoration: none;">  90</a>
<a target=_blank id="L91" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L91" rel="#L91" style="color: rgb(102, 102, 102); text-decoration: none;">  91</a>
<a target=_blank id="L92" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L92" rel="#L92" style="color: rgb(102, 102, 102); text-decoration: none;">  92</a>
<a target=_blank id="L93" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L93" rel="#L93" style="color: rgb(102, 102, 102); text-decoration: none;">  93</a>
<a target=_blank id="L94" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L94" rel="#L94" style="color: rgb(102, 102, 102); text-decoration: none;">  94</a>
<a target=_blank id="L95" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L95" rel="#L95" style="color: rgb(102, 102, 102); text-decoration: none;">  95</a>
<a target=_blank id="L96" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L96" rel="#L96" style="color: rgb(102, 102, 102); text-decoration: none;">  96</a>
<a target=_blank id="L97" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L97" rel="#L97" style="color: rgb(102, 102, 102); text-decoration: none;">  97</a>
<a target=_blank id="L98" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L98" rel="#L98" style="color: rgb(102, 102, 102); text-decoration: none;">  98</a>
<a target=_blank id="L99" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L99" rel="#L99" style="color: rgb(102, 102, 102); text-decoration: none;">  99</a>
<a target=_blank id="L100" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L100" rel="#L100" style="color: rgb(102, 102, 102); text-decoration: none;"> 100</a>
<a target=_blank id="L101" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L101" rel="#L101" style="color: rgb(102, 102, 102); text-decoration: none;"> 101</a>
<a target=_blank id="L102" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L102" rel="#L102" style="color: rgb(102, 102, 102); text-decoration: none;"> 102</a>
<a target=_blank id="L103" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L103" rel="#L103" style="color: rgb(102, 102, 102); text-decoration: none;"> 103</a>
<a target=_blank id="L104" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L104" rel="#L104" style="color: rgb(102, 102, 102); text-decoration: none;"> 104</a>
<a target=_blank id="L105" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L105" rel="#L105" style="color: rgb(102, 102, 102); text-decoration: none;"> 105</a>
<a target=_blank id="L106" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L106" rel="#L106" style="color: rgb(102, 102, 102); text-decoration: none;"> 106</a>
<a target=_blank id="L107" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L107" rel="#L107" style="color: rgb(102, 102, 102); text-decoration: none;"> 107</a>
<a target=_blank id="L108" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L108" rel="#L108" style="color: rgb(102, 102, 102); text-decoration: none;"> 108</a>
<a target=_blank id="L109" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L109" rel="#L109" style="color: rgb(102, 102, 102); text-decoration: none;"> 109</a>
<a target=_blank id="L110" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L110" rel="#L110" style="color: rgb(102, 102, 102); text-decoration: none;"> 110</a>
<a target=_blank id="L111" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L111" rel="#L111" style="color: rgb(102, 102, 102); text-decoration: none;"> 111</a>
<a target=_blank id="L112" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L112" rel="#L112" style="color: rgb(102, 102, 102); text-decoration: none;"> 112</a>
<a target=_blank id="L113" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L113" rel="#L113" style="color: rgb(102, 102, 102); text-decoration: none;"> 113</a>
<a target=_blank id="L114" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L114" rel="#L114" style="color: rgb(102, 102, 102); text-decoration: none;"> 114</a>
<a target=_blank id="L115" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L115" rel="#L115" style="color: rgb(102, 102, 102); text-decoration: none;"> 115</a>
<a target=_blank id="L116" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L116" rel="#L116" style="color: rgb(102, 102, 102); text-decoration: none;"> 116</a>
<a target=_blank id="L117" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L117" rel="#L117" style="color: rgb(102, 102, 102); text-decoration: none;"> 117</a>
<a target=_blank id="L118" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L118" rel="#L118" style="color: rgb(102, 102, 102); text-decoration: none;"> 118</a>
<a target=_blank id="L119" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L119" rel="#L119" style="color: rgb(102, 102, 102); text-decoration: none;"> 119</a>
<a target=_blank id="L120" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L120" rel="#L120" style="color: rgb(102, 102, 102); text-decoration: none;"> 120</a>
<a target=_blank id="L121" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L121" rel="#L121" style="color: rgb(102, 102, 102); text-decoration: none;"> 121</a>
<a target=_blank id="L122" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L122" rel="#L122" style="color: rgb(102, 102, 102); text-decoration: none;"> 122</a>
<a target=_blank id="L123" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L123" rel="#L123" style="color: rgb(102, 102, 102); text-decoration: none;"> 123</a>
<a target=_blank id="L124" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L124" rel="#L124" style="color: rgb(102, 102, 102); text-decoration: none;"> 124</a>
<a target=_blank id="L125" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L125" rel="#L125" style="color: rgb(102, 102, 102); text-decoration: none;"> 125</a>
<a target=_blank id="L126" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L126" rel="#L126" style="color: rgb(102, 102, 102); text-decoration: none;"> 126</a>
<a target=_blank id="L127" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L127" rel="#L127" style="color: rgb(102, 102, 102); text-decoration: none;"> 127</a>
<a target=_blank id="L128" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L128" rel="#L128" style="color: rgb(102, 102, 102); text-decoration: none;"> 128</a>
<a target=_blank id="L129" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L129" rel="#L129" style="color: rgb(102, 102, 102); text-decoration: none;"> 129</a>
<a target=_blank id="L130" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L130" rel="#L130" style="color: rgb(102, 102, 102); text-decoration: none;"> 130</a>
<a target=_blank id="L131" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L131" rel="#L131" style="color: rgb(102, 102, 102); text-decoration: none;"> 131</a>
<a target=_blank id="L132" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L132" rel="#L132" style="color: rgb(102, 102, 102); text-decoration: none;"> 132</a>
<a target=_blank id="L133" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L133" rel="#L133" style="color: rgb(102, 102, 102); text-decoration: none;"> 133</a>
<a target=_blank id="L134" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L134" rel="#L134" style="color: rgb(102, 102, 102); text-decoration: none;"> 134</a>
<a target=_blank id="L135" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L135" rel="#L135" style="color: rgb(102, 102, 102); text-decoration: none;"> 135</a>
<a target=_blank id="L136" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L136" rel="#L136" style="color: rgb(102, 102, 102); text-decoration: none;"> 136</a>
<a target=_blank id="L137" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L137" rel="#L137" style="color: rgb(102, 102, 102); text-decoration: none;"> 137</a>
<a target=_blank id="L138" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L138" rel="#L138" style="color: rgb(102, 102, 102); text-decoration: none;"> 138</a>
<a target=_blank id="L139" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L139" rel="#L139" style="color: rgb(102, 102, 102); text-decoration: none;"> 139</a>
<a target=_blank id="L140" href="http://blog.csdn.net/g_brightboy/article/details/14229139#L140" rel="#L140" style="color: rgb(102, 102, 102); text-decoration: none;"> 140</a>
"打开语法高亮
syntax on
"使用配色方案
colorscheme desert
"打开文件类型检测功能
filetype on
"不同文件类型采用不同缩进
filetype indent on
"允许使用插件
filetype plugin on
filetype plugin indent on
"关闭vi模式
set nocp
"与windows共享剪贴板
set clipboard+=unnamed
"取消VI兼容,VI键盘模式不易用
set nocompatible
"显示行号, 或set number
set nu
"历史命令保存行数
set history=100
"当文件被外部改变时自动读取
set autoread
"取消自动备份及产生swp文件
set nobackup
set nowb
set noswapfile
"允许使用鼠标点击定位
set mouse=a
"允许区域选择
set selection=exclusive
set selectmode=mouse,key
"高亮光标所在行
set cursorline
"取消光标闪烁
set novisualbell
"总是显示状态行
set laststatus=2
"状态栏显示当前执行的命令
set showcmd
"标尺功能,显示当前光标所在行列号
set ruler
"设置命令行高度为3
set cmdheight=3
"粘贴时保持格式
set paste
"高亮显示匹配的括号
set showmatch
"在搜索的时候忽略大小写
set ignorecase
"高亮被搜索的句子
set hlsearch
"在搜索时,输入的词句的逐字符高亮(类似firefox的搜索)
set incsearch
"继承前一行的缩进方式,特别适用于多行注释
set autoindent
"为C程序提供自动缩进
set smartindent
"使用C样式的缩进
set cindent
"制表符为4
set tabstop=4
"统一缩进为4
set softtabstop=4
set shiftwidth=4
"允许使用退格键,或set backspace=2
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
"取消换行
set nowrap
"启动的时候不显示那个援助索马里儿童的提示
set shortmess=atI
"在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
"光标移动到buffer的顶部和底部时保持3行距离, 或set so=3
set scrolloff=3
"设定默认解码
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
"设定字体
set guifont=Courier_New:h11:cANSI
set guifontwide=新宋体:h11:cGB2312
"设定编码
set enc=utf-8
set fileencodings=ucs-bom,utf-8,chinese
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"自动补全
filetype plugin indent on
set completeopt=longest,menu
"自动补全命令时候使用菜单式匹配列表
set wildmenu
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complet
 来自CODE的代码片
vimrc.vim

【vim的语法高亮/配色方案】

vim的配色分两部分:编辑环境配色和文本区域配色
1) vim编辑环境配色:比如Vim编辑区的前景背景色、状态栏颜色、错误提示颜色、查找、光标、圈选区、行号、折叠等的颜色
这里列出几个配色组名及其含义(全部的详细信息查看帮助文件 :help hi 查找 "highlight-group" 即可):

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. Cursor        光标下的字符颜色    
  2. CursorLine    光标所在行颜色    
  3. ErrorMsg      命令行出现的错误信息提示    
  4. IncSearcg     被搜索字符的颜色    
  5. Normal        普通字符    
  6. Pmenu         弹出的提示条目颜色    
  7. PmenuSel      弹出的提示条目中被选中条目的颜色    
  8. SpellBad      拼写错误字符颜色    
  9. Visual        可视化模式下选中字符的颜色    
  10. Menu          菜单栏的颜色字体    
  11. Scrollbar     滚动条的颜色   

2) 文本区域配色:可编辑的文本区域的字符配色(详细信息请执行 :help hi搜索 "*comment")
由于配色种类较多,vim默认分了几大类(帮助信息中带*的):

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. *Comment        注释  
  2. *Constant       常量  
  3. *statement      常用关键字标示符  
  4. *PrePoc         预处理符号  
  5. *Type           数据类型  


下面是较为详细的组别:

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. String          字符串常量: "string abc\n"  
  2. Character       单个字符常量: 'c', '\n'  
  3. Number          数字常量: 234, 0xff  
  4. Boolean         布尔常量: TRUE, false  
  5. Function        函数名  
  6. Conditional     条件关键字: if, then, else, endif, switch, etc.  
  7. Repeat          循环关键字: for, do, while, etc.  
  8. Operator        操作符: "sizeof", "+", "*", etc.  
  9. Exception       异常关键字: try, catch, throw  

这样便可以更为详细的为每一个组别进行配色。

查看当前的vim配色情况
:hi/highlight

另外,文本区域的配色可以关闭,但环境配色不能,通常vim给定的默认可选配色方案中同时包含了以上两个方面。
下面就一条具体的配色命令(对数据类型配色)解释每个字段的含义:

hi Type cterm=none ctermbg=White ctermfg=Green guibg=Gray guifg=Red

hi: highlight的缩写,配色命令
Type: 配色组名,可以自定义(修改$VIMRUNTIME/syntax/下对应的文件可改变不同语言的高亮方案)其内容 
cterm,ctermbg,ctermfg,guibg,guifg: 代表了不同显示环境
White,Green: 表示颜色(也可以用数字或者类似与html的16进制颜色表示方法)

显示环境有三种:黑白终端,彩色终端,图形界面,三种环境下参数名称如下:

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. term        attributes in a B&W terminal  
  2. cterm       attributes in a color terminal  
  3. ctermfg     foreground color in a color terminal  
  4. ctermbg     background color in a color terminal  
  5. gui         attributes in the GUI  
  6. guifg       foreground color in the GUI  
  7. guibg       background color in the GUI  

 

其中term仅有黑白两色,cterm下颜色较为单一,GUI模式颜色丰富

若要仅修改某种语言(c、java、pascal)的配色,则在配色组名前加语言名称即可,比如对c/c++语言的数据类型单独配色:
hi cType ctermfg=Blue

若是修改java/pascal的数据类型,则相应的将cType替换为javaType/pascalType即可。

对于文本区域的语法高亮(即配色),我们可根据需求特殊化定制,比如自定义组: myUniqueWord, mySymbol,使用syn/syntax命令
syn keyword myUniqueWord gang Gang swagger
syn match mySymbol "[,.;(){}[]]" (可使用正则表达式)


vim目前7.4版本给出的可直接使用(colorscheme命令加于.vimrc中即可)的配色方案位于目录:
/usr/local/share/vim/vim74/colors,比如使用desert.vim中的配色,则于.vimrc中添加一行
colorscheme desert
即可

网友提供的配色方案列表(带效果图),可参考:
http://vimcolorschemetest.googlecode.com/svn/html/index-c.html
http://www.oschina.net/news/32306/10-vim-color-schemes-you-need-to-own

:hi/highlight
命令,可查看当前vim的颜色配置

:help hi/highlight
显示帮助文件(syntax.txt,可访问官方在线版
http://vimdoc.sourceforge.net/htmldoc/syntax.html)内容,介绍了颜色配置脚本中关键字的含义和使用方法

相同配色vim脚本在不同的终端下可能显示不太一致,这是由终端下颜色设置不一致导致的,属正常情况。

【vim的代码补全、结构化视图】(基于autocomplpop + omnicppcomplete + ctags + taglist + cscope + NERDtree)

先一句话介绍每个插件的用途:
--> ctags: 为源码的变量/对象、结构体/类、函数/接口、宏等产生索引,以便快速查找和定位
 - Official site  
http://ctags.sourceforge.net/
 - VIM online  
http://www.vim.org/scripts/script.php?script_id=610

--> taglist:提供源码的结构化浏览功能
 - Official site  
http://vim-taglist.sourceforge.net/
 - VIM online  http://www.vim.org/scripts/script.php?script_id=273

--> AutoComplPop:代码补全提示自动弹出
 - VIM online  
http://www.vim.org/scripts/script.php?script_id=1879

--> OmniCppComplete:基于ctags的索引文件提供全面的c++(类成员、继承、this指针、.->访问符等)的代码补全功能
 - VIM online  
http://www.vim.org/scripts/script.php?script_id=1520

--> cscope:对代码产生索引数据库,提供对象接口字符串的查找,并用列表显示(:cw - quickfix)
 - Official site  
http://cscope.sourceforge.net/
 - VIM online  http://www.vim.org/scripts/script.php?script_id=4082 

--> NERDtree:以树形结构显示文件系统的目录(同windows的资源管理器),并可以在目录间切换
- VIM online http://www.vim.org/scripts/script.php?script_id=1658

vim支持的几乎所有plugin&&utility都在这里可以下载到(主要以vim脚本的形式)
http://www.vim.org/scripts/index.php

下面逐一介绍各个插件的安装和使用方法
1) ctags
2) taglist
3) AutoComplPop
4) OmniCppComplete
5) cscope

6) NERDtree
(待续)

由于后续各个插件的介绍篇幅较长,单独形成博文,请参考:

ctags 的安装和使用方法,请猛击:http://blog.csdn.net/g_brightboy/article/details/16830395

taglist的安装和使用方法,请猛击:http://blog.csdn.net/g_brightboy/article/details/16843899

AutoComplPop和OmniCppComplete的安装和使用方法,请用力敲鼠标左键:http://blog.csdn.net/g_brightboy/article/details/19498983

相关文章推荐

vim STL语法高亮

  • 2015年01月21日 11:51
  • 5KB
  • 下载

APDL语言的VIM语法高亮插件

  • 2014年12月29日 16:43
  • 128KB
  • 下载

vim查找高亮以及替换操作

使用了VIM这么久,却一直无法牢记一些基本的操作指令。今天查找一个关键字时,想不起来怎么查找“下一个”,于是google之并解决,顺便把有用的都贴过来罢。 查找指令: /xxx 往下查找 ?...
  • lwfcgz
  • lwfcgz
  • 2014年09月02日 13:33
  • 3624

antlrv3的vim语法高亮插件.

  • 2009年09月19日 00:08
  • 2KB
  • 下载

vim高亮插件

  • 2013年06月20日 21:59
  • 174KB
  • 下载

secureCRT使用VIM(SSH)时对语法高亮

1.在SecureCRT中 secureCRT使用VIM时对语法高亮 其实不是secureCRT的功能,而是VIM的 设置:Options ->Session Options -> Termin...

ubuntu vim 高亮显示

  • 2011年08月02日 20:51
  • 17KB
  • 下载

vim 语法高亮 颜色

  • 2010年02月28日 20:51
  • 4KB
  • 下载

vim显示行号、语法高亮、自动缩进的设置

在UBUNTU中vim的配置文件存放在/etc/vim目录中,配置文件名为vimrc 在Fedora中vim的配置文件存放在/etc目录中,配置文件名为vimrc 在Red Hat Linu...

Cygwin中文乱码 vim语法高亮 ls颜色显示

Cygwin中文乱码 vim语法高亮 ls颜色显示 2008-11-28 22:05 打开cygwin作如下配置 1 在任何位置执行 vi ~/.bashrc 并在行尾添加如下内容并保存关...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:vim高亮
举报原因:
原因补充:

(最多只允许输入30个字)