Live data from Hacker News

Vim Creep

rudism.com

101–110 of 237 posts

Re: Vim Creep

#101

Earlier quoted context omitted.

So what kind of stuff do you program inside of it? What kinds of problems do you solve? I mean, I've never really felt the need to program an add-on to text editor. I download syntax highlighting packages, and there are common macros like "remove trailing whitespace" already installed. Keyboard shortcuts can be changed in lots of editors and OS's. In the past, I've definitely been upset that a particular editor didn'…

well instead of getting upset, emacs users can fix their own problems if they so wish

Yep. We're not dependent on any commercial entities to fix our tools. We sharpen our tools ourselves.

Re: Vim Creep

#102

Earlier quoted context omitted.

I can't answer your whole question or we'll be here all day. Here's one important example, which has the advantage of applying in vim as well as emacs: "Common" macros are the least interesting. The most interesting macros are the ones with no name, the one-time ones that you build on the fly. You have a file with ten thousand lines of: foo.rb bar.rb baz.rb … … [9997 more lines like these] and you need to turn the fi…

For that I would probably have used a regex search and replace in any decent editor, or perhaps a Perl one-liner. cat file | perl -p -e 's-\s (. )\.rb-// Run the $1 command\ndef $1()\nend\n-'

As a heavy user of regex one liners, I agree in this case, but as a heavy user of vim, there are lots of times when a macro can be recorded and run over a file long before a proper regex can be constructed, particularly in multi line settings, or those things that would require heavily nested backrefs.

Re: Vim Creep

#103

Earlier quoted context omitted.

So what kind of stuff do you program inside of it? What kinds of problems do you solve? I mean, I've never really felt the need to program an add-on to text editor. I download syntax highlighting packages, and there are common macros like "remove trailing whitespace" already installed. Keyboard shortcuts can be changed in lots of editors and OS's. In the past, I've definitely been upset that a particular editor didn'…

I can't answer your whole question or we'll be here all day. Here's one important example, which has the advantage of applying in vim as well as emacs: "Common" macros are the least interesting. The most interesting macros are the ones with no name, the one-time ones that you build on the fly. You have a file with ten thousand lines of: foo.rb bar.rb baz.rb … … [9997 more lines like these] and you need to turn the fi…

In Sublime Text 2 using multi cursers:

1. `command + A` to select all

2. `command + shift + L` to split the multi-line selection into multiple single line selections (one curser at the end of each line)

3. `delete delete delete` to get rid of ".rb" on each line

4. `command + shift + ←` to select the identifier

5. `command + C` to copy each identifying word on each line (!!!!)

6. `←` to get to the beginning of the line

7. Type "// Run the "

8. `command + V` to paste each identifier on each line correctly (!!!!)

9. Type " command\ndef "

10. `command + →` to go past the identifier already there

11. Type "()\nend\n"

Also took about twenty seconds. This multi curser thing has been completely redefining how I mass edit code - it's quite fantastic, and as far as I know ST2 is the only editor that does it this wonderfully.

Re: Vim Creep

#104

This is an extremely awesome, fantastic, exhilarating use of hyperbole. What I gained from the article wasn't any explanation of why Vim is great; indeed, there was little included in this respect, aside from moving "entire blocks of code with the flick of a finger." Even the cool feeling of proficiency you get from knowing a tool well, and the fun of getting to show off a skill to a "how did he do that!?" audience w…

And he end it with

    :wq
This part make me smile... Wonder what others tough when see that?

Re: Vim Creep

#105

I've said it before, and I'll say it again... Editing text is a solved problem: vim or emacs. Pick one and get back to work.

Programmers love their tools, everybody has had different experiences.

What is wrong with sharing them?

Re: Vim Creep

#106

Earlier quoted context omitted.

So what kind of stuff do you program inside of it? What kinds of problems do you solve? I mean, I've never really felt the need to program an add-on to text editor. I download syntax highlighting packages, and there are common macros like "remove trailing whitespace" already installed. Keyboard shortcuts can be changed in lots of editors and OS's. In the past, I've definitely been upset that a particular editor didn'…

I can't answer your whole question or we'll be here all day. Here's one important example, which has the advantage of applying in vim as well as emacs: "Common" macros are the least interesting. The most interesting macros are the ones with no name, the one-time ones that you build on the fly. You have a file with ten thousand lines of: foo.rb bar.rb baz.rb … … [9997 more lines like these] and you need to turn the fi…

similar thing for vim.

qrIdeff.Di()endjq

qr ' record a macro into register r

I ' insert mode at start of line

def ' type def then exit insert mode

f. ' find the dot

D 'delete the rest of the line

i()end ' type () return end

j ' next line down

q ' exit macro recording

call it with 9999@r

This looks unwieldy but it's all done interactively. (also if you mess up and you want to rework the macro you can paste it out with "rp to paste the r register rework it and then put it back into another register. 0"ry$ (start at column 0 then into r register r yank to end of line)

Re: Vim Creep

#107

This feels like an article about a religion or cult, not a software program. I just don't get it. Ever since newer editors got block editing or multiple insertion cursors, and RegEx find & replace across multiple files, and searching filenames to open... I feel like I've already got everything I need! What am I missing out on? I don't feel like my text editor holds back my productivity. Using something like Sublime,…

I don't understand vimmers, but I use Emacs and I can say that having your work environment be 100% programmable is pretty damned nice.

That's why I use Evil (http://emacswiki.org/emacs/Evil). I get all the programmability benefits of Emacs with the more powerful editing model of Vim. In fact, the whole of Evil is actually greater than the sum of its parts, since it provides a high level interface for extending the Vim editing model itself in Emacs Lisp. Creating new text objects, for example, becomes trivial.

Re: Vim Creep

#108

Earlier quoted context omitted.

I can't answer your whole question or we'll be here all day. Here's one important example, which has the advantage of applying in vim as well as emacs: "Common" macros are the least interesting. The most interesting macros are the ones with no name, the one-time ones that you build on the fly. You have a file with ten thousand lines of: foo.rb bar.rb baz.rb … … [9997 more lines like these] and you need to turn the fi…

For completeness - same task in vim: start recording a macro: qa Then enter this sequence of keystrokes[1]: 0veyO// Run the ^R" command j0f.C() end Then exit macro recording with: q Then enter the command: :g/.rb$/ norm @a to run the macro on every line ending with .rb (allowing comments in the input, just because (of course it would be nice to make that regex in :g look for "lines that start with comments" and ignor…

I'm an intermediate user of vim but the filtering the macros to only run on those lines is a great tip! I did it a bit different but we had a similar idea.

Re: Vim Creep

#109

I've said it before, and I'll say it again... Editing text is a solved problem: vim or emacs. Pick one and get back to work.

Although I agree with you, IDE fans feel the same way: "Writing code is a solved problem: eclipse or xcode or visual studio. Pick one based on your environment and get back to work" An argument I hear a lot is: 'vim is fine for editing files on a remote server, but not suitable for everyday work'. I believe it is a common belief outside of the HN crowd.

But in your example, IDE fans are suggesting a demonstrably worse set of options - when I switch from iOS to Android development, I have to learn an entire new editor. Using vim, I have to learn the `adb` command.

Re: Vim Creep

#110
Being somewhere in the middle of that timeline, I'd watch that movie. This piece reminds me that an authors vision is always more important to communication than the subject itself.
Post reply on HN