cknadler / vim-anywhere

Use Vim everywhere you've always wanted to
MIT License
3.67k stars 146 forks source link

add support for $VISUAL editor #72

Open averagechris opened 6 years ago

averagechris commented 6 years ago

Hi there,

I added the ability to use any editor by checking for $VISUAL after sourcing .profile if it exists. I find it pretty handy and it seems like there were some other requests so I decided to put it in a PR.

Dbz commented 6 years ago

@mistahchris I copied your code locally. I use (normal) vim with zsh. I put export VISUAL='vim' in my ~/.zshenv.

I believe the problem are lines similar to if [ -e $HOME/.profile ]; then. What if we just check for the existence of $VISUAL in the environment instead of just in .profile? I noticed that you do: if env | grep -q "VISUAL"; then which does that.

averagechris commented 6 years ago

That is a good idea @Dbz. You would still often want to define VISUAL in profile depending on how you call the script. For example, in Mac OS's automator, the bash shell there isn't login, if i recall correctly, so it'll only source .profile. But I think the env solution would actually cover that.