Re: Usage of | character in digraphs

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

Manas Gupta

Hi folks, I want to setup a few more digraphs according to my need. But while defining those I am running into error.

For example, I want to add ℕ (symbol for natural numbers set) as N| (N followed by the pipe character) but when defining the digraph as

: digraphs N| 8469

it is throwing E474.

Can I not use the pipe character while defining digraphs?

--
Manas
CSAM Undergraduate 2022

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/a5da4ab9-c3a3-94bd-0fc5-c701e230fa9d%40iiitd.ac.in.
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

trialero
On Wed, May 27, 2020 at 09:31:29PM +0530, Manas wrote:

>    Hi folks, I want to setup a few more digraphs according to my need. But
>    while defining those I am running into error.
>
>    For example, I want to add (symbol for natural numbers set) as N| (N
>    followed by the pipe character) but when defining the digraph as
>
>    : digraphs N| 8469
>
>    it is throwing E474.
>
>    Can I not use the pipe character while defining digraphs?

maybe this page is of help, it uses a different digraph:

https://mullikine.github.io/posts/adding-new-digraphs-to-vim-and-evil/

however, it doesn't answer your question whether a pipe character is
allowed in defining a digraph...

//meine

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200527162759.GC1915%40trackstand.
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

Eli the Bearded
In reply to this post by Manas Gupta
Manas <[hidden email]> wrote:
> For example, I want to add ℕ (symbol for natural numbers set) as N| (N
> : digraphs N| 8469
> it is throwing E474.

The | character separates commands in ex-mode. You can use it in your
digraph, but you need to backslash escape it:

  : digraphs N\| 8469

The ex-mode | thing dates back to pre-vim days of real ex and vi. It's not
used often, and easy to overlook / forget.

Elijah

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/49XGgm6btVzfYm%40panix5.panix.com.
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

Manas Gupta
In reply to this post by trialero

maybe this page is of help, it uses a different digraph:

https://mullikine.github.io/posts/adding-new-digraphs-to-vim-and-evil/

I did look up this page but I wanted to use pipe character because when I actually write ℕ symbol on paper, I write N first then the horizontal line on it. By using pipe, I would remember easily what the digraph is.

--
Manas
CSAM Undergraduate 2022

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d3e598c3-811a-ca7a-7559-920d4484b826%40iiitd.ac.in.
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

Manas Gupta
In reply to this post by Eli the Bearded
The | character separates commands in ex-mode. You can use it in your
digraph, but you need to backslash escape it:

  : digraphs N\| 8469

The ex-mode | thing dates back to pre-vim days of real ex and vi. It's not
used often, and easy to overlook / forget.
Thanks a lot. That worked.
--
Manas
CSAM Undergraduate 2022

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/c6a58231-e2c0-9c3c-2b25-c4b5b2846e70%40iiitd.ac.in.
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

Tony Mechelynck
In reply to this post by Eli the Bearded
On Wed, May 27, 2020 at 6:36 PM Eli the Bearded <[hidden email]> wrote:

>
> Manas <[hidden email]> wrote:
> > For example, I want to add ℕ (symbol for natural numbers set) as N| (N
> > : digraphs N| 8469
> > it is throwing E474.
>
> The | character separates commands in ex-mode. You can use it in your
> digraph, but you need to backslash escape it:
>
>   : digraphs N\| 8469

Indeed, I tried to see if I could (just as a test) define || as a
digraph for | and it took me several trials. With
    :dig || char2nr('|')
I got the same answer as with :dig with no argument (a list of
existing digraphs). Then
    :dig \|\| char2nr('|')
gave me E39: Number expected. Finally
    :dig \|\| 124
gave me the expected digraph (and a subsequent :dig with no argument
listed it at the very end).
>
> The ex-mode | thing dates back to pre-vim days of real ex and vi. It's not
> used often, and easy to overlook / forget.

I use it quite often, for instance to define an autocommand with a few
commands to be done in succession, or for an if..endif clause as {rhs}
to a mapping.

The fact that :digraph is not listed at    :help :|   implies that to
include a | in the operands of a :digraph command it must be
backslash-escaped.
>
> Elijah

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXt0Dm2NHDVmjL3hLfB9iVDeOtugvqLS6%3D3aA7oHDCxRhA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Usage of | character in digraphs

Tony Mechelynck
In reply to this post by Manas Gupta
On Wed, May 27, 2020 at 6:41 PM Manas <[hidden email]> wrote:

>
>
> maybe this page is of help, it uses a different digraph:
>
> https://mullikine.github.io/posts/adding-new-digraphs-to-vim-and-evil/
>
> I did look up this page but I wanted to use pipe character because when I actually write ℕ symbol on paper, I write N first then the horizontal line on it. By using pipe, I would remember easily what the digraph is.
>
> --
> Manas
> CSAM Undergraduate 2022

Instead of the external "unicode" program mentioned there, you could
also use the unicode.vim plugin by Christian Brabandt, available at
vim.org. After installing it,
    :echo unicode#FindUnicodeBy('DOUBLE-STRUCK CAPITAL')
would give you a List of Dictionaries, one Dictionary for each letter
whose Unicode name contained that string, with all known properties of
that letter, including full Unicode name, hex and decimal codepoint,
digraph(s) if any, HTML entity/ies, and glyph. Of course, if you
wanted only the double-struck N, then
unicode#FindUnicodeBy('DOUBLE-STRUCK CAPITAL N') would give you just
that.

I use that plugin almost exclusively for its :UnicodeName command
(which gives the same information in a more user-friendly format for
the character under the cursor) but I know that it has other commands
and functions, and its help is in the outstanding Vim tradition.

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXucrGL4XMo_uS8%3DGQmZustoSefWAK1GXG1gEMa7N3XYhw%40mail.gmail.com.