Vi syntax-highlighting after executing vi within bash script

Viewed 104

I created this Stackoverflow account only for asking this question:

Is there a way to tell Vi to do syntax-highlighting when executing it from within a script like this:

#!/bin/bash
vi /path/to/script.sh

I was trying things like this and other stuff like sudo su - in order to reset the environment, but nothing worked..

Any chance a to make it work(preferably without editing the .vimrc)?

Thanks :)

1 Answers

You can run a command when you launch vi after the file is loaded:

vi -c "syntax on" /path/to/script.sh

That should turn on syntax highlighting

Related