Skip to content

Commit

Permalink
Custom <F8> support for drmikehenry user.
Browse files Browse the repository at this point in the history
  • Loading branch information
drmikehenry committed May 25, 2024
1 parent 7eff450 commit deb37ec
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions user/drmikehenry/vimrc-after.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,37 @@ function Linehash()
call winrestview(savePos)
endfunction

nnoremap <f8> :silent call Linehash()<CR>
imap <f8> <esc><f8>
" Custom setup for <F8>.
function! F8Args(ArgLead, CmdLine, CursorPos)
return "linehash\npaste"
endfunction

function! F8(...)
if len(a:000) == 0
let arg = ''
else
let arg = a:000[0]
endif
if arg == 'linehash'
nmap <F8> :silent call Linehash()<CR>
xmap <F8> <Esc><F8>
imap <F8> <Esc><F8>
elseif arg == 'paste'
nmap <F8> VY:silent !pastewin konsole-3<CR>
xmap <F8> Y:silent !pastewin konsole-3<CR>
imap <F8> <nop>
else
echo 'Current mappings:'
nmap <F8>
vmap <F8>
imap <F8>
endif
endfunction

command! -nargs=? -complete=custom,F8Args F8 call F8(<f-args>)

" Default to `linehash` functionality.
F8 linehash

" Mapping for reviewing code in a Markdown document.
xnoremap q y:call CreateReviewEntry()<CR>
Expand Down

0 comments on commit deb37ec

Please sign in to comment.