diff --git a/doc/CSApprox.txt b/doc/CSApprox.txt index ce99710..7b3aa75 100644 --- a/doc/CSApprox.txt +++ b/doc/CSApprox.txt @@ -8,7 +8,7 @@ \___//___//_/ |_|/ .__// .__//_/ \___//_\_\ ~ /_/ /_/ ~ For Vim version 7.0 or newer - Last changed 12 Sep 2008 + Last changed 05 Oct 2008 By Matt Wozniski mjw@drexel.edu @@ -72,9 +72,13 @@ GUI support in their "gvim" binary, and not in their "vim" binary. You can check if GUI support is available by doing: > :echo has('gui') -If you are in an environment where the "vim" binary does not include GUI -support, but where a "gvim" binary is available, you can probably launch Vim -with GUI support anyway using the |-v| flag in the shell: > +If that prints 0, the first thing to try would be searching for a larger vim +package provided by your distribution, like "vim-enhanced" on RedHat/CentOS +or "vim" or "vim-gnome" on Debian/Ubuntu. + +If you are unable to obtain a "vim" binary that includes GUI support, but +have a "gvim" binary available, you can probably launch Vim with GUI support +anyway by calling gvim with the |-v| flag in the shell: > gvim -v If that does not work and no package with GUI support is available, you will @@ -92,7 +96,7 @@ either need for 't_Co' to be set to 88 or 256 in |vimrc|, or for $TERM to be set to something that implies high color support. Possible choices include "xterm-256color" for 256 color support and "rxvt-unicode" for 88 color support. - + *csapprox-palettes* Also, there are three different 256 color cube palettes available and CSApprox has no way to tell which you're using unless $TERM is set to something that is specific to the terminal, like "konsole" or "Eterm". Because of this, the @@ -121,12 +125,13 @@ g:CSApprox_loaded *g:CSApprox_loaded* If set in your |vimrc|, CSApprox is not loaded. g:CSApprox_verbose_level *g:CSApprox_verbose_level* - While running, CSApprox sets 'verbose' to this value (default 1). This - allows CSApprox to default to warning whenever something might be wrong, - but allows the user to disable this behavior if he wants. The most - important messages will be shown at verbosity level 1, some less important - ones will be shown at verbosity level 2. Internal errors and - configuration errors are shown regardless of verbosity level. + When CSApprox is run, the 'verbose' option will be temporarily raised to + the value held in this variable unless it is already greater. The default + value is 1, which allows CSApprox to default to warning whenever something + is wrong, even if it is recoverable, but allows the user to quiet us if he + wants by changing this variable to 0. The most important messages will be + shown at verbosity level 1; some less important ones will be shown at + higher verbosity levels. g:CSApprox_eterm *g:CSApprox_eterm* If set, CSApprox will use the Eterm palette when 'term' is "xterm" or @@ -342,6 +347,8 @@ kterm (as of version 6.2.0) ============================================================================== 7. Changelog *csapprox-changelog* + 1.00 04 Oct 2008 First public release + 0.90 14 Sep 2008 Initial beta release ============================================================================== diff --git a/plugin/CSApprox.vim b/plugin/CSApprox.vim index 9f6636e..556db00 100644 --- a/plugin/CSApprox.vim +++ b/plugin/CSApprox.vim @@ -1,8 +1,8 @@ -" CSApprox: Approximate gvim colorschemes to suitable terminal colors -" Maintainer: Matthew Wozniski (mjw@drexel.edu) -" Date: Sun, 14 Sep 2008 12:43:33 -0400 -" Version: 0.90 -" History: :help csapprox-changelog +" CSApprox: Make gvim-only colorschemes work transparently in terminal vim +" Maintainer: Matthew Wozniski (mjw@drexel.edu) +" Date: Sun, 05 Oct 2008 00:26:22 -0400 +" Version: 1.00 +" History: :help csapprox-changelog " Whenever you change colorschemes using the :colorscheme command, this script " will be executed. If you're running in 256 color terminal or an 88 color @@ -563,15 +563,14 @@ endfunction " {>2} Main function " Wrapper around the actual implementation to make it easier to ensure that " all temporary settings are restored by the time we return, whether or not -" something was thrown. Additionally, sets the 'verbose' option to -" g:CSApprox_verbose_level (default 1) for the duration of the main function. -" This allows us to default to a message whenever any error, even -" a recoverable one, occurs, meaning the user quickly finds out when +" something was thrown. Additionally, sets the 'verbose' option to the max of +" g:CSApprox_verbose_level (default 1) and &verbose for the duration of the +" main function. This allows us to default to a message whenever any error, +" even a recoverable one, occurs, meaning the user quickly finds out when " something's wrong, but makes it very easy for the user to make us silent. function! s:CSApprox() try let savelz = &lz - let savevbs = &vbs set lz @@ -596,9 +595,9 @@ function! s:CSApprox() if !exists("g:CSApprox_verbose_level") let g:CSApprox_verbose_level = 1 endif - sil! let &verbose=g:CSApprox_verbose_level - call s:CSApproxImpl() + " Set 'verbose' set to the maximum of &verbose and CSApprox_verbose_level + exe max([&vbs, g:CSApprox_verbose_level]) 'verbose call s:CSApproxImpl()' finally if exists("colors_name") let g:colors_name = colors_name @@ -610,7 +609,6 @@ function! s:CSApprox() endif let &lz = savelz - let &vbs = savevbs endtry endfunction @@ -623,8 +621,9 @@ endfunction function! s:CSApproxImpl() " Return if not running in an 88/256 color terminal if has('gui_running') || (&t_Co != 256 && &t_Co != 88) - if &verbose && &t_Co != 256 && &t_Co != 88 + if &verbose && !has('gui_running') && &t_Co != 256 && &t_Co != 88 echomsg "CSApprox skipped; terminal only has" &t_Co "colors, not 88/256" + echomsg "Try checking :help csapprox-terminal for workarounds" endif return @@ -675,15 +674,15 @@ function! s:CSApproxImpl() endif endfor - " Then, set all the modified colors to approximate the gui colors. + " We need to set the Normal group first so 'bg' and 'fg' work as colors call sort(modified, "s:SortNormalFirst") - " And finally set each modified color's cterm attributes to match gui + " then set each modified color's cterm attributes to match gui for hlid in modified call s:SetCtermFromGui(highlights[hlid]) endfor - " And store the new highlights for use in the next iteration + " and finally, store the new highlights for use in the next iteration let s:highlights = highlights endfunction