Live data from Hacker News

A Good Vimrc

dougblack.io

1–10 of 178 posts

Re: A Good Vimrc

#3
Great writeup and thank you making it clear that you want people to understand what's happening. I love the clean style of your site.

Let me also recommend some of my favorites:

  set matchpairs+=     " match  as well
  set ignorecase          " case-insensitive search
  set smartcase           " upper-case sensitive search
If you already use ctrlp, you might also cpsm [0], a better matcher for it and ctrlp-funky [1] which allows you to go to methods and other symbols in a ctrlp style.

  [0] https://github.com/nixprime/cpsm
  [1] https://github.com/tacahiroy/ctrlp-funky

Re: A Good Vimrc

#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 some reasoning behind the decision.

https://github.com/tpope/vim-sensible

Re: A Good Vimrc

#5
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…

neovim has some saner defaults, by the way.

Re: A Good Vimrc

#7
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).

Re: A Good Vimrc

#8
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.

Re: A Good Vimrc

#9
Nice tutorial. While I understand the pleasure of configuring stuff — being a Gentoo-lover I'm throwing stones in a glass house here — I always stuck to a very simple Vimrc file. I find it better to learn how to use the standard settings than forever me tinkering on my own. One could always wish the standard settings were more sane, though…

Re: A Good Vimrc

#10
This is a very nice write up, but the tabs/spaces part of it makes no sense at all.

"I like it, since it means my source code looks the same on every machine."

That reason just makes no sense at all.

There's only one reason for configuring tabs to be anything but tabs, and that's because someone else set the standard. So if you're editing python or bash, and you don't feel like being a rebel with a cause, you set expand tab.

But obviously you shouldn't be doing that manually every time you open a file, so you should configure Vim to detect what's going on.

You can do that by adding the `ciaranm/detectindent` plugin and then setting the following line:

    autocmd BufReadPost * :DetectIndent
To detect the indentation any time you open a file. That at least for me makes the headache go away most of the time.
Post reply on HN