I want to create a simple script to launch nvim (not gvim) in separate terminal window (I'm using urxvt term). Currently I have:

#!/usr/bin/env bash

exec urxvt -hold -e "vim"

It seems legit and works but the problem is that vim theme is not loaded when opening the terminal (probably because .bashrc is not read or some other weird issues with base16-shell).

Plugins do load though which means that nvim's init file is loaded. I tried to do something like

exec urxvt -hold -e "source <absolute_path>/.bashrc; vim"

to force base16-shell to load the terminal theme (which might be a dependency for a vim's one) but it still doesn't work.

I feel that I'm missing something but I can't get it right. How to get this script working?

1 Answer 1


Ok, so I solved the problem. It turned out that -e flag runs a command without actually launching interactive bash shell which means that bash doesn't read .bashrc on startup.

As base16-shell initializes terminal theme (which is indeed a dependency of vim's base16 theme) running a script from a .bashrc in the end nvim is launched with a default colors (as dependency is not loaded and base16-vim can't initialize properly).

So the solution is to launch interactive bash shell explicitly to read .bashrc and load base16 theme and only after that launch nvim (which is aliased to vim in my occasion).

Here is the whole script:

#!/usr/bin/env bash

# -hold urxvt option is not needed as vim stays running
# -i bash option to run interactively
exec urxvt -e bash -i -c "vim"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .