3 ms·
> In Vim, you can use K to open a man page for the word under the cursor Holy crap! TIL, and I've been using vim for a decade.
by tomxor 2y ago
> In Vim, you can use K to open a man page for the word under the cursor
Holy crap! TIL, and I've been using vim for a decade.
- kazinator 2y agoI remapped K to :grep for the word under the cursor instead. The way I did it, though, is such that if I give it the numeric prefix, it will do the man lookup in that section. :nmap K "_y:execute count ? ( ":!man " . count . " " . expand("<cword>") ) : ( ":grep \\<" . expand("<cword>") . "\\>")<CR> I have it mapped to do :grep in visual mode also, without the fallback on man. :vmap K "zy:execute ":grep " . getreg("z")<CR> Maybe newer Vim has a solution for "grep word under cursor"; it's such an obvious use case. I'm trained on K though.
- tomxor 2y ago> I'm trained on K though I hear you, have an hard to overcome ctrl-d muscle memory from back in my sublime-text days. Which unfortunately conflicts a little with vim's default ctrl-d in some modes. But for the most part I was surprised how much muscle memory I could re-wire when I forced myself. I think so long as you pick one at a time, and are using it for a solid chunk of time, i.e while you are working, then it doesn't take long, ~1 week maybe until it's 90% instinct. I think I probably need to finally shake ctrl-d, maybe today is the day.
- kazinator 2y agoIn Vim, I use Ctrl-T to indent, and Ctrl-D to deindent (in cases where automation doesn't handle it). Ctrl-T works with the correct indentation amount which is defined by the value of "shiftwidth"; whereas the Tab key inserts a tab, or spaces to get to the next tabstop if "expandtab" is in effect. I trained myself on Ctrl-T more than 20 years ago; some people remap the Tab key to indent.