Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1319862
  • 博文数量: 482
  • 博客积分: 13297
  • 博客等级: 上将
  • 技术积分: 2890
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-12 16:25
文章分类

全部博文(482)

文章存档

2012年(9)

2011年(407)

2010年(66)

分类: LINUX

2011-08-24 11:38:13

上周五一个朋友问我怎么修改vim(6.x的版本)里的变量$VIMRUNTIME的值

我找了一台机器

发现:

这个变量是装了vim-enhanced包,而且要是6.x以上版本才会有的

否则

缺省是没有的

而且这个变量缺省是指向目录/usr/share/vim/vimxx

上面这里的xx是vim的版本号,比如63

上面这个缺省指向是在vim里用":echo $VIMRUNTIME"来看的

不知道怎么改

于是google了一把

发现大多文章都提到通过修改$VIMRUNTIME/下

或$VIMRUNTIME/syntax/下的一些.vim文件来达到修改vim的配置的目的的方法

也还有几篇中文文档提到可以在~/.vimrc里设定环境变量VIMRUNTIME的值

但这些文档里都是讲将$VIMRUNTIME指向程序vim的实际位置

一般应该是/usr/bin/vim

最后还是回到vim里

用命令":help $VIMRUNTIME"找到了答案

看下面我摘抄的这一段:

 

The environment variable "$VIMRUNTIME" is used to locate various support files, such as the on-line documentation and files used for syntax highlighting.  For example, the main help file is normally"$VIMRUNTIME/doc/help.txt". You don’t normally set $VIMRUNTIME yourself, but let Vim figure it out.  This is the order used to find the value of $VIMRUNTIME:

1. If the environment variable $VIMRUNTIME is set, it is used.  You can use    this when the runtime files are in an unusual location.

2. If "$VIM/vim{version}" exists, it is used.  {version} is the version    number of Vim, without any ‘-’ or ‘.’.  For example: "$VIM/vim54".  This is    the normal value for $VIMRUNTIME.

3. If "$VIM/runtime" exists, it is used.

4. The value of $VIM is used.  This is for backwards compatibility with older    versions.

5. When the ‘helpfile’ option is set and doesn’t contain a ‘$’, its value is    used, with "doc/help.txt" removed from the end.

For Unix, when there is a compiled-in default for $VIMRUNTIME (check the output of ":version"), steps 2, 3 and 4 are skipped, and the compiled-in default is used after step 5.  This means that the compiled-in default overrules the value of $VIM.  This is useful if $VIM is "/etc" and the runtime files are in "/usr/share/vim/vim54".

Once Vim has done this once, it will set the $VIMRUNTIME environment variable. To change it later, use a ":let" command like this: >        

:let $VIMRUNTIME = "/home/piet/vim/vim54"


====


阅读(1646) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

Alan05212011-08-24 11:41:15

":help $VIMRUNTIME"
要多利用软件自带的help。