Why doesn't my vim know my alias?

前端 未结 3 1357
后悔当初
后悔当初 2021-01-05 04:11

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

ruby 123.rb

or

ruby1.9.1 123.rb

相关标签:
3条回答
  • 2021-01-05 04:54

    You can try

    :set shellcmdflag+=i
    

    to call bass as "interactive" although that does give an annoying message for every shell command executed.

    0 讨论(0)
  • 2021-01-05 05:11

    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 aliases are only a convenience when you enter a command line in the Bash shell. They are expanded by Bash only.

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

    0 讨论(0)
  • 2021-01-05 05:11

    Aliases (unlike environment variables) are not inherited by subshells. So if you want an alias always available, you need to set it in your .bashrc file, so every instance of the shell will get it on startup

    0 讨论(0)
提交回复
热议问题