Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

VI annoyance



On 08/11/2010 09:27 AM, Grant M wrote:
> If you actually type "vim filename" does it behave differently? I seem
> to recall that it did on some platform I worked on. On whatever that
> particular OS was, if you typed "vi filename" it behaved like the
> original "vi", but if you typed "vim filename" it had all of the
> features of a recent vim version. Both commands ran the same vim binary=
,
> but somehow using 'vi' changed the behavior.
>
> Grant M.
>  =20
That is because it uses the name it was called by to set its behavior.
For instances, if you type 'ex filename' you will be in ex mode, but the
executable will still be vim.  The grep and egrep commands work the same
way. /bin/egrep is symlinked to /bin/grep, but the behavior is as if you
typed 'grep -E'. This is a technique that has been used in Unix for the
past 40 years (except Unix generally hard links the commands where Linux
normally symlinks). Remember that the first argument (in C argv[0]) is
always the name of the command that was typed on the command line or
executed through X. The command then sets its behavior based on that.
So, if you type 'view filename' the behavior will be that 'filename' is
edited as read-only.

--=20
Jerry Feldman <gaf-mNDKBlG2WHs at public.gmane.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846








BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org