From a2132f8e7d8a10a46837b92630993fa8213c1491 Mon Sep 17 00:00:00 2001 From: Lifepillar Date: Sun, 22 May 2016 00:05:08 +0200 Subject: [PATCH] Add Tips section to the Readme. --- Readme.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Readme.md b/Readme.md index 49917b3..075338a 100644 --- a/Readme.md +++ b/Readme.md @@ -65,3 +65,28 @@ The following options were not available in the original Solarized: These options may be used with any `solarized8_*` variant. + +## Tips + +If you want to quickly toggle between dark and light background, you may define +a mapping like the following: + +``` +nnoremap B :exe "colors" (get(g:, "colors_name", "") =~# "dark" + \ ? substitute(g:colors_name, 'dark', 'light', '') + \ : substitute(g:colors_name, 'light', 'dark', '') + \ ) +``` + +To tune the contrast level you may use the following snippet: + +``` +fun! Solarized8Contrast(delta) + let l:schemes = map(["_low", "_flat", "", "_high"], '"solarized8_".(&background).v:val') + exe "colors" l:schemes[((a:delta+index(l:schemes, g:colors_name)) % 4 + 4) % 4] +endf + +nmap - :call Solarized8Contrast(-v:count1) +nmap + :call Solarized8Contrast(+v:count1) +``` +