Skip to content

Commit

Permalink
Introduce <s/>s/=s as option toggle alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Oct 18, 2021
1 parent 39f195d commit 4910e20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion doc/unimpaired.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,18 @@ On Off Toggle Option
*[oi* *]oi* *yoi* 'ignorecase'
*[ol* *]ol* *yol* 'list'
*[on* *]on* *yon* 'number'
*[op* *]op* *yop* 'spell'

This comment has been minimized.

Copy link
@zeertzjq

zeertzjq Oct 18, 2021

Doesn't this conflict with unimpaired-pasting?

This comment has been minimized.

Copy link
@tpope

tpope Oct 18, 2021

Author Owner

Crap!!!!!

*[or* *]or* *yor* 'relativenumber'
*[os* *]os* *yos* 'spell'
*[ou* *]ou* *you* 'cursorcolumn'
*[ov* *]ov* *yov* 'virtualedit'
*[ow* *]ow* *yow* 'wrap'
*[ox* *]ox* *yox* 'cursorline' 'cursorcolumn' (x as in crosshairs)

The mnemonic for y is that if you tilt it a bit it looks like a switch.

*<s* *>s* *=s*
Alternative prefixes for on/off/toggle: <s, >s, =s.

PASTING *unimpaired-pasting*

These are experimental:
Expand Down
7 changes: 7 additions & 0 deletions plugin/unimpaired.vim
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ call s:option_map('h', 'hlsearch', 'set')
call s:option_map('i', 'ignorecase', 'set')
call s:option_map('l', 'list', 'setlocal')
call s:option_map('n', 'number', 'setlocal')
call s:option_map('p', 'spell', 'setlocal')
call s:option_map('r', 'relativenumber', 'setlocal')
call s:option_map('s', 'spell', 'setlocal')
call s:option_map('w', 'wrap', 'setlocal')
Expand All @@ -349,6 +350,12 @@ 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>')
exe s:Map('n', '=s', '<Plug>(unimpaired-toggle)')
exe s:Map('n', '<s', '<Plug>(unimpaired-enable)')
exe s:Map('n', '>s', '<Plug>(unimpaired-disable)')
exe s:Map('n', '=s<Esc>', '<Nop>')
exe s:Map('n', '<s<Esc>', '<Nop>')
exe s:Map('n', '>s<Esc>', '<Nop>')

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

0 comments on commit 4910e20

Please sign in to comment.