Live data from Hacker News

A Good Vimrc

dougblack.io

21–30 of 178 posts

Re: A Good Vimrc

#22
I've been testing your recommendation of using ag in ctrlP (let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'), but the performance seems to be pretty much the same. Do you notice that much of a difference?

Disclaimer: I'm using a SSD.

Re: A Good Vimrc

#23

Disabling the search highlight seems like a rather lowly use for leader+space. Great guide though, didn't know about quite a few options in here, wildmenu is great. I switched to vim from subl about a month ago - it took a bit of getting used to but I'm loving it now. I still use subl for some multi cursor wizardry but that's less and less common now. I found the disabling the arrow keys in normal mode was the point…

[deleted]

Re: A Good Vimrc

#24
post #11

Nice writing. One point/one question: . section titles can be finished with {{{1 and then no closing brackets are necessary. It will just wrap to the next {{{1 occurence. . regarding nvim: how can I find out what the defaults are there? Probably I have quite a lot of definitions which are no longer needed...

Neovim Defaults

From the current docs:

[0] https://neovim.io/doc/user/vim_diff.html#nvim-option-default...

From the GitHub issues page:

[1] https://github.com/neovim/neovim/issues/2676

Re: A Good Vimrc

#25
post #22

I've been testing your recommendation of using ag in ctrlP (let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'), but the performance seems to be pretty much the same. Do you notice that much of a difference? Disclaimer: I'm using a SSD.

I'm using command-t and it works fine for me even in large code base.

AFAIK, ag shines for searching code in large code base, if you are just doing matching with a list of file paths, ag is an overkill.

EDIT: And if you set `wildignore` correctly, you wouldn't have a lot of files. Getting node_modules/ out of my Command-T result made it much faster. I actually wrote a plugin[0] to extract patterns from `.gitignore` and apply to `wildignore`, so that Command-T and CtrlP could have a shorter list to search for.

[0]: https://github.com/octref/RootIgnore

Re: A Good Vimrc

#26

I don't use vim as my go to editor so I may be asking a silly question; does it just use idiotic defaults or something? I've only met a couple 'vim users' who could just hop onto someone else's vim setup and be productive, and I've never met a single vim user who could use someone else's setup without making comments about everything being different. I guess the question is do people modify vim cause they can or caus…

Yes, the vim defaults suck.

If you're building a new vimrc or want a common ground for pairing, I would recommend checking out [vim-sensible](https://github.com/tpope/vim-sensible) by tpope. It's a vim plugin that provides a set of sensible default options.

Re: A Good Vimrc

#27

I don't use vim as my go to editor so I may be asking a silly question; does it just use idiotic defaults or something? I've only met a couple 'vim users' who could just hop onto someone else's vim setup and be productive, and I've never met a single vim user who could use someone else's setup without making comments about everything being different. I guess the question is do people modify vim cause they can or caus…

Vim's default are indeed dumb, but what you described is not a vim-specific problem. Walk into any room full of coders and try to use their computers; you'll discover tons of weirdness that can't be explained by anything except by a desire to be treated like a princess.* Things like rebinding basic shortcuts, reversing the scroll direction (Mac users will get this), swapping Cmd/Ctrl, using some obscure shell or even infecting other people's machines with some haphazardly scp'd dotfiles.

This kind of overcustomization is fine if you live in a basement and work on a project alone. As soon as you become a part of a team, please stop. You're making cooperation unnecessarily hard and spending company time on an optimization that isn't.

*I sometimes joke that coders who refuse to conform to the industry standards should wear a tiara as an indication they are, indeed, unique snowflakes free from the usual social expectations. It seems to work.

Re: A Good Vimrc

#28
post #4

For those just getting started or using vim only occasionally, Tim Pope's vim-sensible is a good, conservative starting point. It just sets some reasonable base configs instead of Vim's crazy default settings. No custom keybindings or fancy plugins included. Vim is by default intended to be compatible with some historical implementation of vi. In my opinion, it doesn't make any sense any more, but I guess there is so…

Agreed, the current defaults are a major turn-off. Especially for first time users. Vim is incredibly frustrating without auto-indent. The problem with vim is that you can't use it effectively unless you know almost everything that there is to know about it. When it comes to vim, you're either a novice or an expert, there is no middle-ground.

That's just really not true. Vim has a massive middle ground. It has a plethora of features that you don't need to know about, but that make your life marginally easier when you do learn them. Getting up to parity with another editor takes a little bit more time than with a yet-another-WYSIWYG, but you can certainly use vim effectively after a day or two. Everything after that point is just bonus productivity.

Re: A Good Vimrc

#29

I, too, wondered about $ and ^ - they are rather inconvenient to type. But instead of B and E, why not map as leader, then have b and e? Space seems like the perfect leader key. Mapping , means you lose prev-finding for some searches (f).

I actually map H to ^ and L to $. In my head it's like "h is left, H is far left"

Re: A Good Vimrc

#30

I don't use vim as my go to editor so I may be asking a silly question; does it just use idiotic defaults or something? I've only met a couple 'vim users' who could just hop onto someone else's vim setup and be productive, and I've never met a single vim user who could use someone else's setup without making comments about everything being different. I guess the question is do people modify vim cause they can or caus…

The journey to learning vim is so long that people at different stages will have things set up differently. I'm still adding and removing things as I learn and understand them, or conversely, as I no longer need them. I'm not kidding when I say it's a 10-year learning curve.
Post reply on HN