Live data from Hacker News

Vim: revisited

mislav.uniqpath.com

81–90 of 117 posts

Re: Vim: revisited

#81
Pro tip: after you paste code, it might not be indented correctly in the new context. You can select just pasted lines and autoindent them with V`]=. This should fix the indentation in most cases.

A better alternative: issue the ":set paste" command just before pasting text. That way you keep the original indentation.

Re: Vim: revisited

#82

Good advice, although I personally disagree with him on the Janus front. Janus is what got me to switch full time to Vim a few months ago, after having used Vim off and on for over a decade, mainly on the command line or for edits that were to difficult or repetitive to get done in more "friendly" editors/IDEs like TextMate and Visual Studio. Janus provided just enough familiarity and convenience to make a full-time…

Same for me. Maybe now I can scrap that and build my own vimrc but having a set of useful plugins really helped me.

Re: Vim: revisited

#83

If only I had read this when I first started using Vim! I've been using Vim for a while, and this is one of the best-organized overviews of Vim I've seen, partly because he doesn't try to enumerate every single key combination (which is the wrong way to learn Vim - the right way is to synthesize the way that the individual operations are logically combined, though that admittedly takes some time). The best two pieces…

Literally typing Ctrl+[ works for escape by default, it's what I've been doing instead of trying to remap keys.

Re: Vim: revisited

#84
There's been a bit of anti-mouse talk on here, but I recently took the time to get mouse support on vim in Terminal.app working. I have my notes here: http://www.reasonablyopinionated.com/2011/11/mouse-support-f...

While I do agree using the mouse for cursor positioning isn't always the best use of the mouse, there are situations where it's just better. For instance, using mouse scrolling in vim is very convenient, and mouse selection and paste is also very convenient. It's even better when you can use it across the network!

Re: Vim: revisited

#85
post #29

Why people always emphasis h/j/k/l when we already have arrow keys? Do you really waste a lot of time moving your fingers between them? Also, arrow keys work in insert mode.

This is a perfect place to post a Vim tip that I think helped me the most in starting out. Disable arrow keys. It's extremely painful for the first 5 days but I promise that's all it takes to get use to it. And it makes huge difference in your productivity. All that time does add up. Add the following to your .vimrc map map map map imap imap imap imap The reason you want arrow keys disabled in insert mode is that arr…

And then your arrow keys are free to bind to something else useful, like moving between split windows, buffers, etc.

Re: Vim: revisited

#86
post #62

Earlier quoted context omitted.

I agree about accepting (most) standard key bindings, but here are two clever bindings I adopted: " Enter command mode with SPACE instead of : noremap : " Exit insert mode with jj (double J) instead of ESC imap jj

What about changing hjkl movements to jkl;? I didn't try it yet... But hjkl bothers me. My index belongs on j, for homerow touch typing, not h. Wouldn't it be an improvement? Not having to move the hand for movements. I must be missing something because everyone stays with hjkl.

I did this for about two months before switching back to hjkl. There are two reasons why I switched back:

* I like using "Ctrl+Direction" to move around splits, and mapping Ctrl+; on a Mac doesn't work without some Keyremap4Macbook trickery. It's a pain to get working.

* Tons of other stuff uses Vim bindings, and you can't usually remap keys in most other programs.

Re: Vim: revisited

#87
You've gotta manage your expectations properly. Vim takes time to learn. Trust that there's a payoff, be patient. I'd like to think my first attempt at becoming a Vim user stuck, but I took it slow. I was using Vim at my day job, and it went something like this:

1 month - really started to feel a productivity increase over text editing in an IDE

3 months - started to feel like I was flying

6 months - began desperately searching for Vim plugins for Eclipse

Re: Vim: revisited

#88

Every time I read about Vim I feel left off of something huge. Some of the super duper easy shortcuts suggested in this thread translate horribly to AZERTY. For instance ctrl+[ is alt+shift+ctrl+5 on a French Mac or ctrl+altgr+4 on a French PC keyboard.

I hate Azerty. Switch to a qwerty keyboard and use compose key to type accents.

Re: Vim: revisited

#89

Not really sure why the hate for nerdtree. "Don’t use the NERD tree plugin. It is clumsy, will hurt your workflow with split windows, and it’s not particulary pretty either. You never needed a file browser pane in the first place." "It is clumsy" We're talking about VIM, with dozens of keystrokes to invoke everything but emacs already. The whole thing is a bit clumsy! I use it every day and have for a decade but it's…

You've misinterpreted the "hurt your workflow with split windows" bit. You understood it as if NERD Tree's split window is what hurts your workflow. I was saying that my existing split window workflow was hurt by presence of the NERD Tree.

Re: Vim: revisited

#90
post #8

I've used Pathogen previously and I have to say I much prefer Vundle. It's the only plugin I have to manage in my .vim directory. All the plugins I use are listed right in my vimrc, and running :BundleInstall does a git pull from each plugin's repository which gives me the latest updates. I use terminal-based vim for all of my coding and text editing all day, and my vimrc is only 91 sloc. https://github.com/tomhsx/do…

One problem I had with Pathogen using git submodules (and presumably Vundle as well) was the inability to tweak my plugins. I wanted the ability to be able to modify several of the plugins I had installed and I couldn't figure out a nice way of doing this. In the end I opted for git subtrees but this also seems like an overcomplicated solution.

For tweaking plugins, you should use .vim/after/plugin/NAME.vim files. Otherwise, clone the repository, make your changes, and initiate a pull request.
Post reply on HN