Why does my vim command-line path differ from my shell PATH?

后端 未结 4 574
北恋
北恋 2021-02-08 02:37

e.g.,

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/bin:~/bin:/usr/local/Cellar/python3/3.2.3/bin

$ vim 
:! echo $PATH
/usr/bin:/bin         


        
4条回答
  •  感情败类
    2021-02-08 03:33

    I don't use mac or zsh (I am on linux), however I ran into this problem when I ran gvim from the MATE Menu.

    I solved it by adding this to my .vimrc:

    if $PATH !~ "\.rbenv"
        let $PATH="/home/username/.rbenv/shims:/home/username/.rbenv/bin:" . $PATH
    endif
    

    This avoids setting it if you run vim from a terminal, otherwise the rbenv paths would be included twice.

    I tried setting the application to run via a terminal, but that didn't help.

提交回复
热议问题