Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colourful :digraphs output #3572

Closed
wants to merge 1 commit into from
Closed

Colourful :digraphs output #3572

wants to merge 1 commit into from

Conversation

coot
Copy link
Contributor

@coot coot commented Oct 28, 2018

This is a tiny patch, that makes the output of :digraph command more readable by colouring the :digraphs output using the WarningMsg highlight group.

@codecov-io
Copy link

Codecov Report

Merging #3572 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3572      +/-   ##
==========================================
- Coverage   77.33%   77.32%   -0.02%     
==========================================
  Files          99       99              
  Lines      139172   139178       +6     
==========================================
- Hits       107634   107621      -13     
- Misses      31538    31557      +19
Impacted Files Coverage Δ
src/digraph.c 92.96% <100%> (+0.16%) ⬆️
src/if_xcmdsrv.c 83.81% <0%> (-0.54%) ⬇️
src/gui.c 57.08% <0%> (-0.42%) ⬇️
src/gui_gtk_x11.c 48.01% <0%> (-0.25%) ⬇️
src/message.c 75.48% <0%> (-0.1%) ⬇️
src/ex_cmds.c 79.89% <0%> (-0.09%) ⬇️
src/screen.c 79.17% <0%> (-0.07%) ⬇️
src/eval.c 83.88% <0%> (-0.05%) ⬇️
src/syntax.c 78.42% <0%> (-0.03%) ⬇️
src/channel.c 83.26% <0%> (+0.03%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d474686...3b2a856. Read the comment docs.

@brammool
Copy link
Contributor

brammool commented Oct 28, 2018 via email

@coot
Copy link
Contributor Author

coot commented Oct 28, 2018 via email

@coot
Copy link
Contributor Author

coot commented Oct 28, 2018 via email

@coot
Copy link
Contributor Author

coot commented Oct 28, 2018

@brammool I pushed a proof of concept, let me know what do you think.

@brammool
Copy link
Contributor

brammool commented Oct 28, 2018 via email

@coot
Copy link
Contributor Author

coot commented Oct 28, 2018

Having a dedicated highlight group will solve any contrast problems, more easily than using LineNr and CursorLineNr.

The boundaries were a bit arbitrary (proof of concept), and I agree that using headers would be a better option.

@coot
Copy link
Contributor Author

coot commented Oct 28, 2018

I've been using the original patch for a long time, and this is how it looks when the contrast is set right (though this is a personal thing)
screenshot from 2018-10-28 19-31-04

@brammool
Copy link
Contributor

brammool commented Oct 28, 2018 via email

@chrisbra
Copy link
Member

Are groups really that useful?

(I also fear, that would break my unicode plugin).

@tonymec
Copy link

tonymec commented Oct 29, 2018

I'd rather not see Christian's Unicode plugin get broken (I use it a lot); but the Unicode Consortium already uses standardized names, such as:

  • C0 controls (U+0000 - U+001F)
  • Basic Latin (ASCII) (U+0020 - U+007F)
  • C1 controls (U+0080 - U+009F)
  • Latin-1 supplement (U+00A0 - U+00FF)
  • Latin Extended-A (U+0100 - U+017F)
  • Latin Extended-B (U+0180 - U+024F)
  • IPA Extensions (U+0250 - U+02AF)
    etc.

When letters of a single script appear in more than one range, the subranges are given distinct names (as for Latin in 4 of the above 7 examples), and I think this matters less for Vim (which can show all the digraphs in answer to one command) than for the Unicode.org PDF charts themselves, where I sometimes have to try a handful of separate charts with "likely" names before I find out the exact Unicode codepoint number for the exotic character I want to type.

Best regards,
Tony.

@brammool
Copy link
Contributor

brammool commented Oct 29, 2018 via email

@tonymec
Copy link

tonymec commented Oct 29, 2018

Not sure how your unicode plugin depends on the :digraph output?

Several of its functionalities are about digraph values, I suppose the plugin gets them from the :digraph command:

                                                              *unicode-plugin*
1. Functionality

The plugins main purpose is to make handling unicode data and digraphs more
easily. It serves 3 main purposes:

    1) Complete Characters
       This plugin provides a custom completion function to complete unicode
       characters using their name or Codepoint value. If a digraph exists for
       that character, it will be displayed in parentheses. This is (by
       default) activated by pressing Ctrl-X Ctrl-Z (|i_CTRL-X_CTRL-Z|) in
       insert mode.

       Additionally it provides a completion function for digraphs. This is
       (by default) activated by pressing Ctrl-X Ctrl-G (|i_CTRL-X_CTRL-G|) in
       insert mode.

    2) Identify Characters
       This plugin provides the |:UnicodeName| function to identify the
       character under the cursor similar to the builtin command |ga|. The
       |:UnicodeSearch| command can be used to search for a unicode character
       with a given name or value.

    3) Ease the use of digraphs
       Use the |:Digraphs| command to search for a digraph with a given name
       or value (or simply display all available digraphs similar to how the
       |:digraph| command works. By default it also maps the <F4> key (in
       |Operator-pending-mode| and |Visual| mode) to transform 2 given
       characters into their corresponding digraph value.

Digraphs are mentioned under 1 and 3, but all digraphs (if any) for the current character are also listed by the :UnicodeName command mentioned in 2.

Best regards,
Tony.

@chrisbra
Copy link
Member

Not sure how your unicode plugin depends on the :digraph output?

There is no other way to get all digraphs than to parse the :digraph output. Adding section headers will break the current approach, however, I can fix this, so this is only a minor issue. I just need to be aware of it...
Speaking of #3573, that would be a good enhancement.

@brammool brammool closed this in eae8ae1 Dec 14, 2018
janlazo added a commit to janlazo/neovim that referenced this pull request Oct 6, 2019
Problem:    :digraph output is not easy to read.
Solution:   Add highlighting for :digraphs. (Marcin Szamotulski, closes vim/vim#3572)
            Also add section headers for :digraphs!.
vim/vim@eae8ae1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants