Live data from Hacker News

Vim Creep

rudism.com

81–90 of 237 posts

Re: Vim Creep

#81

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…

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-'

Re: Vim Creep

#82
post #51

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.

While vim is very cool, there is certainly a lot of room for improvement. vim's codebase doesn't look like something that I would like to hack, and don't try to tell me that things like vim plugins or vimscript are supposed to be the best that we can ever hope to do.

the problem is that there's a lot of accumulated work that has gone into vim at this point, and none of the attempts to reproduce that atop a cleaner, more modern codebase ever went anywhere. emacs's evil mode[1] looks like the most promising current alternative.

[1] http://emacswiki.org/emacs/Evil

Re: Vim Creep

#83
post #34

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,…

You really have to sit down and see a vim user work to start to understand. In vim you don't just move around with arrows, then delete and then replace the text you want. What happens is you can use noun-verb associations to do things. For example on a line like this: var foo = "bar"; I could be at the beginning of the line and type the following keys to change the inside of the quotation marks: ci"baz In sublime I w…

Wow - I never realized ci"baz would work with the cursor starting in column 0 - thanks for this tip !!

Re: Vim Creep

#84

This article has changed(or at least I hope) my life. I'm installing Vim today on my Windows Laptop. Does anyone know of a good guide for beginners?

I learn by watching and following along with examples, so the following YouTube videos are the ones that I've found the most useful: http://www.youtube.com/watch?v=71YTkxUNwmg I needed to do find and replace on a short story I'm working on (changed a character's name), and I found this one helpful: http://www.youtube.com/watch?v=J1_CfIb-3X4 I wanted to understand/use the .vimrc file, so I googled until I hit this one…

Shift+I moves your cursor to the start of the line, and enters insert mode, too.

Re: Vim Creep

#85
post #42
post #34

Earlier quoted context omitted.

You really have to sit down and see a vim user work to start to understand. In vim you don't just move around with arrows, then delete and then replace the text you want. What happens is you can use noun-verb associations to do things. For example on a line like this: var foo = "bar"; I could be at the beginning of the line and type the following keys to change the inside of the quotation marks: ci"baz In sublime I w…

Actually you can do it with: - , , , baz And considering you didn't have to press : beforehand, it can be just as fast. I'm a vim user, but using it for something like Objective-C in place of the wonderful autocomplete in Xcode would be a totally dumb thing to do. It's simply not smart enough to improve my productivity, even with the slight speed increases with text-manipulation.

Try out xvim if you want to use Xcode + vim. It's still alpha but I use it for all my Xcode editing. Patches welcome.

edit: link - https://github.com/JugglerShu/XVim

Re: Vim Creep

#86
post #65

Earlier quoted context omitted.

Does your example include the action of deleting bar with baz? Also, not having to move away from the home row makes me feel much faster. Having to use Alt/Control/Arrows makes me cry. (I know you can't avoid Control in Vim, but in this example it is not required.) ci"baz is 7 keystrokes, only one of which is a jump. bar baz is 8 strokes and two jumps. It also requires typing the entire string in quotes. If the examp…

No, good point. You'd then have to type "baz". However, if I was actually faced with this problem, I'd use End, Ctrl + Left, Ctrl + D, baz, which is a total of 7 keystrokes. (if you don't release Ctrl) The vim example was 8 keystrokes. (" is shift + ') I have no doubt that you could manufacture an example that shows a benefit for vim, but I think that the advantages are overestimated by heavy vim users. Edit: Your lo…

I would personally dislike your example because of the use of extended keyboard keys that require repositioning the hand (End, Left).

Re: Vim Creep

#87
post #20

Can we all stop patting ourselves on the back for being vim badasses now? Yes, its a fantastic editor. Yes, its probably going to make you more productive. Yes, its every bit as capable as any other IDE or editor out there. No, it will not make you a better person. No, mastery of vim does not make you fart sunshine. No, it won't make you an enlightened buddha.

I think it's more about mastering tools with a high learning curve. It's our trade; it's fun to feel good about it.

i think it's not even so much about the learning curve, it's about the sheer amount of leverage the skills get you. it's very similar to the way chefs are chuffed about their knife skills - all of a sudden you're doing so much with so little effort that it'd be sadly jaded not to feel a thrill.

Re: Vim Creep

#88
Not so subtly the author is telling the reader if you program with Vim you'll be just like "all the really great programmers" who can write 4 line solutions to problems that take ordinary programmers 10 pages. You'll produce "impossible patterns of code and text manipulation", and be able to "fill dozens of registers" (admittedly I don't know what that means). This is all bit silly and reminds me of "hacking" in the Hollywood films.

I understand that this post was tongue in cheek. I also understand that not all text editors are equal, if you see someone writing their first hello world program in Notepad yes you should tell them about much better alternatives. But this post confuses ability to program with ability to use Vim.

Being really good at using Vim will definitely let you say you're part of the club of people who are really good at using Vim. It just might make you more efficient at manipulating code. But let's not perpetuate the elitism that is pervasive enough in hacking, it's a text editor. It doesn't make you more intelligent, better at problem solving, or writing more efficient code.

Re: Vim Creep

#89
post #65

Earlier quoted context omitted.

Does your example include the action of deleting bar with baz? Also, not having to move away from the home row makes me feel much faster. Having to use Alt/Control/Arrows makes me cry. (I know you can't avoid Control in Vim, but in this example it is not required.) ci"baz is 7 keystrokes, only one of which is a jump. bar baz is 8 strokes and two jumps. It also requires typing the entire string in quotes. If the examp…

No, good point. You'd then have to type "baz". However, if I was actually faced with this problem, I'd use End, Ctrl + Left, Ctrl + D, baz, which is a total of 7 keystrokes. (if you don't release Ctrl) The vim example was 8 keystrokes. (" is shift + ') I have no doubt that you could manufacture an example that shows a benefit for vim, but I think that the advantages are overestimated by heavy vim users. Edit: Your lo…

A commonly overlooked aspect to the vim way of describing what you're doing in verbs and nouns and prepositions is that the "." character in vim means "repeat my previous edit". So if you can find a way to "phrase" your edit as a single change (i.e., 6sasdf would delete six characters starting under the cursor and leaving me in insert mode, then insert the letters asdf and exit insert mode) instead of many (i.e., xxxxxxiasdf, deleting 6 characters separately, entering insert mode and entering the letters asdf) then you can go to another spot in the text and just hit . to repeat the edit. I've given a contrived example here, but this is enormously powerful. It's why there are several ways to enter insert mode: "i" to enter under the cursor, "a" for after the cursor, "I" for first non-whitespace character on the line, "A" for after the last character on the line, "o" for opening a new line below the cursor, "O" for above, "c"+motion for deleting through the motion and leaving in insert mode, count+"s" for removing count characters starting from cursor and leaving in insert mode. There are more....I'll stop :)

Re: Vim Creep

#90
post #71

Earlier quoted context omitted.

Instead of using `grep "(1)"`, use the `-s` switch: $ apropos -s1 copy bsdcpio (1) - copy files to and from archives cp (1) - copy files and directories dd (1) - convert and copy a file ....

I think it's better to use grep. Knowing the options to apropos has very low value. Knowing grep has lots and lots of value.

I agree. I have no idea how to use `find`. I always do `find . | grep whatever`, since I know the basics of grep.
Post reply on HN