From d3c277b73e4618ac3d8ab12c2794d01e54b95e74 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Fri, 14 Sep 2012 01:27:21 -0400 Subject: [PATCH] Update docs, etc for 4.00 release --- after/plugin/CSApprox.vim | 25 ++++++++++++ autoload/csapprox.vim | 25 ++++++++++++ autoload/csapprox/common.vim | 25 ++++++++++++ autoload/csapprox/per_component.vim | 25 ++++++++++++ doc/CSApprox.txt | 63 +++++++++++++++++++++++------ plugin/CSApprox.vim | 32 +++++++-------- 6 files changed, 166 insertions(+), 29 deletions(-) diff --git a/after/plugin/CSApprox.vim b/after/plugin/CSApprox.vim index a9c123b..4754efa 100644 --- a/after/plugin/CSApprox.vim +++ b/after/plugin/CSApprox.vim @@ -1,3 +1,28 @@ +" Copyright (c) 2012, Matthew J. Wozniski +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. +" * Redistributions in binary form must reproduce the above copyright +" notice, this list of conditions and the following disclaimer in the +" documentation and/or other materials provided with the distribution. +" * The names of the contributors may not be used to endorse or promote +" products derived from this software without specific prior written +" permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY +" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + " The last thing to do when sourced is to run and actually fix up the colors. if !has('gui_running') && exists(':CSApprox') CSApprox diff --git a/autoload/csapprox.vim b/autoload/csapprox.vim index baf1887..a8fbcf6 100644 --- a/autoload/csapprox.vim +++ b/autoload/csapprox.vim @@ -1,3 +1,28 @@ +" Copyright (c) 2012, Matthew J. Wozniski +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. +" * Redistributions in binary form must reproduce the above copyright +" notice, this list of conditions and the following disclaimer in the +" documentation and/or other materials provided with the distribution. +" * The names of the contributors may not be used to endorse or promote +" products derived from this software without specific prior written +" permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY +" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + let s:rgb = {} let s:rgb["alice blue"] = "#f0f8ff" diff --git a/autoload/csapprox/common.vim b/autoload/csapprox/common.vim index c128240..cf61379 100644 --- a/autoload/csapprox/common.vim +++ b/autoload/csapprox/common.vim @@ -1,3 +1,28 @@ +" Copyright (c) 2012, Matthew J. Wozniski +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. +" * Redistributions in binary form must reproduce the above copyright +" notice, this list of conditions and the following disclaimer in the +" documentation and/or other materials provided with the distribution. +" * The names of the contributors may not be used to endorse or promote +" products derived from this software without specific prior written +" permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY +" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + let s:xterm_colors = [ 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF ] let s:eterm_colors = [ 0x00, 0x2A, 0x55, 0x7F, 0xAA, 0xD4 ] let s:konsole_colors = [ 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF ] diff --git a/autoload/csapprox/per_component.vim b/autoload/csapprox/per_component.vim index 2342af3..1059dc8 100644 --- a/autoload/csapprox/per_component.vim +++ b/autoload/csapprox/per_component.vim @@ -1,3 +1,28 @@ +" Copyright (c) 2012, Matthew J. Wozniski +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. +" * Redistributions in binary form must reproduce the above copyright +" notice, this list of conditions and the following disclaimer in the +" documentation and/or other materials provided with the distribution. +" * The names of the contributors may not be used to endorse or promote +" products derived from this software without specific prior written +" permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY +" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + " Integer comparator used to sort the complete list of possible colors function! s:IntCompare(i1, i2) return a:i1 == a:i2 ? 0 : a:i1 > a:i2 ? 1 : -1 diff --git a/doc/CSApprox.txt b/doc/CSApprox.txt index dc5f853..888ec66 100644 --- a/doc/CSApprox.txt +++ b/doc/CSApprox.txt @@ -8,10 +8,10 @@ \___//___//_/ |_|/ .__// .__//_/ \___//_\_\ ~ /_/ /_/ ~ For Vim version 7.0 or newer - Last changed 01 Apr 2009 + Last changed 14 Sep 2012 By Matt Wozniski - mjw@drexel.edu + godlygeek@gmail.com Reference Manual~ @@ -74,7 +74,7 @@ NOTE: The generated colorscheme will only work in 88- and 256-color terminals, standard for what those 16 colors look like other than 'orange-ish', 'red-ish', etc. -NOTE: Although :CSApproxSnapshot can be used in both GVim and terminal Vim, +NOTE: Although |:CSApproxSnapshot| can be used in both GVim and terminal Vim, the resulting colors might be slightly off when run from terminal Vim. I can find no way around this; Vim internally sets different colors when running in a terminal than running in the GUI, and there's no way for @@ -97,7 +97,10 @@ group from the corresponding gui color. Syntax: For CSApprox to work, there are 2 major requirements that must be met. -a) GUI support *csapprox-gui-support* *csapprox-+gui* +a) GUI support (or vim >= 7.3) *csapprox-gui-support* *csapprox-+gui* + +NOTE This section only applies to vim versions before 7.3.000 - a modern vim +does not need GUI support in order for CSApprox to function. If CSApprox is being used to adjust a scheme's colors transparently, then the terminal "vim" binary that is being run must be built with GUI support (see @@ -105,6 +108,7 @@ terminal "vim" binary that is being run must be built with GUI support (see used to create a terminal colorscheme for high color terminals, then the "vim" binary being used to create the scheme must be built with +gui, but the scheme can be used in terminal "vim" binaries that weren't built with +gui. + NOTE that creating snapshots with GVim will work better than making them with Vim, and (obviously) all "gvim" binaries are built with +gui. @@ -397,7 +401,7 @@ gives a very close approximation to the GVim colors without requiring any changes to the colorscheme, or any user interaction. It only requires that the plugin be installed on the machine where Vim is being run, and that the user's environment meets the needs specified at |csapprox-requirements|. In -the event that this doesn't work, a second option - using :CSApproxSnapshot +the event that this doesn't work, a second option - using |:CSApproxSnapshot| to create a new, 88-/256-color capable colorscheme - is available. Ideally, the aim is for CSApprox to be completely transparent to the user. @@ -425,15 +429,16 @@ improvements or complaints. ============================================================================== 5. Known Bugs and Limitations *csapprox-limitations* -GUI support is required for transparently adapting schemes. +GUI support or vim >= 7.3 is required for transparently adapting schemes. There is nothing I can do about this given my chosen design. CSApprox works by being notified every time a colorscheme sets some GUI colors, then approximating those colors to similar terminal colors. Unfortunately, when - Vim is not built with GUI support, it doesn't bother to store the GUI + Vim < 7.3 is not built with GUI support, it doesn't bother to store the GUI colors, so querying for them fails. This leaves me completely unable to tell what the colorscheme was trying to do. See |csapprox-+gui| for some - potential workarounds if your distribution doesn't provide a Vim with +gui. + potential workarounds if your distribution doesn't provide a Vim with +gui + and you can't upgrade to a modern vim. User intervention is sometimes required for information about the terminal. @@ -583,11 +588,42 @@ kterm (as of version 6.2.0) ============================================================================== 7. Changelog *csapprox-changelog* + 4.00 14 Sep 2012 Fix CSApprox to not fail in vim 7.3 if not +gui, now + that vim behaves properly even without +gui + + Provide the |:CSApprox| command to re-run CSApprox's + approximation algorithm even if the colorscheme hasn't + changed - useful for when the user has tweaked some + colors manually. + + Better handling for the |inverse| (aka reverse) attribute + for terminals that actually support it - and add the + g:CSApprox_fake_reverse config variable to allow + switching back to the old behavior for terminals that + don't support real reverse video. + + Fix an issue where CSApprox would unconditionally leave + 'background' set to "light" - now it will leave + 'background' unchanged when it runs. + + Change the handling for Konsole to use the xterm palette + by for KDE versions >= 2.2.0 - Konsole itself was + changed to drop its old, slightly incompatible palette + in KDE 2.2.0 + + Fix a minor issue where running vim in recovery mode + with |-r| would result in a complaint from CSApprox that + the terminal didn't have enough colors even when it did. + + Fix an issue where, even if CSApprox had been disabled + by setting |g:CSApprox_loaded|, a CSApprox error message + could still be displayed. + 3.50 01 Apr 2009 Fix a major regression that prevented the Eterm and Konsole colors from being correctly snapshotted Fix a related bug causing incorrect terminal colors - after calling :CSApproxSnapshot + after calling |:CSApproxSnapshot| Fix a bug causing black to be used instead of dark grey @@ -607,12 +643,12 @@ kterm (as of version 6.2.0) light of the above change 3.05 31 Jan 2009 Fix a harmless "Undefined variable" error in - :CSApproxSnapshot + |:CSApproxSnapshot| Fix a behavioral bug when dumping out colors defined external to the scheme. - 3.00 21 Jan 2009 Update the docs for better info on :CSApproxSnapshot + 3.00 21 Jan 2009 Update the docs for better info on |:CSApproxSnapshot| Allow snapshotted schemes to work on Vim 6, and work properly in Konsole and Eterm (thanks David Majnemer!) @@ -624,7 +660,7 @@ kterm (as of version 6.2.0) to run, either before or after the approximation algorithm is run, for all schemes or one specific one. - Also rewrite :CSApproxSnapshot to be more maintainable + Also rewrite |:CSApproxSnapshot| to be more maintainable and less of a hack, and fix several bugs that it contained. @@ -647,7 +683,8 @@ always get the short end of the stick. He'd like to be notified of any problems you find - after all, he took the time to write all this lovely documentation, and this plugin, which took more time than you could possibly imagine to get working transparently for every colorscheme he could get his -hands on. You can contact him with any problems or praises at mjw@drexel.edu +hands on. You can contact him with any problems or praises at +godlygeek@gmail.com ============================================================================== vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl: diff --git a/plugin/CSApprox.vim b/plugin/CSApprox.vim index bc37019..68f92d8 100644 --- a/plugin/CSApprox.vim +++ b/plugin/CSApprox.vim @@ -1,7 +1,7 @@ " CSApprox: Make gvim-only colorschemes Just Work terminal vim -" Maintainer: Matthew Wozniski (mjw@drexel.edu) -" Date: Wed, 01 Apr 2009 22:10:19 -0400 -" Version: 3.50 +" Maintainer: Matthew Wozniski (godlygeek@gmail.com) +" Date: Fri, 14 Sep 2012 01:12:13 -0400 +" Version: 4.00 " History: :help csapprox-changelog " " Long Description: @@ -23,13 +23,13 @@ " high color already. " " License: -" Copyright (c) 2009, Matthew J. Wozniski +" Copyright (c) 2012, Matthew J. Wozniski " All rights reserved. " " Redistribution and use in source and binary forms, with or without " modification, are permitted provided that the following conditions are met: -" * Redistributions of source code must retain the above copyright notice, -" this list of conditions and the following disclaimer. +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. " * Redistributions in binary form must reproduce the above copyright " notice, this list of conditions and the following disclaimer in the " documentation and/or other materials provided with the distribution. @@ -37,16 +37,16 @@ " products derived from this software without specific prior written " permission. " -" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS -" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -" NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, -" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -" OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY +" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. " {>1} Basic plugin setup