2 Answers
2

Aliases are internal to each of your current shell environments - they are expanded by the currently running shell (bash in your case), so they only have effect on what you execute by typing/pasting in your terminal.

You have at least two options here:

create a wrapper script named vii that will execute vim -c 'startinsert' and put it preferably in /usr/local/bin/ (or $HOME/bin, if it exists and is in your search path). The script only needs to contain

#!/bin/sh1
exec vim -c 'startinsert' "$@" 2

(Make sure to make it executable by running chmod +x /usr/local/bin/vii.) Depending on the PATH configuration of your git/other programs, you may need to specify full path to that wrapper script (i.e., editor = /usr/local/bin/vii).

If it is ok for you to have vim always start in insert mode, configure it to do so by adding startinsert at the end of .vimrc.

1 You can write the "she-bang" line as #!/bin/bash, but there's no need to in a script that contains no bashisms.2$@ must be in double quotes in case the script is ever called with argument(s) that contain space(s). startinsert does not need to be quoted (but it doesn't hurt).

For your other answer, no, you can't place aliases in a directory, as an alias is a concept from your shell. The normal way is to create an appropriate wrapper script to execute the specified commands, e.g.,

#!/bin/sh
vim -c 'startinsert' "$@"

and save the script as vii and make it executable. You can place the script wherever you like, but typically such scripts are saved in somewhere in your $HOME folder like $HOME/bin and not in the global directories.