Hacker News new | ask | show | jobs
by k__ 4289 days ago
"... similar to the command line mode ... Unlike the command-line mode you won't return to normal mode automatically ... enter ... by typing a Q in normal mode"

So they have a mode you enter when pressing q (which quits many other programs) that you can't leave if you don't know the leave command?

This is comedy gold. :D

4 comments

As much as vim is known as the modal editor, that sounds like you're describing Emacs (I'm using evil-mode instead of vim these days.) Whereas vim has dual-modality as its core, it's very well-defined and self-contained as far as modes go, and with the exception of this Ex mode, you can get out of any weird state by pressing Esc. Emacs, on the other hand, has potentially dozens of different 'modes' you can accidentally find yourself in, and each one seeming to have a different way of getting out, it drives me insane! Even a question in Emacs which can only be answered by typing out 'yes' or 'no', and by no other frigging escape sequence, is a mode come from hell. Worse yet, press Esc and Emacs goes into the mode of a mode where it briefly becomes unresponsive as it lets you know that you are WRONG.

Vim to me is like having a smooth technical conversation with a work partner. Emacs is like conversing with my partially deaf grandpa.

I'm interested to hear why you're using evil-mode instead of vim if that's how you feel. I'm using vim with slimv for Lisp hacking at the moment and I have to admit that there are some whoopsies, but not enough to make me learn to use a whole new editor :)
Well, rant and occasional surprise aside, I've found evil-mode to truly be a better implementation of vi than vim itself, at least where it concerns me (as formerly a pretty advanced vim user and plugin developer, it took me some adapting to stop using all the ex vim idioms and the like.) It's faster to handle big files and execute macros, overall snappier and has a profoundly better %s///g with real time preview.

I really did start using Emacs when I started learning Clojure(/Script), though, and made it my main language and platform investment. And org-mode had been playing a part in my want of switching for a while, building up for years. I also told myself it'd be better to hack in a lisp but Elisp is so fucked up I still haven't mustered up the courage to properly learn all its old and unexpressive idiosyncracies (god, even creating a closure requires explicit verbosity!) Meanwhile I don't think I can bear VimScript anymore--since getting into Clojure my language standards have gone considerably up. As a result I do the odd hack but haven't developed more powerful plugins in a while, not in elisp nor vimscript; I'm in a psychological limbo there. Kinda hoping Guile-Emacs takes off so I can do stuff in scheme.

I tried using evil and it just messed up my brain too much. I learned emacs and vim properly and their methods of operation are now ingrained in my muscle memory, entirely separate from one another. To go back now would be like asking someone to use a mouse and keyboard to drive their car.
Thanks for the insight, much appreciated.

Out of curiosity, what do you mean by 'verbosity' in this case? I just Googled and it looks like Elisp uses the same (lambda (arg) form) syntax, like CL---is this what you're referring to?

Lexical binding is a "new" feature for elisp. See:

http://www.emacswiki.org/emacs/LexicalBinding

...for some of the issues.

Would you say that emacs (with evil-mode) is significantly better than vim using ScreenShell or slimv, for clojure development?
I really didn't try Clojure on Vim, at the time Emacs seemed unambiguously like the authoritative option and it did serve as an excuse for me to jump into Emacs. For Clojure though, I find that Paredit tremendously reduces my need of vim motions. But evil-mode is great for all my prose editing needs (along with org-mode) and I do find it more robust than Vim at all the fundamental vi functionality.
C-g almost always helps.
Not "q", but "Q".

Actually, when entering Ex mode you get a little helpful message that says Type "visual" to go to Normal mode.

If you do press "q" though, you're in macro mode, and you don't get any helpful message that tells you that you have to press "q" another time to exit it.

To be clear, it's q at the : prompt to quit vim, whether in visual mode or ex mode. It's Q in normal mode to enter ex mode (or you can start that way with -E).
I see, thanks for the clarification :)

Vim always seems like magic to me. I always use nano/pico when I need to edit something in the command line.

I'll tell you the dinky stupid reason why I started using vim over nano:

I like my shells to have white backgrounds. I don't know why, but it's just restful to my eyes. Nano's default syntax highlighting on bash scripts is to highlight strings in bright yellow, which on a black backdrop makes sense, but on white is impossible to read.

It took years of working with shell scripts, and a familiar litany of "I'll just look up how to change this... [one hour later] I have no idea, let's just change my Konsole background to black for a little while..." before one day I was like, "Dammit, I just need to change this one little thing over here" and typed vi instead, thinking that it was so simple that surely it'd have no highlighting.

But it did have highlighting, and it was highlighting which wasn't bonkers like nano's was.

I had struggled with vi a lot before. I did not like it. Still don't. The thing is, they could probably have won me over a million years earlier by starting me off at insert mode on the first line! It is modal, and I don't even like the modality of my cruise control system on my car, let alone the modal nature of vi -- but at least a text editor should dump a beginner in the mode which, y'know, edits text. I'm only just getting used to hjkl keys, and only then because of nethack. I don't know enough to make super expert use of vim.

But, all that aside, it won because it didn't force me to squint at yellow-on-white text every time I was SSH'ed into a system which needed me to edit string-laden syntax-highlighted files.

"The thing is, they could probably have won me over a million years earlier by starting me off at insert mode on the first line!"

I wouldn't like "open in insert mode" at all - if I'm opening an existing file, I probably want to edit it, not just add text (especially not at the beginning) - which means the first thing I'm probably wanting to do is navigate, which is much easier done in command mode.

When opening a new file, there's a better argument for starting in insert mode, but even then I'm likely to want to populate the buffer with the output of some command.

Of course, hitting escape first isn't disastrous - but neither is hitting i before you type.

All of that said, my defaults don't need to be your defaults! Add startinsert to your vimrc to get the behavior you want:

    echo startinsert >>~/.vimrc
Very interesting! I'm more interested in it as an attraction to new users; I agree that "morally" it should probably start in command mode since it should be designed for its most common use cases first.

I'm just observing that I would have understood it much more rapidly if I'd started in insert mode my first few times, because then the expressive command mode enabled by the Esc key seems "layered onto" the basic insert-mode editing that a new user expects to be the main purpose of a text editor. From insert mode, you can page down and delete and insert pretty straightforwardly; and you get gently introduced to command-mode when you say "hey, how do I save this document now?". So pedagogically it would have really helped.

I have mixed feelings on the pedagogy. On the one hand, it would have eliminated some frustration, which would have presumably been helpful. On the other, driving home that "normal mode is normal" serves a pedagogical purpose as well. The power of vim really starts to emerge when you internalize that inserting text is just another action.
"evim" (easy Vim) is normally installed wherever vim is, and opens in insert mode by default.
I always used IDEs when I wanted highlighting.

Used nano just for some small changes when using SSH.

Vim is a programmer's dream.

If my only use were editing files in CLI, though, I'd have always used nano and not learned vim, as well.

vi is a sysadmin's dream. I use it for editing any and all files on myriad remote machines. I especially love the ! command which lets me pipe parts of a buffer through shell commands such as column.
It seems like "perform a bunch of pretty similar changes across most lines of a file with a couple hundred lines" is the kind of thing that shows up far more regularly for sysadmins than for programmers, and it's something where vim shines. The last time I worked somewhere with someone in an explicit "sysadmin" role, they were regularly bugging me for vim tips (not that I minded).
I thought IDEs were a programmer's dream :D
IDEs are a programmer's depressing reality.
Yeah, I remember when I was first learning Linux, I was pretty much thrown into the deep end with nobody to help me much. I got into vim to edit a text file, and was... completely lost at sea. I figured out how to install nano and have never touched another Linux text editor since.
>you can't leave if you don't know the leave command?

Hah, for many that is Vim itself!

It was in fact the original mode. vi was the visual mode for ex.