No ponto em que você digita vim filename na linha de comando, o shell já foi iniciado, portanto, o shell (e o emulador de terminal) não obtém vim como um argumento de linha de comando.
vim , por outro lado, mas isso não está disponível para o usuário. Quando um programa é iniciado, seu nome é geralmente dado como o argumento de linha de comando zeroth. Você pode ver isso iniciando um shell e fazendo eco de $0 :
$ sh
$ echo $0
sh
$ exit
O shell executa os comandos na linha de comando usando execve() (ou uma função exec() semelhante), cuja especificação POSIX diz
The value in
argv[0]should point to a filename string that is associated with the process being started by one of theexecfunctions.
argv[0] no texto acima corresponde a $0 em um script de shell.
A seção Justificativa continua dizendo:
The requirement on a Strictly Conforming POSIX Application also states that the value passed as the first argument be a filename string associated with the process being started. Although some existing applications pass a pathname rather than a filename string in some circumstances, a filename string is more generally useful, since the common usage of
argv[0]is in printing diagnostics. In some cases the filename passed is not the actual filename of the file; for example, many implementations of the login utility use a convention of prefixing a<hyphen-minus>(-) to the actual filename, which indicates to the command interpreter being invoked that it is a "login shell".