Live data from Hacker News

One with Vim

invisibletheory.com

61–70 of 129 posts

Re: One with Vim

#61

One of the features that really got me into Vim was the macros feature. I actually ran into in accidentally several times when I was first learning the basics (and couldn't get out of recording mode). But macros, and especially the temporary nature of macros, have saved me (collectively) many hours: q ; then q to stop recording. Then @ to kick off the macro. Splendid.

As a new vim user, I'm still trying to figure out what to do with them.

What do you find yourself macroing, generally?

Re: One with Vim

#62

One of the features that really got me into Vim was the macros feature. I actually ran into in accidentally several times when I was first learning the basics (and couldn't get out of recording mode). But macros, and especially the temporary nature of macros, have saved me (collectively) many hours: q ; then q to stop recording. Then @ to kick off the macro. Splendid.

I don't meet many other vim users who like macros but recently I've had call to use them daily. They completely remove any repetitive text editing actions, even relatively complex ones like "take these words, each on a new line and make them keys to an array, with the values initialized to ''"

The only problem is that they take a lot of practice before you get them right first time. After a while though, you learn to record them fairly quickly and they streamline your workflow. They also melt the faces of anyone pairing with you.

The best part is they get better with age. The more vim commands you know, the more opportunities you find for using them.

Re: One with Vim

#63
post #53

Earlier quoted context omitted.

Your comments about Vim's learning curve are spot on, and I don't think any vimmer will disagree with you, but the argument they make (which I agree with) is that the cost/benefit ratio is worth it. If you only code every now and then, so you've got a lot of time between sessions to forget things, and not a whole lot of time in total, then something like Visual Studio which has good 'discoverability' is going to be b…

Visual Studio which has good 'discoverability'. Not my experience at all . It's a sea of confusion and pain.

What about the VS editor do you find confusion and painful? Not counting project-related issues (e.g. knowing what project settings to twiddle and how to do so can be difficult to figure out).

Re: One with Vim

#64
post #61

One of the features that really got me into Vim was the macros feature. I actually ran into in accidentally several times when I was first learning the basics (and couldn't get out of recording mode). But macros, and especially the temporary nature of macros, have saved me (collectively) many hours: q ; then q to stop recording. Then @ to kick off the macro. Splendid.

As a new vim user, I'm still trying to figure out what to do with them. What do you find yourself macroing, generally?

For me the most important thing was learning to add a 'j' at the end of each macro and running it multiple times. So lets say you want to crack open an array that looks like this:

    $address = array(
     'name'  => '',
     'line1' => '',
     'line2' => '',
     'state' => '',
     'country' => '',
     'postcode' => '',
    );
That's a lot of commas and quotes etc. Nowadays I usually punch this into vim:

    name
    line1
    line2
    state
    country
    postcode
Then I start on the first line and record a macro that wraps that word in quotes, then appends hashrocket, quotes, comma, and then moves to the next line. Run the macro 5 times with 5@ and the you get your array.

Re: One with Vim

#65
post #53

Earlier quoted context omitted.

Visual Studio which has good 'discoverability'. Not my experience at all . It's a sea of confusion and pain.

What about the VS editor do you find confusion and painful? Not counting project-related issues (e.g. knowing what project settings to twiddle and how to do so can be difficult to figure out).

.NET

Personally, the god-awful slow file switching, frequently-incorrect highlighting, almost totally worthless JavaScript, ASP, and ASP server-side code support, XML comments with no built-in documentation builder nor viewer, text-column editing that's a total joke, and the always-helpful "too many warnings" error are my most recent peeves.

I hate VS. With a passion. I cannot believe that such a painful-to-use program is held up as the pinnacle of programming experiences.

So why do I use it? Because .NET defies logic; framework-wide intellisense is the only way to do anything in it. Give me almost any other language/framework and in a few days I can get by almost entirely with a programming text editor and occasional official-documentation browsing. Several months into .NET code, I still Google more than I MSDN, StackOverflow more than .NET-developer-blog, and the massive style inconsistencies between different sections of the library mean I cannot go into any new area without Visual Studio to hold my hand and kick me in the nuts.

Re: One with Vim

#66
post #42
post #11

Vim is my primary editor but I think the only really good part of vim is the keyboard navigation. The rest could be much better. For example, to this day I haven't figured out an easy, built-in way to copy from one vim window to another. I'd love to have some features of other editors have but the key bindings always hold me back.

you can copy and paste from the system clipboard as the + register - use "+y to yank to the system clipboard and "+p to paste from it (depending on OS, you may need to use * instead of +). This allows cutting and pasting between vim and other applications (including other instances of vim). For editing multiple docs with vim, I find it's easier to use multiple buffers in the same window. Use :b to jump back and forth…

But your vim has to be compiled with clipboard support. I use gvim for just this reason for all but basic editing (for which I just fire up vim).

Re: One with Vim

#67

Am I foolish for not believing the vi/vim hype? I understand that it's been around for as long as rocks, and that it's quite handy since it's available everywhere. I use it daily, in fact, but rarely for more than basic editing. I'll just come out and say it: my favorite editor is Visual Studio. Sure, it's slow to load and rather fat now, but I'm talking solely about the editing functionality. With vim, I have to cli…

gvim has menus and the keyboard-reinforcing shortcut hints. Also, you can copy/paste with other windows (which is why I started using it over vim).

Re: One with Vim

#68

Earlier quoted context omitted.

I've heard from lots of vim people that do actually use Eclipse to make up for Java's inadequacies, yes.

There are Vim emulation plugins for Eclipse, if you want the best of both worlds.

And don't forget eclim, a Vim front-end for Eclipse (or an Eclipse back-end for Vim):

http://eclim.org/

Re: One with Vim

#69

Am I foolish for not believing the vi/vim hype? I understand that it's been around for as long as rocks, and that it's quite handy since it's available everywhere. I use it daily, in fact, but rarely for more than basic editing. I'll just come out and say it: my favorite editor is Visual Studio. Sure, it's slow to load and rather fat now, but I'm talking solely about the editing functionality. With vim, I have to cli…

Visual Studio? Sure, as long as you're only going to be coding on Windows . I'm curious, does anyone use Visual Studio for non-code editing? For example, I'm typing this in Vim right now. I use Vim for lots of meant-for-human-readers text.

> as long as you're only going to be coding on Windows.

In the past, I've used VS for editing PHP, which I then deployed to the server using a keyboard shortcut.

I understand what you're saying, but I want to point out that VS can be used as an editor even when the target platform isn't MS.

Re: One with Vim

#70

Earlier quoted context omitted.

You're not really supposed to run vim in multiple windows. Use your system pasteboard if you need to copy between them. There's probably some plugin that would make it work with yank registers though.

> You're not really supposed to run vim in multiple windows huh? I run in 3+ windows (terminal shells) all the time and have done so for 5+ years. To cut and paste between windows I use filesystems copy and paste (select and middle click in X) Vim is flexible and you are suppose to run it however works for you.

Sure, you can -- my only point was that, as far as I know, vim doesn't really provide any help for working across multiple instances of itself.
Post reply on HN