News for hackers. Stuff that matters.
Re:Vim GIFs by zuck9 on Tuesday July 19, 2016 @05:50PM (#12125215)
I've never understood, what does Vim or Emacs have to offer that people use it over Atom or Sublime Text?

I think I can edit and navigate through text as fast as Vim users, using the native OS text editing hotkeys.

Re:Vim GIFs by skylerberg on Tuesday July 19, 2016 @06:27PM (#12125412)
> I think I can edit and navigate through text as fast as Vim users, using the native OS text editing hotkeys.

This is where I think you are wrong. An experienced vim user has so many faster ways to edit text than someone limited to what the OS provides. Here are some examples:

yt( - Copy characters up to the nearest (

ci{ - Replace text enclosed by curly braces

:g/\(['"]\).*\1/d - Use regex to delete every line containing a string literal

A vim master has thousands of permutations of commands at their disposal the specify exactly how they want to manipulate text in 5 or less keystrokes. But navigation is just one great feature. Vim users can travel backwards in time (:earlier 10m), can have multiple clipboards with different content at the same time, easily record macros on the fly.

Re:Vim GIFs by aninhumer on Tuesday July 19, 2016 @07:46PM (#12125802)
>faster ways to edit text than someone limited to what the OS provides

But other editors aren't limited to what the OS provides, they build on those basics to provide most of the same features, but in a way that's intuitive to modern users.

For example in Sublime:

>ci{ - Replace text enclosed by curly braces

Ctrl-Shift-M selects text inside brackets. Subsequent presses work outwards through layers of brackets.

>:g/\(['"]\).* \1/d - Use regex to delete every line containing a string literal

Ctrl-F Alt-R (['"]).* \1 Alt-Enter Ctrl-L Delete

>yt( - Copy characters up to the nearest (

Not available out of the box, but there are plugins for it. Although, in my experience of using vim, the mental effort of working out what character I needed for t/f tended to be far more disruptive than just using arrow keys/mouse.

Honestly that was my experience of vim in general. Whenever I had to do anything slightly non-trivial, it took a lot of mental effort to work out the exact command I needed. Whereas Sublime's multiple selections are more intuitive and flexible in unusual situations.

To use your regex example above, depending on the context, I'd probably just use Ctrl-D to step through instances of " checking whether each one is a string (which it probably is), skipping any that aren't, and then Ctrl-L Delete. (And repeat for ') If it's a short file, this is probably about as fast, it flows from muscle memory, and it means I'm actually checking through the changes I'm about to make. (And if it was a massive file, I'd use the regex. My point is just that Sublime offers a more ad-hoc way to do bulk edits where you're not exactly sure what you need to match on.)

Re:Vim GIFs by allendoerfer on Wednesday July 20, 2016 @12:27AM (#12126897)
>Honestly that was my experience of vim in general. Whenever I had to do anything slightly non-trivial, it took a lot of mental effort to work out the exact command I needed. Whereas Sublime's multiple selections are more intuitive and flexible in unusual situations.

Vim is humbling in a way. I have been using it for 5 years and while it destroyed my ability to use a non-vim textfield, which shows me what is already ingrained, there is always a faster way to do a task and always room to improve.

I like that. You come across a better way to do something and now you just remember to do that one thing wherever it applies until you do not have to think about it anymore.

Re:Vim GIFs by emanuelev on Wednesday July 20, 2016 @03:34AM (#12127417)
> Although, in my experience of using vim, the mental effort of working out what character I needed for t/f tended to be far more disruptive than just using arrow keys/mouse.

I think you maybe didn't give it enough time. What really happens after a while is that you don't have to do any mental effort to do very complex things fast and efficiently. My experience is that after three months I had some sort of clicking in my head and everything made sense.

Said that, I wouldn't mind Ctrl-D on vim though, that's one of those sublime's features that I really like (and non consecutive multi line editing).

Re:Vim GIFs by aninhumer on Wednesday July 20, 2016 @04:09AM (#12127511)
I gave it several years as my primary editor, and I did learn a lot of things. Then I switched to Sublime and became about as proficient in a matter of weeks. I could have put more effort into learning vim, but I didn't have to in Sublime.
Re:Vim GIFs by mdcox on Tuesday July 19, 2016 @07:56PM (#12125849)
Funny, Sublime was my gateway drug to Vim. It has "Vintage Mode" (which gives you vim keybindings) which I enabled just for macros since they are so powerful. After a month of going directly to insert mode I started accidentally picking up more and more random keys. Eventually I was so fast in normal mode it just didn't make sense not to use vim since everything else I use is in the terminal anyway.
Re:Vim GIFs by rotten on Tuesday July 19, 2016 @05:58PM (#12125259)
Because vi is installed on almost every unix or linux system you will encounter. Many of the other editors require explicit installation, which may, or may not be possible depending on your bureaucracy and where the system is running in your infrastructure. If you know vi/vim you can work on files everywhere. Using the same editor everywhere is much less confusing than trying to learn several different editors and mentally flip back and forth between them.
Re:Vim GIFs by lparry on Tuesday July 19, 2016 @06:03PM (#12125286)
Properly learning any editor is like learning an instrument. Once you're comfortable with one, you're going to be more comfortable with that one than the others.

Likewise, some editors are similar enough that you can chop and change quickly, others not so easily. Atom and sublime are like members of the guitar family, while vim is like a piano. They can all produce lovely text files in the hands of a skilled musician

Re:Vim GIFs by khedoros on Tuesday July 19, 2016 @07:10PM (#12125653)
Inertia for one, ubiquity for another. Vim (or at least vi) is available everywhere that I want to do any kind of text editing: An ARM SBC, my old WinXP laptop, my newer Win7+Linux machines, the old HP-UX at work, all the Linux VMs that I ssh into, etc. After almost 15 years of use, there are certain things that feel like a missing limb if they aren't present in another program.

Atom's not attractive to me. It's a ~100MB near-IDE written and extended in web-oriented languages that I'm only lukewarm on learning, and which can't be used remotely, or on all the computers that I'll touch in a given month.

Sublime looks nice, but not so far ahead of vim that I want to take the time to learn it and pay for a license. I suppose that it's worth a trial, but I haven't gotten around to it.

Re:Vim GIFs by cauthon on Tuesday July 19, 2016 @09:35PM (#12126272)
> Sublime looks nice, but not so far ahead of vim that I want to take the time to learn it and pay for a license. I suppose that it's worth a trial, but I haven't gotten around to it.

I use vim these days, but to be fair to Sublime, the license isn't really required. Every so often (maybe every 10 times you close a file?) it asks if you'd like to buy a license, but there's no functional restrictions on an unlicensed copy and no consequence for perpetually ignoring the pop-up.

I wouldn't worry about getting around to it too soon. Sublime is great, and it has a plugin to support normal/insert modes and most vim bindings, but I've found that anything I can do in Sublime I can do in vim, and I can't run Sublime on remote hosts. It's an editor, it's always going to be subjective preference.

Re:Vim GIFs by khedoros on Wednesday July 20, 2016 @02:36PM (#12131373)
> but to be fair to Sublime, the license isn't really required.

I understand that, and that's great for trying it out and deciding if I'd like to stick with it or not. Eventually, I'd buy the license, if I liked it well enough. Either I'd spend a bunch of time and learn some concrete reasons for why I didn't want to use Sublime, or I'd find a new best friend, pay $70, and change my workflow to doing more work locally rather than on the remote machines.

It may be worthwhile, and it may not be, but there's a guarantee that I'll be spending a bunch of time finding out. In the end, I was just trying to give a concrete answer for why I was using vim rather than something newer and trendier.

Re:Vim GIFs by macromaniac on Tuesday July 19, 2016 @08:41PM (#12126055)
>I think I can edit and navigate through text as fast as Vim users, using the native OS text editing hotkeys.

I had to add 200 textboxes to a wpf form two weeks ago. Took me 60 seconds to generate the boilerplate with vim. If you can do it in under 5 minutes in notepad I'd be impressed, here's something similar to the data I was given: http://pastebin.com/Y7hyi2by

note: a) you can do this in excel with stringconcat, and b) the project could have been better designed to prevent the boilerplate but that was outside of my control

Re:Vim GIFs by Veedrac on Tuesday July 19, 2016 @11:05PM (#12126587)
FYI, took me like 20 in Sublime Text.

1. Select lines. Shift-Ctrl-End, Alt-l, Home.

2. Type up to the first quote.

3. Move 3 words along. Ctrl-Right, Ctrl-Right, Ctrl-Right.

4. Second quote, comma.

5. Go to start of next word. Ctrl-Right, Ctrl-Left. It's also easy to normalize spacing at this point if you just hold shift then press space.

6. Type "StatusType."

7. Press End, type ");".

Most of the time was spent in point 2.

Admittedly Alt-l isn't OS-native, but multiple cursors are so useful that you kind'a learn to assume them.

Re:Vim GIFs by AjithAntony on Tuesday July 19, 2016 @06:29PM (#12125429)
Major reason for me is that I rarely work on a local desktop. Most work happens on remote hosts. A local computer is an SSH term and a web browser. All the tools are remote.

Even in the rare case that I do something local, I prefer to keep using VIM becuase I know it so well and it is super lightweight.

Re:Vim GIFs by caseymarquis on Tuesday July 19, 2016 @10:59PM (#12126569)
I use both atom and sublime in vim mode. Also visual studio. I barely ever use actual vim for programming unless I'm throwing together a one off script on a a remote Linux terminal. When I say vim I usually mean something else with a vim extension.
Re:Vim GIFs by dopamean on Tuesday July 19, 2016 @05:52PM (#12125224)
Different strokes for different folks. For me, the first editor I ever used was vi and I just stuck with it. I've never used Atom or Sublime but from what I can tell they're nice editors too.