关于.vimrc和vim配置的一些问题 [英] Some questions on .vimrc and vim configuration

查看:25
本文介绍了关于.vimrc和vim配置的一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般在 unix 系统上,/etc/etc/vim 目录中有一个全局的 vimrc 文件.您还可以在您的主目录中有一个 .vimrc 文件,它可以自定义您的 vi 会话.

是否可以在目录树的其他地方有一个 .vimrc 以便您可以在不同的目录中使用不同的 vi 属性?这会很方便,因为帮助您最快速地编辑 Python 的编辑器属性与用于编辑(例如 HTML)的编辑器属性不同.

这种事情在我的 mac 或 linux lappies 上似乎不起作用.有没有办法让它发生?

解决方案

Vim 已经为此构建了功能:

:se exrc

<块引用>

启用读取当前文件中的 .vimrc、.exrc 和 .gvimrc目录.如果您打开此选项,您还应该考虑设置'secure' 选项(见|initialization|).使用本地.exrc、.vimrc 或 .gvimrc 是潜在的安全漏洞,请谨慎使用!另见|.vimrc|和 |gui-init|.

http://damien.lespiau.name/blog/2009/03/18/per-project-vimrc/

为了适当的项目支持,有几个插件具有类似的功能.(我不使用,所以我不能推荐任何).

Generally on a unix system, there is a global vimrc file in the directory /etc or /etc/vim. You can also have a .vimrc file in your home directory that can customize your vi session.

Is it possible to have a .vimrc elsewhere in your directory tree so you can use different vi properties in different directories? This would be convenient because the editor properties that help you edit Python most quickly are different from those for editing, say, HTML.

This sort of thing does not seem to work be default on my mac or linux lappies. Is there a way to make it happen?

解决方案

Vim has built functionality for this:

:se exrc

Enables the reading of .vimrc, .exrc and .gvimrc in the current
directory.  If you switch this option on you should also consider
setting the 'secure' option (see |initialization|).  Using a local
.exrc, .vimrc or .gvimrc is a potential security leak, use with care!
also see |.vimrc| and |gui-init|.

See http://damien.lespiau.name/blog/2009/03/18/per-project-vimrc/

For proper project support, there are several plugins have similar features. (which I don't use, so I can't recommend any).

这篇关于关于.vimrc和vim配置的一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆