Keymap problem, toggle back to default keymap doesn't work for /search

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

Keymap problem, toggle back to default keymap doesn't work for /search

krbeesley

Subject:  Keymap problem, toggle back to default keymap doesn't work
for /search


Background:
    Using MacVim snapshot 0711A on OS X 10.5 ("Leopard")
    Using my own keymap files to type in Unicode (supplementary
characters)

Good News:
In general, the new MacVim is working marvelously well, allowing me to
:set keymap=myownkeymap
and type in exotic supplementary Unicode characters the way I want
to.  Thanks again to all
who contributed to this new MacVim version.  Because of this
functionality, I have finally
become a Vim convert (from emacs).

Bad News:
But I've got a little problem toggling out of my keymap.  The
following is reproduceable:

    1.  I launch MacVim and type a bit of English (ASCII range).  OK
     2.  I do    :set keymap=myownkeymap
          and type in exotic supplementary characters (currently
Deseret Alphabet).  OK
          (I had to modify a mono font to include the desired Deseret
Alphabet glyphs.)
     3.  I then do Ctrl-^ to toggle back to the default keymap.  I
type some English (ASCII range).  OK
    4.  Then I type Esc (going into command-mode) and start a search
using the slash operator
          /whatever

Problem:  After the slash operator, the "whatever" comes out in
Deseret Alphabet, as if "myownkeymap"
were still active.

Looks like a bug to me, but correct me as necessary.

Thanks,

Ken


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Keymap problem, toggle back to default keymap doesn't work for /search

Tony Mechelynck

Ken Beesley wrote:

> Subject:  Keymap problem, toggle back to default keymap doesn't work
> for /search
>
>
> Background:
>     Using MacVim snapshot 0711A on OS X 10.5 ("Leopard")
>     Using my own keymap files to type in Unicode (supplementary
> characters)
>
> Good News:
> In general, the new MacVim is working marvelously well, allowing me to
> :set keymap=myownkeymap
> and type in exotic supplementary Unicode characters the way I want
> to.  Thanks again to all
> who contributed to this new MacVim version.  Because of this
> functionality, I have finally
> become a Vim convert (from emacs).
>
> Bad News:
> But I've got a little problem toggling out of my keymap.  The
> following is reproduceable:
>
>     1.  I launch MacVim and type a bit of English (ASCII range).  OK
>      2.  I do    :set keymap=myownkeymap
>           and type in exotic supplementary characters (currently
> Deseret Alphabet).  OK
>           (I had to modify a mono font to include the desired Deseret
> Alphabet glyphs.)
>      3.  I then do Ctrl-^ to toggle back to the default keymap.  I
> type some English (ASCII range).  OK
>     4.  Then I type Esc (going into command-mode) and start a search
> using the slash operator
>           /whatever
>
> Problem:  After the slash operator, the "whatever" comes out in
> Deseret Alphabet, as if "myownkeymap"
> were still active.
>
> Looks like a bug to me, but correct me as necessary.
>
> Thanks,
>
> Ken

1) Does your status line show the current keymap when active? I think it ought
to, but if it doesn't, you may want to add a custom status line with %k in it.
Mine is

if has("statusline")
        set statusline=%<%f\ %h%m%r%=%k[%{(&fenc\ ==\
\"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\ %-12.(%l,%c%V%)\ %P
endif

(in case your mailer or mine added a spurious line break, this is 3 lines: if,
set, endif)

2) Setting the lCursor highlight in your homemade keymap (before the
"loadkeymap" line) may help you see when keymaps are active (by default, the
cursor uses the Cursor highlights when keymaps aren't active, lCursor when
they are).

3) If keymaps are active in Normal mode, you can toggle them by means of the
'iminsert' option (which is a Number, not a Boolean option):

        :nmap <F8> :let &imi = ! &imi<CR>
        :map! <F8> <C-^>

(I originally set up the above mappings for my own use because I don't know
if, and by which key, my Belgian keyboard can produce a Ctrl-^ keycode. I
added the nmap because of the argument of Normal-mode r etc.)


Best regards,
Tony.
--
The Soviet pre-eminence in chess can be traced to the average Russian's
readiness to brood obsessively over anything, even the arrangement of
some pieces of wood.  Indeed, the Russians' predisposition for quiet
reflection followed by sudden preventive action explains why they led
the field for many years in both chess and ax murders.  It is well
known that as early as 1970, the U.S.S.R., aware of what a defeat at
Reykjavik would do to national prestige, implemented a vigorous program
of preparation and incentive.  Every day for an entire year, a team of
psychologists, chess analysts and coaches met with the top three
Russian grand masters and threatened them with a pointy stick.  That
these tactics proved fruitless is now a part of chess history and a
further testament to the American way, which provides that if you want
something badly enough, you can always go to Iceland and get it from
the Russians.
                -- Marshall Brickman, Playboy, April, 1973


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Keymap problem, toggle back to default keymap doesn't work for /search

krbeesley


Tony,

Yes, when I do

:set keymap=myownkeymap

the name of the new keymap is displayed in the statusline.  And this  
custom keymap works
exactly as expected while its name is displayed, mapping my keystrokes  
into
strange Deseret Alphabet characters whose glyphs appear perfectly on the
screen.  (Nice.)  When I then invoke Ctrl-^, the name
of the custom keymap disappears (leaving me back with the default  
keymap) and
when I insert text, the usual Roman letters appear.   Just as expected.

I naturally expected that the current keymap, when I escaped to Normal  
mode,
would be the current keymap when typing a /search string.  It wasn't.

But when I looked into 'iminsert', as you suggested, I see that there  
is also
'imsearch', which "Specifies whether :lmap or an IM is to be used when
entering a search pattern".  The legal values of imsearch are

-1   :  the value of iminsert is used
0:  :lmap is off and IM is off
1:  :lmap is ON and IM is off
2:  :lmap is off and IM is ON

I'm not exactly sure what "lmap" and "IM" mean in this context, I  
suspect that for the
behavior that I expected one should simply set imsearch to -1.  Maybe

:set imsearch=-1

<hack>...</hack>

I tried it, and now when I escape to Normal mode, the current INSERT  
keymap is
also used in Normal mode /searches (unless you explicitly do a Ctrl-^  
to change
it).  THAT's the behavior that I expected.

Thanks,

Ken



On 12 Dec 2007, at 18:09, Tony Mechelynck wrote:

>
> Ken Beesley wrote:
>> Subject:  Keymap problem, toggle back to default keymap doesn't work
>> for /search
>>
>>
>> Background:
>>    Using MacVim snapshot 0711A on OS X 10.5 ("Leopard")
>>    Using my own keymap files to type in Unicode (supplementary
>> characters)
>>
>> Good News:
>> In general, the new MacVim is working marvelously well, allowing me  
>> to
>> :set keymap=myownkeymap
>> and type in exotic supplementary Unicode characters the way I want
>> to.  Thanks again to all
>> who contributed to this new MacVim version.  Because of this
>> functionality, I have finally
>> become a Vim convert (from emacs).
>>
>> Bad News:
>> But I've got a little problem toggling out of my keymap.  The
>> following is reproduceable:
>>
>>    1.  I launch MacVim and type a bit of English (ASCII range).  OK
>>     2.  I do    :set keymap=myownkeymap
>>          and type in exotic supplementary characters (currently
>> Deseret Alphabet).  OK
>>          (I had to modify a mono font to include the desired Deseret
>> Alphabet glyphs.)
>>     3.  I then do Ctrl-^ to toggle back to the default keymap.  I
>> type some English (ASCII range).  OK
>>    4.  Then I type Esc (going into command-mode) and start a search
>> using the slash operator
>>          /whatever
>>
>> Problem:  After the slash operator, the "whatever" comes out in
>> Deseret Alphabet, as if "myownkeymap"
>> were still active.
>>
>> Looks like a bug to me, but correct me as necessary.
>>
>> Thanks,
>>
>> Ken
>
> 1) Does your status line show the current keymap when active? I  
> think it ought
> to, but if it doesn't, you may want to add a custom status line with  
> %k in it.
> Mine is
>
> if has("statusline")
> set statusline=%<%f\ %h%m%r%=%k[%{(&fenc\ ==\
> \"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\ %-12.(%l,%c%V%)\ %P
> endif
>
> (in case your mailer or mine added a spurious line break, this is 3  
> lines: if,
> set, endif)
>
> 2) Setting the lCursor highlight in your homemade keymap (before the
> "loadkeymap" line) may help you see when keymaps are active (by  
> default, the
> cursor uses the Cursor highlights when keymaps aren't active,  
> lCursor when
> they are).
>
> 3) If keymaps are active in Normal mode, you can toggle them by  
> means of the
> 'iminsert' option (which is a Number, not a Boolean option):
>
> :nmap <F8> :let &imi = ! &imi<CR>
> :map! <F8> <C-^>
>
> (I originally set up the above mappings for my own use because I  
> don't know
> if, and by which key, my Belgian keyboard can produce a Ctrl-^  
> keycode. I
> added the nmap because of the argument of Normal-mode r etc.)
>
>
> Best regards,
> Tony.
> --
> The Soviet pre-eminence in chess can be traced to the average  
> Russian's
> readiness to brood obsessively over anything, even the arrangement of
> some pieces of wood.  Indeed, the Russians' predisposition for quiet
> reflection followed by sudden preventive action explains why they led
> the field for many years in both chess and ax murders.  It is well
> known that as early as 1970, the U.S.S.R., aware of what a defeat at
> Reykjavik would do to national prestige, implemented a vigorous  
> program
> of preparation and incentive.  Every day for an entire year, a team of
> psychologists, chess analysts and coaches met with the top three
> Russian grand masters and threatened them with a pointy stick.  That
> these tactics proved fruitless is now a part of chess history and a
> further testament to the American way, which provides that if you want
> something badly enough, you can always go to Iceland and get it from
> the Russians.
> -- Marshall Brickman, Playboy, April, 1973
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Keymap problem, toggle back to default keymap doesn't work for /search

Tony Mechelynck

Kenneth Reid Beesley wrote:
[...]

> But when I looked into 'iminsert', as you suggested, I see that there  
> is also
> 'imsearch', which "Specifies whether :lmap or an IM is to be used when
> entering a search pattern".  The legal values of imsearch are
>
> -1   :  the value of iminsert is used
> 0:  :lmap is off and IM is off
> 1:  :lmap is ON and IM is off
> 2:  :lmap is off and IM is ON
>
> I'm not exactly sure what "lmap" and "IM" mean in this context, I  
[...]

lmap = the :lmap command = language mappings (including keymaps).

IM = Input Method = special dialogs used to input (mostly) East-Asian
languages. For details, see ":help mbyte-XIM" (Unix) or ":help mbyte-IME"
(Windows).


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
167. You have more than 100 websites in your Bookmark.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---