Background
Control whether row numbers are displayed after vim starts (in a non-interactive mode).
Problem
A shell script contains the following code:
echo Converting $1 to $1.html...
NUMBERS="-c set number"
if [ "$2" == "" ]; then
NUMBERS=
fi
vim -e $1 -c "set nobackup" $NUMBERS -c ":colorscheme moria" \
-c :TOhtml \
-c wq -c :q
The script (src2png.sh
) is invoked as:
./src2png.sh src2png.sh
And also invoked as:
./src2png.sh src2png.sh numbers
In the second case, vim should be started with numbers along the left-hand side. (The word "numbers" can be anything, so long as it is not empty.) I have tried several syntactical variations without success:
NUMBERS=-c "set number"
NUMBERS="-c set number"
NUMBERS="-c 'set number'"
NUMBERS="-c \":set number\""
All of these fail when starting vim, for various reasons. (Usually, "Error detected while processing command line:".)
Question
What is the correct syntax to allow a second command-line parameter to control whether or not vim starts with row numbers displayed?
Thank you!