Skip to content

Commit

Permalink
Hide ugly plug map on option toggle with 'showcmd'
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Sep 17, 2021
1 parent 5a0fb63 commit c51ed44
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugin/unimpaired.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ function! s:map(...) abort
return ''
endfunction

function! s:Map(...) abort
call add(s:maps, copy(a:000))
return ''
endfunction

function! s:maps() abort
for [mode, head, rhs; rest] in s:maps
let flags = get(rest, 0, '') . (rhs =~# '^<Plug>' ? '' : '<script>')
Expand Down Expand Up @@ -325,9 +330,12 @@ nmap <script> <Plug>(unimpaired-enable)+ :<C-U>set cursorline cursorcolumn<CR>
nmap <script> <Plug>(unimpaired-disable)+ :<C-U>set nocursorline nocursorcolumn<CR>
nmap <script> <Plug>(unimpaired-toggle)+ :<C-U>set <C-R>=<SID>CursorOptions()<CR><CR>
exe s:map('n', 'yo', '<Plug>(unimpaired-toggle)')
exe s:map('n', '[o', '<Plug>(unimpaired-enable)')
exe s:map('n', ']o', '<Plug>(unimpaired-disable)')
exe s:Map('n', 'yo', '<Plug>(unimpaired-toggle)')
exe s:Map('n', '[o', '<Plug>(unimpaired-enable)')
exe s:Map('n', ']o', '<Plug>(unimpaired-disable)')
exe s:Map('n', 'yo<Esc>', '<Nop>')
exe s:Map('n', '[o<Esc>', '<Nop>')
exe s:Map('n', ']o<Esc>', '<Nop>')

function! s:SetupPaste() abort
let s:paste = &paste
Expand Down

0 comments on commit c51ed44

Please sign in to comment.