5 ms·
Why don't people seem to use the F keys? I have mappings for very frequent functions on F1-F5, and it really helps: map <F1> <Esc>:w<CR>| "Fast save
by joelthelion 11y ago
Why don't people seem to use the F keys? I have mappings for very frequent functions on F1-F5, and it really helps:
map <F1> <Esc>:w<CR>| "Fast save
imap <F1> <Esc>:w<CR>| "Fast save
map <F2> :make<Up><CR>| "Fast compile
map <F3> :bn<CR>
map <S-F3> :bp<CR>
" Same mapping for gnome-terminal ( see http://stackoverflow.com/q/12813126/164171 )
map ^[O1;2R :bp<CR>
map <F4> :bd<CR>| "Close buffer
map <F5> :cnext<cr>
map <S-F5> :cprev<cr>
imap <F5> <Esc>:cnext<cr>
imap <S-F5> <Esc>:cprev<cr>
- andrewstuart2 11y agoOne 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>
- thekemkid 11y agoOMG, I need to add this to my .vimrc. Thanks :D
- leephillips 11y agoHave you tried fugitive (a vim wrapper around git)?
- shmerl 11y agoI map a few of them: " Filesystem browser map <F2> :Explore<CR> " Show whitespace set listchars=eol:↵,tab:>·,trail:~,extends:>,precedes:<,space:␣ map <F4> :set list!<CR>
- iovar 11y agoI'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).
- yawaramin 11y agoYou can remap your Caps Lock key to Esc on pretty much everything: Windows using AutoHotKey, Mac OS using Seil, Unix using xmodmap.
- mod 11y agoThe 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.
- leephillips 11y ago"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).
- pyre 11y agoAdditionally, 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.
- floatboth 11y agoFYI: there is a setting that flips everything around – F1 to get F1, Fn+F1 to lower the brightness.
- deleted 11y ago[deleted]
- pyre 11y agoBut it's also not the default (at least on OSX).
- NeutronBoy 11y ago'It's not the default' is a terrible argument in a thread specifically about customising vi to the Nth degree ;)
- Qwertious 11y agoNot 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.