Live data from Hacker News

A Good Vimrc

dougblack.io

151–160 of 178 posts

Re: A Good Vimrc

#151
The `ToggleNumber()` function may be shortened to

    :set invnumber
There two kind of prefixes for `:set` variables: `no-` and `inv-`, the first one turns the variable off or empties it, the second just toggles between states.

Re: A Good Vimrc

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

Mostly based on vim-sensible's (with some input from the community): https://github.com/neovim/neovim/issues/2676

Re: A Good Vimrc

#153
post #49

Rebinding jk to escape because escape is too far away seemed like a fairly ugly hack to me, especially because you can't type it anymore without waiting. Why not simply rebind caps lock to escape? Caps lock is used awfully little, considering how prominent its position on the keyboard is. On Linux, you can rebind it by adding setxkbmap -option caps:escape to your .profile. If instead of an additional escape you prefe…

Ironically, since installing the 'youcompleteme' add on, I've started using the 'jk' escape method more, since ctrl-[ and escape only close the autocomplete window, not out of insert mode.

Re: A Good Vimrc

#154

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…

I managed to use Escape to disable search highlight: https://github.com/alxndr/dotfiles/blob/ce0e18cb40f52f0c60d1...

Re: A Good Vimrc

#155
post #68

Earlier quoted context omitted.

> that can't be explained by anything except by a desire to be treated like a princess Do you mean a desire to be more efficient? Am I some kind of princess because I decided to use a different keyboard layout than the default? That I decided to learn a different language than the one I was told to learn in school? That I wanted to install a different operating system than the one that came with my computer? Your com…

Realistically, what justification is there any more for working on somebody else's machine, being force to use their config? Ok, if your machine explodes and you need their's for a bit fine. But in the long run, the amount of times where you need to actually edit some code by typing on another person's machine should be vanishingly small. I'm all for standards when it comes to collaborating on code. But when it comes…

How do people who like to customize their environment do pair programming? I belong to that group, and I like the idea of pair programming, but I've never had the chance to try it in practice...

Re: A Good Vimrc

#157

The `ToggleNumber()` function may be shortened to :set invnumber There two kind of prefixes for `:set` variables: `no-` and `inv-`, the first one turns the variable off or empties it, the second just toggles between states.

Cool trick.

FYI, you can do the same with :set number!.

Adding ! at the end of a variable will invert it. Adding ? at the end will echo its value.

Re: A Good Vimrc

#158

Earlier quoted context omitted.

Linked post is about vim. The first post of this thread is about vim setups all being different causing problems. The next post is about vim, configs and developers not conforming being a pain in the ass. The next post is about you taking offense to his colourful comment ( he was poking fun btw, you shouldn't be offended ) The next post is me backing his point as having merit without the negative connotations. Specif…

Have you seriously missed that this is a discussion about general customization of things such as keybinds/mappings, shells, dotfiles etc? Somehow you turned that into "IDEs vs vim" and you were the only one mentioning IDEs. Customization can happen in IDEs too, you know...

Listen, I get that you're outraged that I've had the audacity to question the worth of customisations but nitpicking an example doesn't encompass the entire argument doesn't detract from the point that this is a thinking mans game.

As it stands I'm not trying to take your toys from you. If you can take care of yourself, do what you like. If you are likely to need some assistance you'll likely annoy anyone who needs to touch your computer.

Re: A Good Vimrc

#159

Earlier quoted context omitted.

Check out spacemacs

I'm a relatively long time Spacemacs user, and just recently dropped it exactly because it abstracts too much, and I wanted Emacs keybindings. I've failed to comprehend how it answers my question. Thank you anyway.

A couple times a year, I'll scour a few .emacs.d repos on github and see if I can find something interesting in there.

Re: A Good Vimrc

#160
post #58
post #49

Rebinding jk to escape because escape is too far away seemed like a fairly ugly hack to me, especially because you can't type it anymore without waiting. Why not simply rebind caps lock to escape? Caps lock is used awfully little, considering how prominent its position on the keyboard is. On Linux, you can rebind it by adding setxkbmap -option caps:escape to your .profile. If instead of an additional escape you prefe…

Ack, no. Bind caps lock to Ctrl, and escape is now the trivial chord C-[. As an added benefit, getting used to this layout will help you out with migrating out of vim to emacs.

So your suggestion is that, rather than pressing Caps Lock to escape, one should press Caps Lock and [? How is that better (assuming you’re using VIM)? Regular Ctrl isn’t hard to reach.
Post reply on HN