Tuesday, September 21, 2010

Re: to or till (f or t) a non-ascii character

On Wed, September 22, 2010 5:31 am, Benjamin R. Haskell wrote:
> On Wed, 22 Sep 2010, Ramana Kumar wrote:
>
>> I have set up some abbreviations to turn certain ASCII strings into
>> appropriate Unicode counterparts, for example from '==>' to '=>'. This
>> works wonderfully.
>
> From equals, equals, greater-than, to equals, greater-than? Must be
> something about the web interface.
>
>
>> One problem, however, is when I now have a Unicode character sitting
>> in my buffer, I can't jump to it easily using the insert-mode 't' and
>> 'f' commands. Is there any way I could do this? The best for me would
>> be if I could do a 't=' and have it count occurrences of '=>' among
>> the things to jump to, since I originally typed '=' to get that
>> character.
>
> Personally, I find external-to-Vim methods for entering Unicode
> characters to be much better. For example, in order to get what I think
> your arrow is (=>) in all X11 programs (including Vim under a terminal
> emulator and Gvim), by typing <Compose> + <equal> + <equal> +
> <greater-than> (where <Compose> = <CapsLock>), I can add this line to
> ~/.XCompose:
>
> <equal> <equal> <greater> : =>

I thought, I would mention digraphs, because they could be useful here.

That means typing <Ctrl-K> '=' '>' should give you the same character. (I
don't see it here, as my font, does not seem to provide a glyph here).
It is also worth at least considering to set the 'digraph' option. If it
is set, you type the first key, backspace and the second key and it will
result in your digraph. (e.g. pressing 'a', <BS>, ':' results in ä)

> Granted, it's less portable (in terms of non-X11 environments), and can
> be a pain to set up initially, but it's worth the effort if you find
> yourself using non-keyboard characters frequently.

I never got around to use the compose key much, because I never found a
good overview, which mappings result in which glyphs. But then, I only
need those multibyte chars very seldom (except for äöüß, which are on my
keyboard anyway).

>> A related but different issue is getting those characters into the
>> command line buffer, for example if I want to search for a a string
>> containing Unicode characters. My abbreviations won't work in that
>> buffer... is there a way to get them to work?
>
> If you use :abbrev, rather than :iabbrev, they'll work in command-line
> mode, too. (Doesn't help for 't'/'f')

The f and t commands work when using digraphs. I.e. if you want to
jump to the ä, you press f <Ctrl-K> a : and f jumps to the ä
(but don't work when 'digraph' is set and you want to enter them using
the backspace key).

Oh, and then there is this plugin, I wrote long ago. It provides digraph
and Unicode completion. http://www.vim.org/scripts/script.php?script_id=2822
(don't know if it useful, but I thought, I'd mention it anyway).

> You might try 'q:'. For the longest time, I found it incredibly
> annoying when I would mistype my preferred 'quit' mechanism and end up
> in this bizarre 'Ex' mode.

I still feel that way. I never found it of any personal use for me. I
even mapped it away.

regards,
Christian

--
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

No comments: