Search code examples
linuxvimtmuxxonsh

How to fix vim throwing error when SHELL is set to xonsh?


When I start vim I get:

Error detected while processing /home/kossak/.vimrc:
line    1: E484: Can't open file /tmp/vdf7WFR/0
Press ENTER or type command to continue

My first line in ~/.vimrc is let s:uname = system("uname -s").

The error happens because SHELL env var is set to /home/kossak/.local/bin/xonsh. It is set automatically by tmux, because of set -g default-shell /home/kossak/.local/bin/xonsh in my .tmux.conf. I'd like to manually set $SHELL to /bin/bash, without changing default-shell of tmux. Is it possible?

I know I can run tmux setenv -g SHELL '/bin/bash' in CLI and then new panes will have new value, but how to do it in .tmux.conf, so tmux does it automatically for me?

I tried adding setenv -g SHELL '/bin/bash' to .tmux.conf but it doesn't work (the value of $SHELL is not changed).


Solution

  • Just tell vim to prefer bash, to make your vim consistent.

    if executable('bash')
       set shell=bash
    endif