Re:How to boost your Vim productivity
by joelthelion on Tuesday June 02, 2015 @11:46AM
(#9646627)
Why don't people seem to use the F keys? I have mappings for very frequent functions on F1-F5, and it really helps:
[ Parent
| on HN ]
Re:How to boost your Vim productivity
by leephillips on Tuesday June 02, 2015 @12:32PM
(#9647007)
"Why don't people seem to use the F keys?"
Probably because that doesn't fit well with touch typing. A great thing about vim is that you can do everything as a touch typist, without reaching for the outlying districts of the keyboard (assuming you've remapped the escape key to capslock, or learned to use ^[, or mapped it).
Additionally, on many keyboards (specifically Apple keyboards), you have to hit a modifier key plus the function key. For example, you have to hit Fn + F1 to get F1 because otherwise it's the "Lower LCD Brightness" hotkey. This makes them even less useful.
FYI: there is a setting that flips everything around – F1 to get F1, Fn+F1 to lower the brightness.
Not always useful if e.g. you're locked out of the BIOS, the setting constantly auto-resets for no apparent reason, the keyboard is partially broken.
The sad thing is that I've personally experienced all three of these problems. #%^$ whoever decided that the Function keys should be brightness etc by default.
But it's also not the default (at least on OSX).
Re:How to boost your Vim productivity
by NeutronBoy on Tuesday June 02, 2015 @10:58PM
(#9650296)
'It's not the default' is a terrible argument in a thread specifically about customising vi to the Nth degree ;)
Does Apple not offer Fn Lock? Most keyboards in the last many years seem to be going this way, but it's always easy to switch it off. I certainly press F5 more often than change brightness.
Re:How to boost your Vim productivity
by andrewstuart2 on Tuesday June 02, 2015 @11:52AM
(#9646680)
One of my favorite bits for saving my own butt: commit more.
"Function to commit.
function! GitCommit ()
execute 'write'
let message = input('Enter commit message: ')
execute '!git add ' . bufname('%') . ' && git commit -m ''' . message . ''';'
endfunction
imap <F7> <Esc>:call GitCommit()<CR>
map <F7> <Esc>:call GitCommit()<CR>
Re:How to boost your Vim productivity
by leephillips on Tuesday June 02, 2015 @12:37PM
(#9647042)
Have you tried fugitive (a vim wrapper around git)?
OMG, I need to add this to my .vimrc. Thanks :D
The only F-key I can hit reliably without looking down is F5, which comes from years of browser use & web development, and a slight gap there on my keyboard.
Perhaps it could be learned, but I haven't learned it yet in ~20 years of typing.
I'd guess, for the same reason I use Ctrl-[ instead of the Esc key.
F keys put you out of the home row (at least in full size keyboards).
You can remap your Caps Lock key to Esc on pretty much everything: Windows using AutoHotKey, Mac OS using Seil, Unix using xmodmap.