Add mappings for <C-F[1-4]>

This commit is contained in:
Mathieu Maret 2020-12-18 11:44:16 +01:00
parent 794d826f64
commit 68a4e8a979
3 changed files with 29 additions and 0 deletions

View File

@ -14,3 +14,24 @@ endif
" map <press ctrl-V><press your key map> :some vimcmds <press Ctrl-V><press " map <press ctrl-V><press your key map> :some vimcmds <press Ctrl-V><press
" enter> " enter>
" you can check the result with :map <press ctrl-V><press your key map> " you can check the result with :map <press ctrl-V><press your key map>
" MapFastKeycode: helper for fast keycode mappings
" makes use of unused vim keycodes <[S-]F15> to <[S-]F37>
function! <SID>MapFastKeycode(key, keycode)
if s:fast_i == 46
echohl WarningMsg
echomsg "Unable to map ".a:key.": out of spare keycodes"
echohl None
return
endif
let vkeycode = '<'.(s:fast_i/23==0 ? '' : 'S-').'F'.(15+s:fast_i%23).'>'
exec 'set '.vkeycode.'='.a:keycode
exec 'map '.vkeycode.' '.a:key
let s:fast_i += 1
endfunction
let s:fast_i = 0
call <SID>MapFastKeycode('<C-F1>', "")
call <SID>MapFastKeycode('<C-F2>', "")
call <SID>MapFastKeycode('<C-F3>', "")
call <SID>MapFastKeycode('<C-F4>', "")

View File

@ -27,6 +27,11 @@ function! PopulateMenu()
exe "amenu PopUp.Create\\ global\\ code\\ reference\\ for\\ path<Tab><Shift-F3> :call AutotagsAdd()<CR>" exe "amenu PopUp.Create\\ global\\ code\\ reference\\ for\\ path<Tab><Shift-F3> :call AutotagsAdd()<CR>"
exe "amenu PopUp.-Sep3- :" exe "amenu PopUp.-Sep3- :"
exe "amenu PopUp.Toggle\\ show\\ function<Tab><F8> :TlistToggle<CR>" exe "amenu PopUp.Toggle\\ show\\ function<Tab><F8> :TlistToggle<CR>"
exe "amenu PopUp.-Sep3- :"
exe "amenu PopUp.Menu<Tab> <Plug>(lcn-menu)"
exe "amenu PopUp.hover<Tab> <Plug>(lcn-hover)"
exe "amenu PopUp.definition<Tab> <Plug>(lcn-definition)"
exe "amenu PopUp.rename<Tab> <Plug>(lcn-rename)"
endfunc endfunc

3
.vimrc
View File

@ -31,6 +31,8 @@
" snippets) " snippets)
" look at :help index " look at :help index
" or " or
" :verbose map <key>
" or for all keys
":redir! > vim_maps.txt ":redir! > vim_maps.txt
":map " Normal, visual, select and operator bindings ":map " Normal, visual, select and operator bindings
":map! "insert and command-line mode bindings ":map! "insert and command-line mode bindings
@ -607,6 +609,7 @@ if v:version >= 800
nmap <buffer> <silent> K <Plug>(lcn-hover) nmap <buffer> <silent> K <Plug>(lcn-hover)
nmap <buffer> <silent> gd <Plug>(lcn-definition) nmap <buffer> <silent> gd <Plug>(lcn-definition)
nmap <buffer> <silent> cr <Plug>(lcn-rename) nmap <buffer> <silent> cr <Plug>(lcn-rename)
map <C-F1> <Plug>(lcn-menu)
endif endif
endfunction endfunction
autocmd FileType * call LC_maps() autocmd FileType * call LC_maps()