News for hackers. Stuff that matters.
Re:Vim Anti-Patterns by Philipp__ on Wednesday October 05, 2016 @11:34AM (#12644721)
Not trying to start a flame war here, but I in recent few years I am seeing Vim being more popular, and I feel it adoption in terms of younger developers (those who weren't programming when original Vi was around) grows. (Ok, please forget about GUI editors, they have their audience, and I am not comparing any of those facts to them) I used Vim for 3 years, and found philosophy and implementation of modal editing amazing. Writing and manipulating code in it went like bread and butter.

But then I told myself, hey, why not try Emacs? So I've been using Emacs for ~6months now and cannot but notice that community is much more niche and humble compared to Vim. Just look at the sheer number of color schemes available for both editors. And I had to agree, Vim was far superior text editor, but that wasn't enough to keep me away from Emacs, since I gave the advantage to other things (everything else) that Emacs does better.

I tried EVIL mode, and it is amazing, but something just felt wrong using it inside Emacs. I wasn't using either Emacs or Vim. I would often shuffle and mix commands, sometimes I would do :w, sometimes C-x C-s. So I decided to ditch Evil until I get more comfortable with Emacs key bindings. I came to Emacs because of Lisp (and general FP audience is much, much, more based around Emacs, makes sense), amazing tools and plugins which I found more stable, better designed, and it is weird to say this but things just worked with Emacs, things like auto-completion and code navigation (ivy, ace-jump-mode) were really fast, hustle free experiences. Disclaimer, I have never touched older versions of Emacs, spent my time in 24, and now in 25, so many of myths and problems that Emacs got known for over the time, I think, aren't there anymore.

And to sum things up, what is really weird to me is that functional programming is on the rise and every year I see it more and more being adopted, but that doesn't help Emacs audience grow. (Maybe because I am young, and I am nerd often found in nerd communities where things like FP are often praised, but in the real world considered a bit awkward or esoteric.) I showed up at the FP workshop few weeks before in local dev/hacker community place, everybody rocking Sublime Text/Vim, but nobody used Emacs, people were looking at me like I was an Alien. Spacemacs is doing good job at attracting people, but maybe Emacs will stay that programmers/nerd phenomenon, the all-mighty lisp OS, that in the end people often reject or overlook. And why is it like so? I do not know. If somebody can sink into and learn Vim, I don't see a reason why it is different story with Emacs.

Re:Vim Anti-Patterns by slgeorge on Thursday October 06, 2016 @08:55AM (#12651990)
My main focus is on modal navigation, editing and dealing with text as objects - that's the real long-term benefit Vim gives me.

For new users selecting one I think this comes down what you're looking for from the application and the plugins/community around them. But, I really don't think there's any killer differences between them, it's just a matter of taste.

For you:

> I came to Emacs because of Lisp (and general FP audience is much, much, more based around Emacs, > makes sense), amazing tools and plugins which I found more stable, better designed, and it is weird > to say this but things just worked with Emacs, things like auto-completion

I recognise it's more popular to edit Lisp with Emacs, but Vim seems to do just fine. I play with Clojure and do that using Vim perfectly fine there are great plugins (fireplace etc). There's no doubt that the 'emacs is code' thing attracts Lispers to it.

Both, Emacs and Vim both have large ecosystems of tools and plugins around them so I consider that a non-issue.

In terms of configuration, I think Vim is easier to get started with. I personally consider Emacs system a steep learning curve for the general use-case. I find Vim is very well documented and has lots of settings for all the conceivable things you'd want, plus a raft of plugins to alter it's behaviour in the ways I want. However, the fact that Emacs can be rewritten in-itself is a powerful concept so in principle you can't see an advantage there.

In the past people used to say that Vim was smaller and that was a reason to use it over Emacs, but that's a total non-issue for the general use case.

I don't think it really matters which one you choose, as long as you spend some time getting to know 'it' properly.

Re:Vim Anti-Patterns by qwertyuiop924 on Wednesday October 05, 2016 @11:54AM (#12644940)
Emacs was far easier for me than Vim was. To this day, I have no idea how people learn Vim. And the scripting is awful, especially compared to Emacs, which is really a script interpreter that has a built in text-editor script and some useful primitives for text editing.
Re:Vim Anti-Patterns by clifanatic on Wednesday October 05, 2016 @01:30PM (#12645889)
> I have no idea how people learn Vim

LOL, I felt the same way about emacs when I tried to force myself to use it. Interesting that you point out that "the scripting is awful" - my sense after a year of using emacs full time was that the _only_ way to use emacs is to learn to script/reprogram it. If you don't mind my asking - how _did_ you learn emacs? Were you a lisp programmer to start with? Or did you learn it in the context of emacs?

Re:Vim Anti-Patterns by qwertyuiop924 on Wednesday October 05, 2016 @02:18PM (#12646356)
Yeah, scripting a huge focus in emacs: they say it's a scripting environment that happens to have a text editor embedded in it. I don't know who "they" are, but they're quite perceptive.

Some lisp experience (especially CL) can help with learning elisp, but it's entirely possible to do so without it.

The process of learning emacs is roughly this:

-Launch emacs

-Run through the tutorial

-Learn the shortcuts and gain gradual proficiency in the editor (this step can optionally come later)

-Find something you want, or that annoys you (I wanted to have Solarized Dark as my theme)

-Google how to fix it, introducing you to .emacsrc and .emacs.d

-Copy snippets into your .emacsrc (or .emacs.d/init.el)

-Gradually learn elisp as you customize your emacsrc and snippets to your needs.

-Start writing your own snippets, with the help of the excellent documentation.

-Begin writing about how great emacs is online (I am here)

-Eventually start writing full-fledged emacs packages.

-Master the intricacies and horrors of elisp. Begin to despise the language. Comfort yourself by saying, "at least it isn't vimscript."

-Start supporting xemacs in your emacs config and packages. At this point, your config is a large hierarchy of directories. If it wasn't, it is now. If you didn't hate writing elisp already, you will now.

-Under the pressure of the demands of your users, spend more time working on emacs packages and other improvements to emacs than your actual work.

-Snap, and spend the rest of your days improving emacs and writing tributes to RMS.

Most do not follow this learning curve to its conclusion.

Re:Vim Anti-Patterns by clifanatic on Wednesday October 05, 2016 @02:39PM (#12646550)
hehe - I made it to step 4, anyway.

The only thing that sort of scared me off of customizing emacs is that if I, say, SSH into a remote box or go to another co-workers computer, my customizations won't be there. That's why I do my best to stick with "out of the box" vim defaults (and vi defaults if possible): I know they'll always be there, wherever vi is.

Re:Vim Anti-Patterns by qwertyuiop924 on Wednesday October 05, 2016 @02:53PM (#12646665)
Well, that's the drawback to emacs. It's also why most people don't change the default keybindings too much: some functionality may be missing, but muscle memory won't betray me if I ssh into a fresh emacs setup.

However, there are some ways to combat this.

Firstly, you can keep your .emacs.d on github, and pull it down to whatever machine you're working on. Indeed, this is what many emacs users advocate.

Secondly, many emacs users will ask: Why are you launching emacs over SSH at all? Instead, use TRAMP or SSHFS, bring up the folders under dired if you need to see the folders, and edit the files with your local emacs.

You can become compotent in emacs without customizing it, but the customization is a big part of why emacs is great.

Re:Vim Anti-Patterns by Philipp__ on Wednesday October 05, 2016 @05:52PM (#12648256)
Haha, you described many things perfectly! But what drove me the most towards emacs despite being suitable for FP, huge amount of tweaking and customizability it provides. And it felt much better doing it in Elisp than Vimscript. Everything has it's good and bad sides, that is normal imho. But really nice comment! :)
Re:Vim Anti-Patterns by qwertyuiop924 on Wednesday October 05, 2016 @08:29PM (#12649167)
Of course.

Although emacs is no more suitable for FP than vi really, other than having better support for some of the functional languages, and for Scheme and CL (which aren't functional, but are often associated with FP, and are sometimes written in that style.

Re:Vim Anti-Patterns by clifanatic on Thursday October 06, 2016 @09:56AM (#12652436)
> Vimscript

I'd go so far as to say that if you _don't_ feel comfortable using vi "out of the box", you probably should steer toward something else - vi is just not customizable like other editors/IDEs are.

Re:Vim Anti-Patterns by the_duke on Wednesday October 05, 2016 @02:34PM (#12646500)
Best of both worlds: http://spacemacs.org/

Modal editing is far superior, once you learn it.

Emacs runtime and configurability thanks to Elisp is far superior to VimL.

So just use Spacemacs. ^^

Re:Vim Anti-Patterns by sham1 on Wednesday October 05, 2016 @03:21PM (#12646903)
It works until one wants to create their own configuration stuff and functions and stuff. Much rather just stick with normal emacs configs and stuff and put in EVIL-mode once my pinky finger can no longer reach Ctrl (Not a worry seeing as I need Ctrl for gaming as well).

Also, installing plugins requires one to create one's own layer? Eww.

Re:Vim Anti-Patterns by the_duke on Wednesday October 05, 2016 @04:03PM (#12647295)
It's complicated, true.

But it does a lot of work for you.

I started to create my own setup from scratch with Evil etc.

But recreating all that Spacemacs has, especially with customizing all the plugins for Vim keybindings, is countless hours of work.

You can skip the layers and side-install custom plugins quite easily though.

Re:Vim Anti-Patterns by qwertyuiop924 on Wednesday October 05, 2016 @02:47PM (#12646617)
I can't stand Spacemacs: it's far too complicated, and I'd rather write my own configs, thanks. Also, I could never get used to Vim-style modal bindings.
Re:Vim Anti-Patterns by jhayward on Wednesday October 05, 2016 @06:22PM (#12648478)
> I tried EVIL mode, and it is amazing, but something just felt wrong using it inside Emacs

For me the "feels wrong" is that vim is always just a little bit snappier than emacs. If you gave me a borderless window with no branding and only let me type vi commands I bet I could tell vim from emacs 9/10 times.

I used emacs exclusively for > 20 years and just recently began to transition to vim to save my tendons. It's amazing that so many of the verb-noun command constructs are still wired in to my brain stem.

Re:Vim Anti-Patterns by Scarbutt on Wednesday October 05, 2016 @12:15PM (#12645172)
I tried EVIL mode, and it is amazing, but something just felt wrong using it inside Emacs. I wasn't using either Emacs or Vim

I use emacs with evil, my approach for this is to use vim keybindings for everything related to text editing and emacs keybindings for everything else.(With just some minor exceptions).

Unless you want to go the whole full exotic keyboards route and/or go crazy with remaps, emacs keys are just too painful.

Re:Vim Anti-Patterns by Philipp__ on Wednesday October 05, 2016 @12:23PM (#12645270)
actually they aren't. At least for me. I mean, C-p I won't be pressing with one hand, I use both. I have pretty long slim fingers. I am touch typist too, so yeah sometimes my pink is used a little bit more than I would like, but I didn't feel pain or discomfort. Vim is far far better in that term.
Re:Vim Anti-Patterns by Scarbutt on Wednesday October 05, 2016 @08:04PM (#12649068)
Sure, I'm touch typist too, and use both left and right ctrl keys, never chorded with one hand.

You won't feel anything now, but 3-5 years down the road you might start to feel the strain.

Re:Vim Anti-Patterns by Gorgor on Wednesday October 05, 2016 @04:02PM (#12647290)
I’m primarily a Vim user, but I use Emacs for some stuff like Common Lisp programming, Org mode, etc. But what I sometimes miss from Vim is the filtering with external commands. For example if I want to pipe my file through awk, I can just do

    :%!awk '<do some awk stuff>'
Does Emacs have something like this out of the box?
Re:Vim Anti-Patterns by Philipp__ on Wednesday October 05, 2016 @05:45PM (#12648194)
of course it does, as said by nemoniac! Here: https://www.emacswiki.org/emacs/ExecuteExternalCommand
Re:Vim Anti-Patterns by nemoniac on Wednesday October 05, 2016 @04:21PM (#12647467)
C-u M-!
Re:Vim Anti-Patterns by sheepz on Wednesday October 05, 2016 @02:53PM (#12646664)
Couldn't agree more. I just recently switched over to Spacemacs after having used Vim for over 5 years, and the transition has been so smooth. With Spacemacs, everything just works, whereas with Vim, I had constant struggles. Of course all of the smoothness can be pretty much attributed to Spacemacs. Looking forward to learning Elisp :P