5 changed files with 745 additions and 692 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
||||
togbg togglebackground.txt /*togbg* |
||||
togbg-default togglebackground.txt /*togbg-default* |
||||
togbg-issues togglebackground.txt /*togbg-issues* |
||||
togbg-newmap togglebackground.txt /*togbg-newmap* |
||||
togbg-usage togglebackground.txt /*togbg-usage* |
||||
toggle-background togglebackground.txt /*toggle-background* |
||||
togglebackground togglebackground.txt /*togglebackground* |
||||
togglebackground.txt togglebackground.txt /*togglebackground.txt* |
||||
togglebg togglebackground.txt /*togglebg* |
||||
@ -0,0 +1,54 @@
|
||||
*togglebackground.txt* For Vim version 7.3. or newer Last change: 2011 Apr 7 |
||||
|
||||
|
||||
TOGGLE BACKGROUND PLUGIN by Ethan Schoonover ~ |
||||
|
||||
Toggle Background *toggle-background* |
||||
*togglebackground* |
||||
*togglebg* *togbg* |
||||
|
||||
Toggle Background is a simple plugin to switch between light and dark |
||||
background modes and reset the colorscheme. This is most useful for |
||||
colorschemes that support both light and dark modes and in terminals or gui |
||||
vim windows where the background will be properly set. |
||||
|
||||
0. Usage |togbg-usage| |
||||
1. Default Mapping |togbg-default| |
||||
2. Changing the Mapping |togbg-newmap| |
||||
3. Issues |togbg-issues| |
||||
|
||||
============================================================================== |
||||
0. Usage *togbg-usage* |
||||
|
||||
Press your map key(s) to activate Toggle Background, or select "Toggle |
||||
Background" from the 'Window' menu while in gui mode. |
||||
|
||||
============================================================================== |
||||
1. Default Mapping *togbg-default* |
||||
|
||||
Toggle Background starts with a default mapping to function key <F5>. If you |
||||
are already using this in a mapping, Toggle Background will not map itself to |
||||
a default and you will have to map it manually in your .vimrc file, or |
||||
remove/change your existing <F5> mapping to another value. |
||||
|
||||
============================================================================== |
||||
2. Changing the Mapping *togbg-newmap* |
||||
|
||||
To set your own mapping in your .vimrc file, simply add the following three |
||||
lines to support normal, insert and visual mode usage: |
||||
|
||||
nmap <unique> <F5> <Plug>ToggleBackground |
||||
imap <unique> <F5> <Plug>ToggleBackground |
||||
vmap <unique> <F5> <Plug>ToggleBackground |
||||
|
||||
Note that it is important to NOT use the noremap map variants. The plugin uses |
||||
noremap internally. |
||||
|
||||
============================================================================== |
||||
3. Issues *togbg-issues* |
||||
|
||||
When using the plugin during insert mode, there should be no interruption in |
||||
workflow. However, if you activate the plugin during REPLACE mode, you will |
||||
switch to insert mode. |
||||
|
||||
vim:tw=78:noet:ts=8:ft=help:norl: |
||||
@ -0,0 +1,45 @@
|
||||
" Toggle background |
||||
" Last Change: April 7, 2011 |
||||
" Maintainer: Ethan Schoonover |
||||
" License: OSI approved MIT license |
||||
|
||||
if exists("g:loaded_ToggleBackground") |
||||
finish |
||||
endif |
||||
let g:loaded_ToggleBackground = 1 |
||||
|
||||
if !exists("no_plugin_maps") && !hasmapto('<Plug>ToggleBackground') |
||||
" map alone won't work here as it doesn't |
||||
try |
||||
silent! nmap <unique> <F5> <Plug>ToggleBackground |
||||
silent! imap <unique> <F5> <Plug>ToggleBackground |
||||
silent! vmap <unique> <F5> <Plug>ToggleBackground |
||||
finally |
||||
let g:test_val = "checked" |
||||
endtry |
||||
endif |
||||
|
||||
" noremap is a bit misleading here if you are unused to vim mapping. |
||||
" in fact, there is remapping, but only of script locally defined remaps, in |
||||
" this case <SID>TogBG. The <script> argument modifies the noremap scope in |
||||
" this regard (and the noremenu below). |
||||
nnoremap <unique> <script> <Plug>ToggleBackground <SID>TogBG |
||||
inoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>a |
||||
vnoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>gv |
||||
nnoremenu <script> Window.Toggle\ Background <SID>TogBG |
||||
inoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>a |
||||
vnoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>gv |
||||
noremap <SID>TogBG :call <SID>TogBG()<CR> |
||||
|
||||
function! s:TogBG() |
||||
let &background = ( &background == "dark"? "light" : "dark" ) | exe "colorscheme " . g:colors_name |
||||
endfunction |
||||
|
||||
if !exists(":ToggleBG") |
||||
command ToggleBG :call s:TogBG() |
||||
endif |
||||
|
||||
function! ToggleBackground() |
||||
echo "Please update your ToggleBackground mapping. ':help togglebg' for information." |
||||
endfunction |
||||
|
||||
Loading…
Reference in new issue