Which distro has vi installed by default? All the distros I've used had vim-tiny (or something similar), but never vi. In fact, the only distro I've used that has it (in the repos, not pre-installed) is I think Arch (the port from Sourceforge). None of the other major distros (Debian, Fedora, Ubuntu) have it in their official repos.
There's just so much in vim that isn't in vi. Have you ever actually tried the original vi, not just vim in 'compatible'? You can grab the source here and give it a go: http://ex-vi.sourceforge.net/. I had to change the Makefile and point the TERMLIB to ncurses to make it work in Ubuntu.
Just the top of my list of things that are missing that I couldn't live without:
> Vi is not open source
As for vi
being a symlink to vim
, that's not always true. On my Arch Linux laptop, :ver
gives:
> Version 4.0 (gritter) 3/25/05
And you don't need to install gvim if you're just going to be using it in the terminal.
Well, considering Bill Joy's original paper An Introduction to Display Editing with Vi has a section titled "4.2. Higher level text objects" I wouldn't say that vi doesn't have text objects. Vim's text objects are a more powerful extrapolation of the original commands but not THAT much more powerful.
The nicest thing about them is that they aren't sensitive to where the cursor is: "diw" (delete inner word) will delete the word that your cursor is on, whereas "dw" (delete word) deletes from wherever the cursor is to the end of the word. But in vi just press "b" (move back word) to place the cursor at the beginning and then "dw" and you have the same thing, Vim didn't save you any keystrokes. Neither does "daw" (delete a word): in original vi, "df*space*" (delete find space forward) nets you the same result.
The original vi has support for sentences, paragraphs, and code blocks too, just like vim does. I think the perception that ex/vi are useless stems from the shoddy vi emulation in all GNU software. Hell, even vim's vi emulation gives me the hiccups sometimes.
http://docs.freebsd.org/44doc/usd/12.vi/paper.html
best vi reference: http://ex-vi.sourceforge.net/viin/quickref.pdf
vi is also open source, and the code is at least a lot shorter than vim, though I haven't looked through it so I can't attest to its readability. If I were starting a vi-like editor, though, that's probably what I would use as my point of reference.
~ % pacman -Qi vi Name : vi Version : 1:070224-2 Description : The original ex/vi text editor URL : http://ex-vi.sourceforge.net/ Licenses : custom:ex Groups : base Installed Size : 290.00 KiB
/usr/bin/vi<CR>:version<CR>
:
Version 4.0 (gritter) 12/25/06
Because most OSes use a tiny version of vim as a vi implementation. Try this on eg. Arch Linux and you won't see "Welcome to Vim" because they use a different vi implementation.
This is similar to how must OSes' /bin/sh
is bash
.
Vi originally is the visual mode for the ex editor. Here you have a working source code: http://ex-vi.sourceforge.net/ If you here https://minnie.tuhs.org/cgi-bin/utree.pl and search for ex or vi you can find some interesting things too
$ cat /etc/issue Ubuntu 16.04.2 LTS \n \1 $ type vi vi is /usr/bin/vi $ ls -l /usr/bin/vi lrwxrwxrwx 1 root root /usr/bin/vi -> /etc/alternatives/vi $ ls -l /etc/alternatives/vi lrwxrwxrwx 1 root root /etc/altneratives/vi -> /usr/bin/vim.basic
The reason it's always vim under the hood is because nobody maintains the real vi anymore. The last update was 12 years ago.
True: vim on my system pulls in 13M, which may be a bit excessive for text editing, but at least is only 6-7 times the 2M transfer size of a typical webpage. Back when vi was only 160K, it was probably 60-70 times as large as a typical USENET article.
Hmmm, thought I'd tweaked a bit more of it ... maybe what I remember was more reading about some of the various settings - and hadn't actually gotten around to changing them? Looks like I set up one fairy simple script to cleanly do the build ... don't think/know that I'd tweaked/adjusted further than that.
Compared the files I have in my build directory, to those in the ex-050325.tar.bz2 file - didn't find any differences.
$ cat mymakeit #!/bin/sh
# http://ex-vi.sourceforge.net/ # https://sourceforge.net/projects/ex-vi/
set -e
[ -f ex-050325.tar.bz2 ]
rm -rf ex-050325 >>/dev/null 2>&1 || :
[ ! -e ex-050325 ]
umask 022
<ex-050325.tar.bz2 \ bzip2 -d | tar -xf -
cd ex-050325/
# 5bin, rather than bin, as many default PATH settings put # /usr/local/bin ahead of /bin and /usr/bin
make \ BINDIR=/usr/local/5bin \ PRESERVEDIR=/var/local/preserve \ INSTALL=/usr/bin/install \ TERMLIB=ncurses $
True. But, similar to how Vim is not vi
, and yet, many operating systems ship it as vi
, Nvi is both vi
and not vi
.
The reason for my previous comment: Neovim-is-not-Vim is a matter of fairly frequent discussion in this subreddit, and I thought abraxasknister was alluding to those discussions having assumed nvi is nvim. So, I thought I should clarify.
You are correct that Nvi is not the vi. ex-vi is the (or, closest to the) vi.
i know that, but traditional vi that i linked is just an implementation. probably closest one to the original that is available. my questions are - is that implementation posix compliant? also if not, are there any that do comply?
well i think youre wrong about that
i googled this specific implementation, i googled if theres any implementation that is posix compliant, i visited official websites of implementations, but didnt find any informations on them that confirm meeting the standard, also i thought its not clear on the traditional vi website about posix compliancy and i looked through multiple manuals man pages and so on. i also didnt find the answer that states there are no posix compliant implementations and i think i did what i could to find what im looking for. if im wrong about you and it really is not hard then please link me the answer and ill apologize
It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!
Here is link number 1 - Previous text "vi"
^Please ^PM ^/u/eganwall ^with ^issues ^or ^feedback! ^| ^Delete
On Arch Linux they actually have the proper vi installed as part of the vi package:
Name | vi |
---|---|
Version | 1:070224-2 |
Description | The original ex/vi text editor |
Architecture | x86_64 |
URL | http://ex-vi.sourceforge.net/ |
Licenses | custom:ex |
Groups | base |
Provides | None |
Depends On | ncurses |
Optional Deps | s-nail: used by the preserve command for notification [installed] |
Required By | None |
Optional For | None |
Conflicts With | None |
Replaces | None |
Installed Size | 290.00 KiB |
Packager | Evangelos Foutras <> |
Build Date | Sun 06 Sep 2015 09:34:15 PM CEST |
Install Date | Wed 30 Sep 2015 08:52:09 AM CEST |
Install Reason | Explicitly installed |
Install Script | No |
Validated By | Signature |
On a few I've used (including Arch), it's actually ex-vi. None of the bloat of vim -C
.
It actually surprised me when I realized this, because Vim has a lot of stuff in :compatible
mode that vi
simply never had.
Are you actually using vim and writing a script for vim (the editor) in vimscript to show you the date, or are you writing a script in the bash/shell language to show the date? If you know for certain that the version of vi you're using is not vim (or you're not writing vimscript), then I would recommend checking out /r/bash and /r/shell. Also, Bash has a very helpful builtin command called 'select' for making menus.
I just tried compiling emacs-18 (the oldest version obviously floating around on gnu.org) and it didn't compile cleanly; getline
has had interface changes since then.
There is ex-vi, which is the original vi with a few minor updates. Maybe I'll give it a shot.
EDIT: compiles. Works (you need to create a symlink called "vi" aimed at "ex" and then run the "vi" symlink). I don't know enough about vi to know what has changed. :q works, hjkl works. $ and ^ work. "i" to enter insert mode works. "u" is undo, but there's only a single undo.
That's incredibly odd. POSIX says this is the correct behavior for the named registers but not the unnamed register, yet both vim and original vi move to the end of the pasted text for both named and unnamed registers (unless the register's buffer is in character mode but contains multiple lines) on my system.
I could see that getting annoying very quickly though.