我的Vim为什么不知道我的别名? [英] Why doesn't my vim know my alias?

查看:93
本文介绍了我的Vim为什么不知道我的别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 alias ruby​​ = ruby​​1.9.1,因此可以执行以下操作:

I have used "alias ruby=ruby1.9.1", so I can execute my ruby with this:


ruby​​ 123.rb

ruby 123.rb


ruby​​1.9.1 123 .rb

ruby1.9.1 123.rb

但是在我的vim中,我使用:!ruby并获得
/ bin / bash:ruby:command not找到。

But in my vim, I use :!ruby and get /bin/bash: ruby: command not found.

我必须使用:!ruby1.9.1

I must use :!ruby1.9.1

别名如何工作?为什么vim不知道?

How does alias work? Why vim doesn't know it?

推荐答案

Vim启动进程时会进行系统调用。如果您是从外壳启动的,则它仅从外壳继承了环境变量。

When Vim starts a process it makes a system call. It has only inherited the environment variables from your shell if you started it from the shell. But it won't know your bash aliases.

Bash别名只是在Bash shell中输入命令行时的一种方便。它们仅由Bash扩展。

Bash aliases are only a convenience when you enter a command line in the Bash shell. They are expanded by Bash only.

如果您想使用真实别名,将符号链接放在一个私有的隐藏文件夹中,然后将该文件夹添加到您的PATH中,或者使用替代工具。

If you want real aliases put symlinks in a private hidden folder, and add that folder to your PATH, or use the alternatives facility.

这篇关于我的Vim为什么不知道我的别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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