vi 7.2 and 7.3 do not exist. There is only vi 050325 and vim 7.2, two entirely separate programs with similar features. If you want vim, type
The reason your alias does not work is because aliases are expanded by your shell, and the shell does not know what each program will be doing – it sees "
sudo" as the command and "
vi myfile" as arguments, and only attempts to expand the first word, "
sudo", without daring to touch the arguments.
You can tell bash to expand aliases following certain commands, by adding an alias such as: (note the space inside quotes is required)
alias sudo="sudo "
The space will tell bash that the first word after "
sudo" is a command that should be expanded – for example,
"sudo vi ..." to "
sudo vim ..." will work now.
The answers telling about
/root/.bashrc are incorrect for several reasons. First,
sudo executes the given command without running a shell. (This can be changed by using
sudo -s cmd or
sudo -i cmd, but if neither option is given, the default behavior is to execute the command directly, without a shell.)
Second, bash will only expand aliases when run in interactive mode, not when run as
bash -c cmd, which is what
sudo would use. (Again, this can be changed, but the default setting is to only expand aliases interactively.)