Hacker News new | ask | show | jobs
by jachee 2382 days ago
On any given *nix system that's current today, `vi` is a symlink to `vim`.

You can check yourself with `ls -l $(which vi)` in bash.

4 comments

Allow me to show my work (within the confines of HN's mostlyuseless formatting system):

Raspbian: [jachee@mmmmpi:~] [23:10:54] ▷ ls -l $(which vi) lrwxrwxrwx 1 root root 20 Sep 3 2016 /usr/bin/vi -> /etc/alternatives/vi

[jachee@mmmmpi:~] [23:11:11] ▷ ls -l /etc/alternatives/vi lrwxrwxrwx 1 root root 18 Sep 9 2016 /etc/alternatives/vi -> /usr/bin/vim.basic

CentOS: [jachee@jachee:~] [00:12:29] > ls -l $(which vi) ls: cannot access alias: No such file or directory ls: cannot access vi='vim': No such file or directory -rwxr-xr-x. 1 root root 2294208 Oct 30 2018 /usr/bin/vim

[jachee@jachee:~] [00:12:53] 2 > which vi alias vi='vim' /usr/bin/vim

Homebrew: [jachee@gyrate:~] [00:14:15] ▷ ls -l $(which vi) lrwxr-xr-x 1 jachee admin 29 Aug 6 11:14 /usr/local/bin/vi -> ../Cellar/vim/8.1.1800/bin/vi

[jachee@gyrate:~] [00:14:28] ▷ ls -l /usr/local/Cellar/vim/8.1.1800/bin/vi lrwxr-xr-x 1 jachee staff 3 Aug 3 12:17 /usr/local/Cellar/vim/8.1.1800/bin/vi -> vim

No-Homebrew Catalina: [jacobachee@jachee-mbp15:~] [00:17:24] ► ls -l $(which vi) lrwxr-xr-x 1 root wheel 3 Nov 19 11:46 /usr/bin/vi -> vim

Edit - for an actually-readable version of the above, see https://gist.github.com/jachee/eaa8610312ebd7723fc76e8d71da7...

That's not remotely true. Even archlinux links to ex.

Type vim if you mean vim. Even if vi is aliased to vim, it's possible you'll end up in ex compatible mode anyway.

However, some modern vims check which incantation they were started with and modify their behaviour accordingly (e.g. nocompatible vs not).
That is not always the case. Clearly, you’ve never encountered “vim: command not found” but found vi to work without a problem.
Not in at least ten years. Except for on BusyBox systems.
That's the default behavior on Raspbian as well.