Request: colors in :digraphs

10 views
Skip to first unread message

Adrien "Axioplase" Piérard

unread,
Jan 7, 2011, 2:54:11 AM1/7/11
to vim...@vim.org
Hello,

I happen to use :digraphs quite a lot to insert mathematical symbols
in documents.
However, finding the characters and their input sequence is *very*
straining for the eyes.

I wonder whether each of the three columns output by :dig could be
coloured to help reading?
Also, it may help *a lot* too to colour blocks of consecutive related
digraphs in similar colours, such as "all maths symbols", "all
Japanese symbols", "all Greek letters" and so on.


Cheers,

--
Français, English, 日本語, 한국어

Nikolai Weibull

unread,
Jan 7, 2011, 3:05:10 AM1/7/11
to vim...@googlegroups.com, vim...@vim.org
2011/1/7 Adrien "Axioplase" Piérard <axioplas...@gmail.com>:

> Also, it may help *a lot* too to colour blocks of consecutive related
> digraphs in similar colours, such as "all maths symbols", "all
> Japanese symbols", "all Greek letters" and so on.

Wouldn’t it be better to use proper headers for each group?

Color is seldom the answer.

Charles Campbell

unread,
Jan 7, 2011, 10:24:55 AM1/7/11
to vim...@googlegroups.com
Adrien "Axioplase" Piérard wrote:
> Hello,
>
> I happen to use :digraphs quite a lot to insert mathematical symbols
> in documents.
> However, finding the characters and their input sequence is *very*
> straining for the eyes.
>
Perhaps you'd find the math plugin helpful...

The math plugin makes entry of many math symbols simple via a keymap and
via a
menu. You may get the plugin by using either of the following two urls:

http://vim.sourceforge.net/scripts/script.php?script_id=2723 (stable)
http://mysite.verizon.net/astronaut/vim/index.html#MATH
(cutting edge)

It supports easy entry of upper and lower case Greek symbols, as many
superscripts and subscripts as utf-8 supports, fractions, arrows, grouping
symbols, operators, relational symbols, set support, and box characters.

Regards,
Chip Campbell

David J. Hamilton

unread,
Jan 7, 2011, 2:25:02 PM1/7/11
to vim-dev
Exceprts from Adrien "Axioplase" Piérard's message

> I happen to use :digraphs quite a lot to insert mathematical symbols
> in documents.
> However, finding the characters and their input sequence is *very*
> straining for the eyes.

You might find rfc1345[1] a more useful reference than :digraph for the digraphs
you haven't memorized yet. Apart from anything else, if you have it open in a
buffer you can at least grep if you can make a good guess for the name of the
digraph you're looking for (e.g. UNION).

Excerpts from Nikolai Weibull's message of Fri Jan 07 00:05:10 -0800 2011:

I have to strongly disagree. It may also help to have proper headers, but
I find colour to be an excellent way to distinguish groups in text, and
generally prefer it precisely because it doesn't require clutter (i.e. extra
characters). I think for the output of :digraph in particular, it would be far
more readable for symbols to be grouped, and for groups to be distinguished by
colour.

[1] http://www.faqs.org/rfcs/rfc1345.html
--
med vänlig hälsning
David J. Hamilton

Nikolai Weibull

unread,
Jan 7, 2011, 7:16:10 PM1/7/11
to vim...@googlegroups.com, vim-dev
On Fri, Jan 7, 2011 at 20:25, David J. Hamilton <gro...@hjdivad.com> wrote:

> Excerpts from Nikolai Weibull's message of Fri Jan 07 00:05:10 -0800 2011:

>> Color is seldom the answer.

> I have to strongly disagree.

Right back at you.

Either way, the proper solution is the one I mentioned, by header,
where :digraph takes an optional list of groups to display. Too bad
:digraphs is also used to add digraphs.

David J. Hamilton

unread,
Jan 7, 2011, 10:07:09 PM1/7/11
to vim_dev
Excerpts from Nikolai Weibull's message of Fri Jan 07 16:16:10 -0800 2011:

> >> Color is seldom the answer.
>
> > I have to strongly disagree.
>
> Right back at you.

Fair enough (^^).

> Either way, the proper solution is the one I mentioned, by header,
> where :digraph takes an optional list of groups to display. Too bad
> :digraphs is also used to add digraphs.

In any case, distinguishing groups with headers and distinguishing by colour
are not mutually exclusive. My point was not so much that using colour is
better than using headers, but rather in response to:

Excerpts from Nikolai Weibull's message

> Wouldn’t it be better to use proper headers for each group?

That for some people, no, it would not be better to use headers in lieu of
distinguishing by colour, but rather the other way around.

Dominique Pellé

unread,
Jan 8, 2011, 4:36:31 AM1/8/11
to vim...@googlegroups.com
Adrien "Axioplase" Piérard wrote:

When looking at the output of :digraph, the "more prompt pager"
allows pressing keys to move up or down:

-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit

How about being able to press / or ? to search forward or
backward in the output of :digraph? (or in the output of any
other command that uses the "more prompt pager").

-- Dominique

Lech Lorens

unread,
Jan 9, 2011, 12:41:36 PM1/9/11
to Dominique Pellé, vim...@googlegroups.com

The idea (performing a search) was discussed about 2 years ago (the
following message started the thread:
a4875c0e0902210755v107...@mail.gmail.com ).
In this specific case I don't believe such a solution would be very
useful: you refer to the output of :dig to find out how to type
a symbol. How can you search for a symbol if you don't know how to input
it?

--
Cheers,
Lech

Dominique Pellé

unread,
Jan 9, 2011, 1:56:32 PM1/9/11
to Dominique Pellé, vim...@googlegroups.com
Lech Lorens wrote:

> On 08-Jan-2011 Dominique Pellé <dominiq...@gmail.com> wrote:
>> Adrien "Axioplase" Piérard wrote:
>>
>> > Hello,
>> >
>> > I happen to use :digraphs quite a lot to insert mathematical symbols
>> > in documents.
>> > However, finding the characters and their input sequence is *very*
>> > straining for the eyes.
>> >
>> > I wonder whether each of the three columns output by :dig could be
>> > coloured to help reading?
>> > Also, it may help *a lot* too to colour blocks of consecutive related
>> > digraphs in similar colours, such as "all maths symbols", "all
>> > Japanese symbols", "all Greek letters" and so on.
>>
>> When looking at the output of  :digraph, the "more prompt pager"
>> allows pressing keys to move up or down:
>>
>> -- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
>>
>> How about being able to press  /  or  ?  to search forward or
>> backward in the output of  :digraph? (or in the output of any
>> other command that uses the "more prompt pager").
>>
>> -- Dominique
>
> The idea (performing a search) was discussed about 2 years ago (the
> following message started the thread:
> a4875c0e0902210755v107...@mail.gmail.com ).

Hi Lech

I did not find the discussion from 2 years ago.
What's the date?

> In this specific case I don't believe such a solution would be very
> useful: you refer to the output of :dig to find out how to type
> a symbol. How can you search for a symbol if you don't know how to input
> it?

Many digraphs are chosen in a logical way. Sometimes
it's enough to correctly guess what the digraph is, but not
always. When you can't completely guess, you can
sometimes make a correct partial guess and being able
to search then helps.

2 examples:

- I want to type the the angstrom symbol. I guess that the
digraph contains the letter 'a'. Searching with /a narrows
down the search. The digraph for the lowercase angstrom
symbol is 'aa' so my partial guess was right. But I would
not have guessed the full digraph. Finding it in the output
of :digraph without being able to search was not simple.
I ended up doing a :redir of :digraph to be able to... search.

- I want to type a Greek pi letter (3.14...). Same story:
I guess that the digraph contains p and I search for /p.
I end up finding it: p*. My partial guess was correct and
helped.

Another use case is to search by copy/pasting the Unicode
symbol from somewhere. If I search for angstrom on
Wikipedia, I find its Unicode symbol. But of course
I don't want to do that all the time to enter that symbol.
If I can search for the Unicode symbol in the output
of :digraph, I can then use the more convenient
digraph aa next time I need to type the character.

Cheers
-- Dominique

Lech Lorens

unread,
Jan 9, 2011, 3:11:44 PM1/9/11
to Dominique Pellé, vim...@googlegroups.com

Feb 21, 2009.
Have you tried the message ID on the Google groups? Seems to work fine
for me. Anyway, here's the whole thread:
http://groups.google.com/group/vim_dev/browse_thread/thread/b5c08b079e0c06e6/3a6c31d30413a1b6?q=#3a6c31d30413a1b6

> > In this specific case I don't believe such a solution would be very
> > useful: you refer to the output of :dig to find out how to type
> > a symbol. How can you search for a symbol if you don't know how to input
> > it?
>
> Many digraphs are chosen in a logical way. Sometimes
> it's enough to correctly guess what the digraph is, but not
> always. When you can't completely guess, you can
> sometimes make a correct partial guess and being able
> to search then helps.
>
> 2 examples:

Agreed!

--
Cheers,
Lech

Christian Brabandt

unread,
Jan 10, 2011, 2:27:13 AM1/10/11
to vim...@googlegroups.com
Hi Dominique!

On So, 09 Jan 2011, Dominique Pell� wrote:

> Many digraphs are chosen in a logical way. Sometimes
> it's enough to correctly guess what the digraph is, but not
> always. When you can't completely guess, you can
> sometimes make a correct partial guess and being able
> to search then helps.

I agree, searching would help. In your case, my plugin unicode.vim
http://www.vim.org/scripts/script.php?script_id=2822 could also help:

>
> 2 examples:
>
> - I want to type the the angstrom symbol. I guess that the
> digraph contains the letter 'a'. Searching with /a narrows
> down the search. The digraph for the lowercase angstrom
> symbol is 'aa' so my partial guess was right. But I would
> not have guessed the full digraph. Finding it in the output
> of :digraph without being able to search was not simple.
> I ended up doing a :redir of :digraph to be able to... search.

type a and press <C-X><C-G>. In the omni completion list select the
glyph. Alternatively, set
:let g:showDigraphCode=1
and either enter the unicode codepoint or type the name and press
<C-X><C-U>

In the preview window, you'll see the glyph and additionally the digraph
char, that can be used to enter that glyph if one exists.

>
> - I want to type a Greek pi letter (3.14...). Same story:
> I guess that the digraph contains p and I search for /p.
> I end up finding it: p*. My partial guess was correct and
> helped.

Again, p<C-X><C-G> would have shown you all digraphs, that can be
entered with p

> Another use case is to search by copy/pasting the Unicode
> symbol from somewhere. If I search for angstrom on
> Wikipedia, I find its Unicode symbol. But of course
> I don't want to do that all the time to enter that symbol.
> If I can search for the Unicode symbol in the output
> of :digraph, I can then use the more convenient
> digraph aa next time I need to type the character.

Use the unicode completion of the plugin, together with the codepoint or
the name.

regards,
Christian

Bram Moolenaar

unread,
Jan 10, 2011, 10:35:52 AM1/10/11
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

> Hi Dominique!

Searching can be useful. Can someone make a patch to continue the table
at ":help digraph-table" for characters beyond 0xff?

--
Momento mori, ergo carpe diem

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jan 10, 2011, 5:05:11 PM1/10/11
to vim...@googlegroups.com
Hi Bram!

On Mo, 10 Jan 2011, Bram Moolenaar wrote:

> Searching can be useful. Can someone make a patch to continue the table
> at ":help digraph-table" for characters beyond 0xff?

Attached. Note, I replaced the actual glyphs for some hebrew and arabic
glyphs by '?'. Otherwise those lines would have been turned 'rl' and
this is really confusing when navigating (and looks ugly).

Mit freundlichen Gr��en
Christian

update_digraph_table.patch

Christian Brabandt

unread,
Jan 12, 2011, 4:09:06 PM1/12/11
to vim...@googlegroups.com
On Mo, 10 Jan 2011, Christian Brabandt wrote:
> +… .3 2026 8230 HORIZONTAL ELLIPSIS

This one is wrong. This happened, because I forgot, that I defined this
digraph here locally and have overwritten the original digraph which is:

⋯ .3 22EF 8943 MIDLINE HORIZONTAL ELLIPSIS

Sorry,
Christian

Bram Moolenaar

unread,
Jan 15, 2011, 3:14:41 PM1/15/11
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

Thanks. I don't see a problem with those hebrew and arabic glyphs.

I had some problem with the patch (file was in latin1 originally), so I
just copied the new lines. Also included the fix you sent later.

I'll send it out with the next runtime files update and await further
updates.

--
hundred-and-one symptoms of being an internet addict:
101. U can read htis w/o ny porblm and cant figur eout Y its evn listd.

Reply all
Reply to author
Forward
0 new messages