Permalink
Browse files

Replace co option toggle with =o

A punctuation prefix feels like a better fit with the existing maps.
1 parent e1e0cc3 commit 3a7759075cca5b0dc29ce81f2747489b6c8e36a7 @tpope committed Jul 6, 2017
Showing with 21 additions and 18 deletions.
  1. +13 −13 doc/unimpaired.txt
  2. +8 −5 plugin/unimpaired.vim
View
@@ -73,19 +73,19 @@ LINE OPERATIONS *unimpaired-lines*
OPTION TOGGLING *unimpaired-toggling*
On Off Toggle Option
-*[ob* *]ob* *cob* 'background' (dark is off, light is on)
-*[oc* *]oc* *coc* 'cursorline'
-*[od* *]od* *cod* 'diff' (actually |:diffthis| / |:diffoff|)
-*[oh* *]oh* *coh* 'hlsearch'
-*[oi* *]oi* *coi* 'ignorecase'
-*[ol* *]ol* *col* 'list'
-*[on* *]on* *con* 'number'
-*[or* *]or* *cor* 'relativenumber'
-*[os* *]os* *cos* 'spell'
-*[ou* *]ou* *cou* 'cursorcolumn'
-*[ov* *]ov* *cov* 'virtualedit'
-*[ow* *]ow* *cow* 'wrap'
-*[ox* *]ox* *cox* 'cursorline' 'cursorcolumn' (x as in crosshairs)
+*[ob* *]ob* *=ob* 'background' (dark is off, light is on)
+*[oc* *]oc* *=oc* 'cursorline'
+*[od* *]od* *=od* 'diff' (actually |:diffthis| / |:diffoff|)
+*[oh* *]oh* *=oh* 'hlsearch'
+*[oi* *]oi* *=oi* 'ignorecase'
+*[ol* *]ol* *=ol* 'list'
+*[on* *]on* *=on* 'number'
+*[or* *]or* *=or* 'relativenumber'
+*[os* *]os* *=os* 'spell'
+*[ou* *]ou* *=ou* 'cursorcolumn'
+*[ov* *]ov* *=ov* 'virtualedit'
+*[ow* *]ow* *=ow* 'wrap'
+*[ox* *]ox* *=ox* 'cursorline' 'cursorcolumn' (x as in crosshairs)
PASTING *unimpaired-pasting*
View
@@ -231,17 +231,17 @@ endfunction
function! s:option_map(letter, option, mode) abort
call s:map('n', '[o'.a:letter, ':'.a:mode.' '.a:option.'<C-R>=<SID>statusbump()<CR><CR>')
call s:map('n', ']o'.a:letter, ':'.a:mode.' no'.a:option.'<C-R>=<SID>statusbump()<CR><CR>')
- call s:map('n', 'co'.a:letter, ':'.a:mode.' <C-R>=<SID>toggle("'.a:option.'")<CR><CR>')
+ call s:map('n', '=o'.a:letter, ':'.a:mode.' <C-R>=<SID>toggle("'.a:option.'")<CR><CR>')
endfunction
call s:map('n', '[ob', ':set background=light<CR>')
call s:map('n', ']ob', ':set background=dark<CR>')
-call s:map('n', 'cob', ':set background=<C-R>=&background == "dark" ? "light" : "dark"<CR><CR>')
+call s:map('n', '=ob', ':set background=<C-R>=&background == "dark" ? "light" : "dark"<CR><CR>')
call s:option_map('c', 'cursorline', 'setlocal')
call s:option_map('u', 'cursorcolumn', 'setlocal')
call s:map('n', '[od', ':diffthis<CR>')
call s:map('n', ']od', ':diffoff<CR>')
-call s:map('n', 'cod', ':<C-R>=&diff ? "diffoff" : "diffthis"<CR><CR>')
+call s:map('n', '=od', ':<C-R>=&diff ? "diffoff" : "diffthis"<CR><CR>')
call s:option_map('h', 'hlsearch', 'set')
call s:option_map('i', 'ignorecase', 'set')
call s:option_map('l', 'list', 'setlocal')
@@ -251,10 +251,13 @@ call s:option_map('s', 'spell', 'setlocal')
call s:option_map('w', 'wrap', 'setlocal')
call s:map('n', '[ov', ':set virtualedit+=all<CR>')
call s:map('n', ']ov', ':set virtualedit-=all<CR>')
-call s:map('n', 'cov', ':set <C-R>=(&virtualedit =~# "all") ? "virtualedit-=all" : "virtualedit+=all"<CR><CR>')
+call s:map('n', '=ov', ':set <C-R>=(&virtualedit =~# "all") ? "virtualedit-=all" : "virtualedit+=all"<CR><CR>')
call s:map('n', '[ox', ':set cursorline cursorcolumn<CR>')
call s:map('n', ']ox', ':set nocursorline nocursorcolumn<CR>')
-call s:map('n', 'cox', ':set <C-R>=<SID>cursor_options()<CR><CR>')
+call s:map('n', '=ox', ':set <C-R>=<SID>cursor_options()<CR><CR>')
+if empty(maparg('co', 'n'))
+ nmap co =o
+endif
function! s:setup_paste() abort
let s:paste = &paste

0 comments on commit 3a77590

Please sign in to comment.