Commit Graph

64 Commits

Author SHA1 Message Date
Matt Wozniski
af90b27f8a Add fbterm as a known 256-color terminal
Suggested by Ben Longbons
2013-03-07 23:59:30 -05:00
David West
38460da0f9 removing pipes around help csapprox-changelog for user 2013-02-14 22:52:06 -05:00
Matt Wozniski
d3c277b73e Update docs, etc for 4.00 release 2012-09-14 01:29:10 -04:00
Matt Wozniski
f98bf4acef Vim 7.3 doesn't need +gui for CSApprox 2010-07-20 01:48:07 -04:00
Matt Wozniski
96e7aebcb7 Little bit of refactoring
I noticed that the list of possible attributes was written out
repeatedly, so I'm encapsulating the list in a function.
2010-07-19 23:54:10 -04:00
Matt Wozniski
63e636157a Translate gui=reverse to cterm=reverse
Until now, "gui=reverse" was translated to "ctermbg=fg ctermfg=bg", but
Will Gray (graywh) pointed out to me that this is wrong, since there are
many terminal emulators that do properly handle reverse video.
2010-07-19 22:52:22 -04:00
Matt Wozniski
88df3d0093 Prevent CSApprox from trashing 'background'
Whenever you change the Normal highlight group, vim always changes 'bg'
to light; try:
vim -u NONE -N -c 'set bg=dark' -c 'hi Normal ctermbg=16 ctermfg=255'

This change just makes CSApprox save/restore 'bg' before/after changing
the highlight groups.

Suggestion made by Kris Malfettone (and I'm sure that someone else
pointed this issue out to me in the past, but I didn't act on it then
and forgot who you are, so I'm sorry for not crediting you).
2010-07-18 12:21:45 -04:00
Matt Wozniski
4b6b1648d0 Konsole now supports the xterm color palette
And apparently has for some time[1].  Thanks to Will Gray (graywh) for
pointing this out to me.

[1] http://websvn.kde.org/?revision=909719&view=revision)
2010-07-18 12:21:29 -04:00
Matt Wozniski
6890d1ecf0 Fix up colors in an after/plugin instead of plugin
As suggested by Ingo Karkat, this will help CSApprox to better cope with
other plugins that set colors themselves.
2010-05-02 21:41:17 -04:00
Matt Wozniski
5ea9ec2169 Change the test for complaining about t_Co != 256
Before, this test would be short-circuited only if gvim was running.
This caused vim to still complain when run as "vim -r" (which apparently
loads plugins, presumably to set up the proper 'directory' path...).
So, I've changed the short circuiting to happen whenever t_Co is the
empty string, which happens to be true both for gvim (which
understandably doesn't do the terminal initialization stuff) and for vim
-r (which largely inexplicably skips terminal initialization).
2010-05-02 21:38:35 -04:00
Matt Wozniski
80b1bd5863 Kludge around inability to reference autoloads
This was causing problems when running in Vim 7.0 or 7.1.  graywh
bisected down to the commit introducing it for me, (d2c906) making it
easy to spot the problem.
2009-11-07 11:46:48 -05:00
Matt Wozniski
cdde3b6ade Make g:CSApprox_loaded prevent warning when -gui 2009-11-02 22:07:09 -05:00
Matt Wozniski
347cc66837 Provide a command to re-run approximation manually 2009-07-12 17:15:48 -04:00
Matt Wozniski
d2c9063179 Break some code into autoloads.
Not useful to keep it in one file anymore, since we already rely upon
multiple, and this will make later extending easier by giving us some
library functions for approximators.
2009-05-30 00:01:52 -04:00
Matt Wozniski
ca9745614e Clean up comments, docs, and timestamps for 3.50 2009-04-02 03:46:43 -04:00
Matt Wozniski
6e73754fc7 Don't unnecessarily copy the rgb.txt list 2009-03-31 23:20:03 -04:00
Matt Wozniski
20ccdd4810 Avoid loading rgb list for color names used by vim
Some colors are used by name in the default colorschemes.  Duplicate these in
their own table, to avoid loading entire rgb.txt list unless it's really
necessary.
2009-03-31 23:19:46 -04:00
Matt Wozniski
af6d70e7f4 Validate the attr map only once per run
Before, each call to s:attr_map() would make sure that the things being
mapped from and to were valid.  Optimize this by making sure all at once
that all things being mapped from, and all things being mapped to, are
valid, before using any attributes.
2009-03-28 21:00:18 -04:00
Matt Wozniski
b0bab84bfe Process Normal first without sorting
Instead of sorting the entire list of all highlight groups in order to
make sure that Normal is handled first, just pluck out the Normal group
from the list and move it to the front.  Seems to be slightly better for
speed, and yields slightly more readable code anyway.
2009-03-28 21:00:15 -04:00
Matt Wozniski
7171f7976c Default to using builtin rgb.txt maps
Provide a variable to override this behavior and use showrgb instead.
This sacrifices a tiny bit of accuracy in favor of a large speed boost.
2009-03-28 20:59:26 -04:00
Matt Wozniski
b5ea2fa88d Move guisp retrieval into a separate function.
No idea why this is faster... but it is, profiling proves it.
2009-03-28 20:59:26 -04:00
Matt Wozniski
7522e9b3d7 Limit calls to synIDattr() in s:Highlights()
Modify s:Highlights() to only check modes it's explicitly told to.
s:CSApproxImpl() needs only gui colors, s:CSApproxSnapshot() needs gui,
cterm, and term.
2009-03-28 20:59:08 -04:00
Matt Wozniski
df73d5e798 Calculate colors_name for snapshots at runtime 2009-03-28 03:29:41 -04:00
Matt Wozniski
fe8d4e6acf Fix another regression
Colors weren't restored after running :CSApproxSnapshot.  Make one extra
call to s:CSApprox() after restoring the konsole and eterm markers, and
&t_Co
2009-03-28 02:55:20 -04:00
Matt Wozniski
4eb86232c6 Fix major regression in CSApproxSnapshot
After 4091aca090 dumping colors with
CSApproxSnapshot was completely broken.  That commit stopped changing
&t_Co from reverting changes to colors not made by the colorscheme by
preventing the colorscheme from being re-sourced every time &t_Co
changed.  Unfortunately, that stopped the ColorScheme autocmd from
firing, which stopped s:CSApprox() from calculating the colors, which
meant we would dump the same colors regardless of &t_Co, and regardless
of {xterm,konsole,eterm}.

Fix this problem by calling s:CSApprox() explicitly after changing &t_Co
2009-03-27 13:50:15 -04:00
Matt Wozniski
9babf1dfd3 First try showrgb, then our own (cooked) rgb.txt
Only using showrgb would fail on systems that have 256 colors terminals
but don't have xorg, such as OS X.
2009-02-28 18:29:12 -05:00
Matt Wozniski
eee8d8dab0 Use 'showrgb' instead of searching for rgb.txt
Replace the logic of searching for an rgb.txt file on the system with
making a call to the 'showrgb' binary on the system and parsing its
output.  This should be available on all X11 systems, regardless of
whether or not the system has rgb.txt.
2009-02-27 18:38:11 -05:00
Matt Wozniski
4e35c3dcc9 Fix up some documentation 2009-02-26 01:13:27 -05:00
Matt Wozniski
a55012c758 Fix a silly mistake.
This bug would stop CSApprox from ever choosing #080808 (or the lowest
color on the greyscale ramp of another palette) as the closest match for
any color.
2009-02-06 02:26:17 -05:00
Matt Wozniski
148a307714 Changelog + timestamp updates for 3.05 2009-01-31 04:18:43 -05:00
Matt Wozniski
4091aca090 Fix a bug dumping colors not set in the scheme
CSApproxSnapshot should make a snapshot of the currently used colors,
rather than the colors defined in the colorscheme.  But, when
CSApproxSnapshot() changed &t_Co, the scheme was reloaded, causing :hi
clear to run and delete all colors.  Definitely not desired.  Stop that
from happening in the same way as it is prevented in CSApprox().
2009-01-31 04:18:13 -05:00
Matt Wozniski
25191dfdf4 Fix a (harmless) E121 in CSApprox.vim
The konsole and eterm flags were being saved/restored without first
checking for their existence.
2009-01-31 04:08:38 -05:00
Matt Wozniski
5b57902f3c Finalize 3.0 release.
Bump version numbers and timestamps.

Massive documentation update to make CSApproxSnapshot well-documented,
rather than just a side-note.

Add a slight tweak to the plugin to match the updated docs: it's no
longer enough for g:CSApprox_eterm or g:CSApprox_konsole to simply
exist, they must also evaluate as True.
2009-01-21 19:39:41 -05:00
Matt Wozniski
5e1e7f076e Make snapshots not error in vim built with -eval 2009-01-21 19:35:44 -05:00
Matt Wozniski
33f33f8378 Fix bugs when using CSApproxSnapshot in gvim
Don't accidentally remove g:CSApprox_{konsole,eterm} if they were set.

Can't :unlet both in one line, or the 2nd might not get unlet.
2009-01-21 19:35:44 -05:00
Matt Wozniski
5988674c15 Fix broken eterm/konsole detection on TERM=screen
A typo - I used ==# where I meant =~#
2009-01-21 19:35:44 -05:00
Matt Wozniski
ba187f34ef Add docs on how to skip CSApprox for a scheme 2009-01-17 02:07:21 -05:00
Matt Wozniski
6ae5bdc943 Make snapshots work on vim6, eterm, konsole
Before, snapshotted schemes could contain guisp= attributes, or
term=undercurl, which caused errors when used with vim 6.  Now, if the
colorscheme detects that vim 6 is running, it will strip those from the
:highlight commands that get used.  More incompatibilities might exist
that I can't think of, though...

And, add logic to snapshotted schemes to make them recognize konsole and
eterm in the same way as CSApprox proper, and, if they're found, use the
appropriate colors.
2009-01-17 01:36:04 -05:00
Matt Wozniski
e5ebdd692f Skip "abort if high color set" logic for snapshots
Before, snapshots wouldn't work right for high color schemes, since
CSApproxImpl aborted early when a high color was found.  If the user
wanted this, though, they wouldn't have called CSApproxSnapshot.  So,
skip this logic in that case.
2009-01-17 01:26:57 -05:00
Matt Wozniski
f8019878d0 Don't run CSApproxImpl unless t_Co is sane.
This was set up to allow CSApproxImpl() to run if either t_Co was set to
88 or 256, or if we were running in gui vim.  Presumably this was added
for CSApproxSnapshot, but that sets t_Co to something sane even in gvim.
This was causing errors slightly later when t_Co was unset.
2009-01-17 01:22:39 -05:00
Matt Wozniski
8a50ea7462 add a .gitignore file 2009-01-17 01:18:00 -05:00
Matt Wozniski
98a75481a7 Clarify some CSApprox docs 2009-01-15 14:09:20 -05:00
Matt Wozniski
450d37a373 Add support for hooks, finalize 2.0 release info 2009-01-15 13:19:43 -05:00
Matt Wozniski
5418f85ed0 Fix a bug handling high-color themes
Thank goodness I caught this before releasing CSApprox 2.0!  Two
misplaced lines meant that it would crap all over already 256 color
themes, like inkpot.vim and vividchalk.vim, because they cleared the old
cterm colors before the test that made sure that none of the old cterm
colors were over 15.
2009-01-15 13:19:43 -05:00
Matt Wozniski
7e4ffb4b2a Rewrite of CSApproxSnapshot
Now it's much less hacky, and looks much more like a well-designed
feature.  I doubt it's perfect, but it seems to work well in every test
case I have, as long as it's run from gvim.  I've discovered that it
doesn't work when run from terminal vim, and it seems unlikely that it
ever will - it's capable of spitting out the right cterm colors in that
case, but can't reproduce the proper gui colors.
2009-01-15 13:19:43 -05:00
Matt Wozniski
147d3c9f71 Update CSApprox now that synIDattr supports guisp
Docs are updated to reference the required patch number (7.2.052) and
the code is updated to test based on the existence of that patch, rather
than brute forcing.
2009-01-15 13:19:43 -05:00
Matt Wozniski
e7db246c9d Add a tweak to CSApprox
Add a message suggesting reading the help for suggestions when vim
doesn't have +gui
2009-01-15 13:19:43 -05:00
Matt Wozniski
28bc8de86c CSApprox version 1.50 released.
This release adds the CSApproxSnapshot command allowing an 88-/256-color
colorscheme to be created from a colorscheme in gvim or a +gui terminal
vim.
2009-01-15 13:19:43 -05:00
Matt Wozniski
084ad4cc01 Initial support for creating 88/256 color schemes
Added a new function, CSApproxSnapshot(filename [, force=0]).  This
function will take the current colors and dump them out to a new
colorscheme script stored at `filename', unless that file already exists
and `force' is not set.  This may still have some bugs to work out, I'm
surprised it was this easy...  Not surprisingly, it falls apart if the
colorscheme didn't set g:colors_name...  And it doesn't handle
highlights the user made himself, outside of the scheme.  Still, it's
a good first draft.
2009-01-15 13:19:43 -05:00
Matt Wozniski
cb1d299c94 Update changelogs/timestamps for 1.10 release 2009-01-15 13:19:43 -05:00