u123
u123

Reputation: 16267

Vi/Vim behaves quite different on remote server compared to on my local (ubuntu) PC

On my local PC I am running Ubuntu 20.10 with Vim:

:version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 11 2020 17:00:59)
Included patches: 1-716

In this version I can undo text with Ctrl + u open a file explorer with :Explore which is fine.

On another (remote) linux/ubuntu machine (where I don't have permission to install anything):

$ cat /proc/version
Linux version 4.15.0-1111-azure (buildd@lcy01-amd64-016) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)) #123~16.04.1-Ubuntu SMP Sat Mar 20 01:52:07 UTC 2021

and:

$ cat /etc/os-release 
NAME=Buildroot
VERSION=2014.02
ID=buildroot
VERSION_ID=2014.02
PRETTY_NAME="Buildroot 2014.02"

I cannot use those Vim commands. E.g. if I:

:Explore
'Explore' is not implemented

and Ctrl + u does not work either. Further:

:help compatible
'help' is not implemented

I can get the version:

:version
1.22.1 2014-09-13 22:15:30 PDT

Its definitely another version of Vim(vi?) compared to the one on my host system.

Is it some vanilla/old/minimal version of Vi that's on this machine?

How do I know if its Vi or Vim (pretty limited info from :version)?

I can use the arrow keys to navigate so I expect its some minimal version of Vim.

Also on the remote machine:

$ which vi
/bin/vi
$ which vim
$ whereis vim
sh: whereis: not found

Upvotes: 0

Views: 250

Answers (1)

romainl
romainl

Reputation: 196476

What you have on that host is neither Vim nor the original vi. It is "BusyBox vi", a partial reimplementation of vi that is part of the BusyBox project.

If you want Vim, you will have to install it yourself in your $HOME or ask the administrator of that machine to do it for you.


As a side note, the ubiquity of Vim (and vi) is a sadly common misconception.

POSIX-certified systems must have a vi command that follows the specs but how that command is actually implemented is left to the vendor. On some systems it might be the original vi, on other systems it might be a minimal Vim, or a maximal Vim, or nvi, etc. Then you have Linux vendors, who generally try to follow the spec but are not bound to it. Then you have VM/container-oriented distributions that tend to strive for minimalism and may not even have a vi command to begin with. And then you have Vim itself, which can be built with or without this or that feature and has never stopped evolving anyway so two Vims are rarely the same.

Outside of the world of containers, it is relatively safe to assume the presence of a vi command on a Unix-like system, but where the behaviour of that command lies on a spectrum from the vi spec to a complete GUI build of the latest Vim is pretty much a game of roulette.

In the world of containers, it is best to not assume anything.

Upvotes: 3

Related Questions