Linux users–including the ones at the Hackaday underground bunker–tend to fall into two groups: those that use vi and those that use emacs. We aren’t going to open that debate up again, but we couldn’t help but notice a new item on GitHub that potentially negates one of the biggest complaints non-vi users have, at least for vim which is the most common variant of vi in use on most modern systems. The vim keybinding makes vim behave like a “normal” editor (and to forestall flames, that’s a quote from the project page).
Normally vi starts out in a command mode that it calls normal mode. Pressing a key will execute an editing command, unlike most other modern editors which just insert characters into the open file. For example, pressing x will delete a character. This surprises most people who aren’t familiar with vi. In all fairness, there are other older editors that work this way, but they usually were not screen-oriented.
We keep waiting for the emacs/vi holy war to die off as the old guard retires or forgets how to use computers. You’d think more people would be using kate, atom, or some other really modern editor. But it doesn’t seem to die down–at least not around here.
We suspect the author is going to get threatening e-mails and won’t be able to go shopping without a disguise as the vi faithful will surely find this an abomination. Of course, emacs has several vi emulation modes, and no one has had any more than a car keying over that, that we know of.
We won’t revisit the editor war because we already have covered both sides of it. We’ll just try to get along, at least here in the bunker.
I actually use both. And *love* both: how sick is that? But when I went to the doctor and tried to explain that…
The only thing I hate with passion is having to edit things in the browser. Especially if it is the latest Javascript-wrapped abomination some Web@#$^H^H^Hdesigner is trying to impose upon me.
(This site’s simplicity is one of the things which keep me coming back, BTW. Thanks for that!)
There is a nice chrome plugin that lets you edit web fields in emacs but it is a pain to set up one time. After that it is great.
https://chrome.google.com/webstore/detail/edit-with-emacs/ljobjlafonikaiipfkggjbhkghgicgoh?hl=en
pah emacs, vi – who cares! if there’s no gui kate and atom aint much use when ssh-ing into a box somewhere, I much prefer nano, I just want to edit a file – simple – I *don’t* want the kitchen sink…
This. I also tend to fall into the third group that does not care what the masochist elite says and use nano or pico too. And no, vim does not work for me either.
Count I as another 3rd-optioner.
jed… if only it were a static binary and included in all modern distros.
My problem is remembering what equation results in the save and quit… I once managed to get the text to change, I can’t remember how. It is like Vi and Emacs target audience are those who learnt to run before they could crawl.
Should be CTRL+S for (s)ave, CTRL+(Q)uit, CTRL+(O)pen, CTRL+(H)elp.
The text area should automatically be in edit mode (or whatever the mode is called when typing stuff changes the text on screen in Vi/Emacs).
All other shortcut keys can be anything the programmer wants them to be because at least simpleton and forgetful people will be able to edit scripts and configs in a pinch.
Other said shortcuts could be the first thing displayed on the help screen since things are easier when people can crawl before they walk
I respect your choice to use nano or some other editor at the command line. That’s the beauty of *nix systems — choices aplenty!
I will say that *some* of the vi/vim keybindings are actually quite logical. You use a colon to enter command mode, which is how you tell the editor things (similar to a slash in various IRC clients). w to write the file. q to quit. You can put it all in one command:
:wq
i is for insert mode, which is to say allows you to insert text into your file. ESC (or CTRL+[ if you have no escape key) gets you out of insert mode, so you can direct commands to the editor again.
From there it gets a bit more esoteric, but generally the only other key you need for vi/vim is x which deletes the character under the cursor.
There, using just 6 keys (:, w, q, i, ESC, x), you’ve mastered simple editing in vi/vim.
Vi takes a little while to learn, but you can belt out code much faster once you’ve got the idea of it. You (I) tend to think in Vi-mode as you’re composing the text. Particularly for doing a particular edit several times, eg change something in several consecutive (or non-consecutive) lines of code, a bit of clever commanding and it’s all done by the time you’ve pressed the final key.
I also love the way you can compound commands, and they generally work the way you expect. :wq is just the beginning, baby! You can program cursor movement in to your command sequence, complete with repeats and whatever else, have the computer do the dumb repetitive work of moving it. I have a small suspicion Vi editing commands might even be Turing-complete.
My godfathers! IT IS!
https://github.com/divVerent/vi-turing
Somebody’s written a Turing machine completely in Vi macros! This of course means that all other computers, and their editors, can be run as a simple series of Vi editing commands! Therefore Vi encompasses, and surpasses, all other editors and also all other software altogether.
@Greenaum I remember showing it turing complete back in highschool, though I don’t have a copy so I’m glad someone wrote up a version. The core of mine was based around :map, “, and @. Like you can do :map 0 i1^[ :map 1i0^[ (key 1 inserts a 0, key 0 inserts a 1) then :map go “ax@a (“go” now deletes the current character into buffer a, then runs buffer a). Insert the character one, and “go” now performs not – the one your standing on gets run as a macro, and the macro for 1 is “Insert 0”. If you do it again, the zero you’re standing on gets run instead, which is “insert 1”. The rest is mostly grunt work, you can implement a straight turing machine (with a line as the tape) without further innovation, or implement something like brainf*ck/boolf*ck using the runs with tactical amounts of hjkl cursor movements as a crude instruction pointer.
vi, and by extension, vim, are old enough that the folks who wrote them took older protocols/standards into account in order to keep from hosing things.
Take a look at an ASCII table and you will note that CTRL+S is the ASCII character sent on a serial line for xoff, aka software flow control, or ‘stop sending me data’. CTRL+Q is xon, or ‘start sending data again’. CTRL+H is backspace. The cursor control keys (h,j,k,l) map to the ascii control codes for backspace, linefeed, vertical tab, and form feed. They also map to the left, up, down, right arrow keys on an ADM3a (and may other) terminals of the day.
Also remember that many of the features you take for granted, like the disk/memory space space for a help screen are pretty modern conveniences. The binary for vi/vim on my mac is 1.5MB. The amount of memory on the first system I had that ran VI was 256MB, and it ran off of a 20MB disk. emacs is >11MB.
I ported emacs to unix v6 and System III back in the early 80’s. Just finding a machine with enough memory to run it was a challenge.
The default editor, which came with _every_ unix was not vi. That didn’t happen until it sprung forth from the fingers Bill Joy and company @ Berkeley. It was ed. ed is a seriously minimalist editor, which vi strives to be somewhat compatible with.
One of these days I’ll get around to writing a UNIX history book…
I will purchase that book
A lot of design choices in vi make perfect sense in the context of the systems it needed to run on originally, little memory, less capable keyboards, etc., and little sense in the context of modern systems.
Especially when ssh-ing if you never tried Emacs’ tramp, you don’t know what you are missing :-)
(Spoiler: Edit remote files as if they were local, even over several SSH hops. No more stale SSH sessions).
And don’t get me started on org mode. Have a program snippet embedded in your documentation with its exec output inserted live. Great for teaching & presentations, bye copy-pasta, bye stale results.
\begin{holywar}
Modern does’t mean better. Modern brought us systemd.
\end{holywar}
Modern doesn’t mean better. Modern brought us systemd though, so modern must sometimes mean better.
Systemd is ok, I wish that not all of the common distros had jumped on the bandwagon, and proposed alternatives with diffrent and better features.
Modern (compared to VI) also brought us cursor and control keys.
But there were cursor keys on HJKL for vi
http://www.catonmat.net/images/why-vim-uses-hjkl/adm-3a-hjkl-keyboard.jpg
> \end{holywar}
E_NOT_IMPLEMENTED
https://imgs.xkcd.com/comics/real_programmers.png
Ehh … I like gedit, even when not using the gnome desktop. Though I have found situations where grep, sed, or a perl script do the job better.
Nano is perfect. Does everything I need. A simple, no BS text editor. VI and Emacs be damned to hell
Don’t knock them unless you have tried them. I am an Emacs guy, and the one-key macro recording ability, regular expressions for search, and block edit modes have saved me tons of time.
nano or pico
fastest choice for editing stuff.
however, vi when fresh-installing unix systems or when those above mentioned two editors are the only things available.
Nano? Faster than vim for editing stuff? Hmm. Sure (sarcastic voice)
*faster if you aren’t a VI wiz. Usually all people are trying to do is edit a few lines once in a while, so it’s way faster when you factor in retraining yourself to use VI modes.
Yes, when you need to add or change stuff in config files. My first choice.
Also “ee” from FreeBSD.
Please do not understand me in a wrong way. I do not wish to add a negative aura for vi(m) and emacs.
Getting to know vim pays dividends when you confront an older Unix system (such as SCO OpenServer) or an embedded system (e.g. running Busybox) that only has vi.
That’s the main reason, although if it’s something I control, I still stick something lightweight and simple like nano on it.
But there are things that need to be done before you can put nano on it.
Once of course the system is up, by all means, choose the Right Tool For The Job.
Yep, but if nano won’t compile or run… what then?
No different than any other piece of software. Remember operative phrase “I control”. Someone else system, whatever they have, I adapt.
The author said: “We aren’t going to open that debate up again”. So don’t.
In that case he should have just said “here is something cool for those using vi”, instead of his “two groups” nonsense. What did he expect after a remark like that?
I’m sure the largest group is the third one, the group of those using anything that isn’t vi or emacs.
hear, hear!
(im in the third camp as well. although at 47, I should at least have tried. bit i did’nt…)
ed is the only true choice: https://www.gnu.org/fun/jokes/ed-msg.html
Trying out posting a comment to hackaday using ed?
?
?
?
Ok, how to use this thing??
exit?
save?
post?
^C
?
^D
?
^L?wtf y u no clear??
help???
Ah, I think I found the key sequence to post, it is:?
Like!
dd is all you need.
Nothing like:
echo function() >>file.ext
syntax error near unexpected token `(‘
Yh, well spotted.
I forgot if the text had to be wrapped in double quotes or something.
Is there a command line text editor for Linux like the old edit for MS DOS. That text editor was perfect and did not do stupid things. Also it worked like NOTEPAD FOR WINDOWS. nO FRILLS. jUST WORKED.
Jed is the editor you’re looking for,
Screenshots page of jed [Link]
Thanks. That looks great. I will have to give it a go when I get home.
vi doesn’t do stupid things. That is left up to the user.
Yep, the user is at fault of opening a text file and everything he types gets turned into commands, that is before trying to find the help:
F1 – nope
:help – wtf just happened and what is this error?
:h – Cant remember what it did but it wasn’t what I wanted
:edit – error/does nothing?
:exit – nope
:end – nope
:quit – nah
[ALT]+[SysRQ]+b – ah there be the quit sequence!
Edit? You mean EDLIN.
EDIT was the screen editor that was basically QBASIC in disguise. EDLIN was the line editor that worked even if you used CTTY COM: to edit your batch files from a serial terminal.
Now get of my lawn :)
That’s CTTY COM1:
stupid autocorrect
what happens .. why is this browser tab not closing …
(says the guy instinctively trying to “:q” after reading the article)
https://github.com/philc/vimium/
What I don’t get about this is that surely if you have the savvy to set up vim with this plugin, you can already use vim for editing just fine.
That was my first thought. Unless it gets installed via apt.
I found the schematics to build a vi compatible keyboard:
Obligatory xkcd here [link if the picture doesn’t embed]
[That was not the obligatory XKCD I expected.](https://xkcd.com/378/)
vim is nearly as bad as emacs, and that’s really bad. nvi forever.
For LISP people (a dying breed) Emacs fit’s the bill.
If vi then nvi!
\o/
Arguing about vi vs emacs is like arguing about Holley vs Rochester carburetors. Not a bad thing to know how to tune or rebuild a carburetor even if old cars aren’t your hobby, but they’re obsolete and I’m not going to defiantly put one on my 2013 Accord because ‘good ‘ole days’!
This is a test comment… feel free to removed it…
Here goes:
Can I
embed a HTML tag in a code tag?
Probably not what I’m expecting…
It works :),
These two posts can now be removed as they’re irrelevant to the article.
Actually, that might make for an interesting article, HaD writers: something that teaches the lesser known, but sometimes useful things that can be done in the comment section.
Sublime Text here, though I should switch over to Atom. I learnt ctrl + s is save, ctrl + w to close a tab etc. and can’t break that habit long enough for vim keybindings to set in.
Oh and since those aren’t everywhere, Nano if it’s a small edit.
Has anyone mentioned JOE yet?
Joe’s Own Editor should be part of this silly fight for two reasons:
1. It can emulate many other editors including WordStar
2. Its name is a recursive acronym.
https://en.m.wikipedia.org/wiki/Joe%27s_Own_Editor
Let’s port WordStar!
Funny thing about running old OSs in VMs. You can get, just as good, software for free.
CP/M Wordstar! woot
What else?
The utterly brilliant and ultra-compact WordStar-like editor that was built into Borland”s Turbo Pascal for CP/M.
I have a 5 1/4 floppy with wordstar for the Osborne executive, yet no system disk.
My life sucks.
“We keep waiting for the emacs/vi holy war to die off as the old guard retires or forgets how to use computers.”
I’m a young whippersnapper, and I use Vim. I suspect I’m far from the only one. But do go on about how using drool-proof software makes you superior. It’s just a tool. Use whichever you like and leave the pretentiousness in the past, so it can finally die.
Wait a generation or two and then watch them chissel emojis into bitstone walls instead of typing stuff…
…the end is neigh!
At first I was suspicious and confused about why someone would wanna take the modal functions out of a modal text editor, but after looking at the project itself, I can see why it could be useful to people.
I guess you could see it as the compliment to evil mode being in emacs.
It still gives you access to the command mode when you need it so it could be a useful stepping stone for those wanting to learn VIM.
I’ll stick with traditional VIM mode though, I’m used to it by now.
I honestly tried to use other editors than Vi, but they all have this very annoying bug, where they randomly insert “:w” all over the file.
HA!
I had a similar problem with Vi, it kept typing ^c.
Sacrilege!
Why i haven’t moved to a more recently created editor…
1) I have been using BOTH vi and emacs for over 25 years. Any new editor would have to offer me something worth learning a new set of editor commands.
2) If i ssh into a system i know vi will be there. And both emacs and vi are usable without a gui.
3) I really need a heavy weight editor. I need an editor that can deal with syntax highlighting and indenting a file that has html, ruby, and javascript all at once. Or where i can record a keyboard macro and run it 1000 times.
4) newer editors tend to shy away from keyboard commands. I can work a lot faster when I’m not having to move my hand between the keyboard and the mouse all the time. also its hard to do keyboard macros when you don’t have good keyboard commands
5) they always seem to be missing some feature here or there that i don’t want to give up. For example i looked briefly at the docs for atom and kate and while they both mentioned being able to split the view in the window, neither of them indicated that they could have multiple windows. (having multiple windows is really handy when you have two monitors with one portrait and one landscape)
I throw some logs into the flames
+1 emacs 20+ years user. I can’t live without multiple command, multiple cursors, regexp, snippets and a tons of other stuff. And I can even roll my own functions in lisp. When you have to create or edit a couple of 10000 lines of header files for embedded systems, these features are essential.
@EE same here but for 100000+ lines of sql files. It has saved my butt many times recovering broken database driven websites. especially nice with regexp. to be able to find the correct string to replace
Vim is great but……. It doesn’t replace IDE. Once you need good auto completion or just go to definition, Eclipse is the right place.
For example, when you working with shared libraries, for example boost, to parse it with vim, for auto compilation, it is disaster.
For just text editing, vim is the right choice.
I loved a good IDE when I was stuck on a single tasking OS. With a modern OS and GUI desktop I can do as well with a text editor in one app, and running build utilities on the command line. And a debugging environment independent of both.
I thought this was a great idea, I never understood why vim does not work “the usual way” in insert mode (except “because it was coded before there where ‘usual’ way in editors) but this plugin completely removes normal mode! why??
I don’t know much about plugins and vim script is magic to me, is bringing back normal mode when escape is pressed a easy fix?
I have always been perplexed by this “usual way” talk. What the h*%$$# are people talking about? What establishes this “usual way”? But I am just hard core I guess. My first editor was SOS on DEC computers, then it was on to ed, ex, and then vi on edition 7 unix. And I have been using vi (and now vim) ever since. So when people talk about some normal standard, I am perplexed. I know they aren’t talking about emacs. Why not put a name on it? Are we talking about windows notepad or whatever it is called?
Vi having two modes is genius. Mapping it into some “normal” editor is stupid, it is just going to lead to misery and trouble. A bad idea from the start. I guarantee it will sort of work, but you will be continually falling into holes that don’t make sense. If you have a normal editor you like, just use it and be happy. Or learn to use vi and be happier.
“Linux users–including the ones at the Hackaday underground bunker–tend to fall into two groups: those that use vi and those that use emacs.”
An you forget about the Zillions that use Windows Notepad and just copy-paste over via SSH. What a mess. I think there’s a similar-same problem with Apple OS machines, Apple chose to use non-Unix line-ends just to be incompatible (the Greedy Bastards).
Correction: “…and just copy-paste over via SSH” => “…and just copy-paste over via SFTP/SCP”. Sorry.
If someone’s capable of understanding SSH, then they’ll be using something like Notepad++.
I’ve never used emacs, but I hate vi… until I install vim, that is. Once you install vim, vi acts like you would expect an editor to act.
vim acts enough like a modern text editor that I’m not tempted to zap it with an orbital ion cannon. I still prefer nano if stuck in a terminal environment.
I’m old enough to remember Wordstar…
were you high when you wrote this?