-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mappings for conceallevel=1 toggling #105
Comments
Feels to me like 2 would be the more appropriate choice? That's the value that most accurately implements the syntax highlighter's intentions. |
Yes, I agree with you: If a syntax highlighter does not define a conceal character, it should be understood as being done on purpose. I actually toggle it for tex files. By default it is on: IMHO equations become more readable. |
I could see making |
I have changed the diff: diff --git a/doc/unimpaired.txt b/doc/unimpaired.txt
index 3d97242..f99df77 100644
--- a/doc/unimpaired.txt
+++ b/doc/unimpaired.txt
@@ -76,6 +76,7 @@ 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|)
+*[oe* *]oe* *coe* 'conceallevel' (actually [oe and ]oe cycle)
*[oh* *]oh* *coh* 'hlsearch'
*[oi* *]oi* *coi* 'ignorecase'
*[ol* *]ol* *col* 'list'
diff --git a/plugin/unimpaired.vim b/plugin/unimpaired.vim
index f2c90bb..e2d1388 100644
--- a/plugin/unimpaired.vim
+++ b/plugin/unimpaired.vim
@@ -222,6 +222,11 @@ call s:option_map('u', 'cursorcolumn', 'setlocal')
nnoremap [od :diffthis<CR>
nnoremap ]od :diffoff<CR>
nnoremap cod :<C-R>=&diff ? 'diffoff' : 'diffthis'<CR><CR>
+" Cycle through 'conceallevel' (local to window)
+nnoremap [oe :setlocal <C-R>='conceallevel='.(&conceallevel+1)%4<CR><CR>
+nnoremap ]oe :setlocal <C-R>='conceallevel='.float2nr(&conceallevel-1-(4*floor((&conceallevel-1)/4.0)))<CR><CR>
+" Toggle between default conceallevel 2 and 0 (local to window)
+nnoremap coe :setlocal <C-R>=&conceallevel ? 'conceallevel=0' : 'conceallevel=2'<CR><CR>
call s:option_map('h', 'hlsearch', 'set')
call s:option_map('i', 'ignorecase', 'set')
call s:option_map('l', 'list', 'setlocal') |
I also used 2. My bikeshed, however, uses , with the obvious mnemonic. [o |
I was looking for exactly this; can we push this into master? Is it already there, and I missed it? Just added this to my vimrc: nnoremap =oe :setlocal conceallevel=<c-r>=&conceallevel == 0 ? '2' : '0'<cr><cr>
nnoremap coe :setlocal conceallevel=<c-r>=&conceallevel == 0 ? '2' : '0'<cr><cr>
nnoremap [oe :setlocal conceallevel=<c-r>=&conceallevel > 0 ? &conceallevel - 1 : 0<cr><cr>
nnoremap ]oe :setlocal conceallevel=<c-r>=&conceallevel < 2 ? &conceallevel + 1 : 2<cr><cr> Huh ... this actually works well for the two biggest use cases; ie,
|
Another toggling addition for unimpaired:
Any chance this get merged in? Feel free to pick a different character instead of
e
.The mappings could be changed to cycle through the levels.
The text was updated successfully, but these errors were encountered: