Bug: :lmap can't remap to :lnoremap?

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

Bug: :lmap can't remap to :lnoremap?

tyru-2
1. :source below code
2. Enter insert mode
3. Press <C-^>
4. Type "bar"
5. Vim outputs "noremap!", not "lnoremap"

--- code ---
" :lmap can't remap?
"
" Typing "bar" outputs "noremap!", not "lnoremap".

lnoremap foo <Esc>:<C-u>echomsg 'lnoremap'<CR>
noremap! foo <Esc>:<C-u>echomsg 'noremap!'<CR>

lmap bar foo
--- code ---


And this is another problem though,
    set wildchar=<Tab>
    set wildmode
and
    lmap <Tab>
in command-line does not complete any mapping as :map does.


My Vim :version is:

VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 25 2010 13:38:45)
Included patches: 1-411
Modified by Vim extended
Compiled by tyru@tyru-linux
Huge version with GTK2 GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset
+cindent +clientserver +clipboard +cmdline_compl +cmdline_hist
+cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui
+diff
+digraphs +dnd -ebcdic -ecl +emacs_tags +eval +ex_extra +extra_search
+farsi +file_in_path +find_in_path +float +folding -footer +fork()
+gettext -hangul_input +iconv +insert_expand +jumplist +keymap
+langmap +libcall +linebreak +lispindent +listcmds +localmap -lua
+menu +mksession +modify_fname +mouse +mouseshape +mouse_dec
+mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm
+multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra +perl +persistent_undo +postscript +printer +profile
+python +quickfix +reltime +rightleft +ruby +scrollbind +signs
+smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title +toolbar +user_commands +vartabs +vertsplit
+virtualedit
+visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows
+writebackup +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -
xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/home/tyru/local/vim/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -
D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/
include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/
include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/
usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/
include     -g -O2 -D_FORTIFY_SOURCE=1     -D_REENTRANT -D_GNU_SOURCE -
DDEBIAN  -I/usr/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64  -I/usr/lib/perl/5.10/CORE   -I/usr/include/
python2.6 -pthread  -I/usr/lib/ruby/1.8/i486-linux -DRUBY_VERSION=18
Linking: gcc   -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-
dynamic  -Wl,-E   -L/usr/local/lib -o vim   -lgtk-x11-2.0 -lgdk-
x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -
lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -
lgmodule-2.0 -lglib-2.0   -lXt -lncurses -lselinux  -lacl -lgpm    -
Wl,-E  -L/usr/local/lib  -L/usr/lib/perl/5.10/CORE -lperl -L/usr/lib/
python2.6/config -lpython2.6 -L/usr/lib -lz -lutil -Xlinker -export-
dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -lruby1.8 -lrt -lm

--
You received this message from the "vim_dev" 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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: :lmap can't remap to :lnoremap?

Tony Mechelynck
On 06/05/10 12:45, tyru wrote:

> 1. :source below code
> 2. Enter insert mode
> 3. Press<C-^>
> 4. Type "bar"
> 5. Vim outputs "noremap!", not "lnoremap"
>
> --- code ---
> " :lmap can't remap?
> "
> " Typing "bar" outputs "noremap!", not "lnoremap".
>
> lnoremap foo<Esc>:<C-u>echomsg 'lnoremap'<CR>
> noremap! foo<Esc>:<C-u>echomsg 'noremap!'<CR>
>
> lmap bar foo
> --- code ---
>
>
> And this is another problem though,
>      set wildchar=<Tab>
>      set wildmode
> and
>      lmap<Tab>
> in command-line does not complete any mapping as :map does.

What is 'iminsert' set to? (See its help.) Unless it is 1,
language-mappings are not active:

        if &imi == 0
                echo "standard key bindings"
        elseif &imi == 1
                echo "language-mappings work"
        elseif &imi == 2
                echo "Input Method (IME or XIM) is active"
        else
                set iminsert? | echo "I don't know what this means"
        endif


Setting 'keymap' sets 'imi' as a side-effect, but IIUC defining
language-mappings from the keyboard or by using :l[nore]map in a script
doesn't.

See also
        :help i_CTRL-^
        :help c_CTRL-^


Best regards,
Tony.
--
You men out there probably think you already know how to dress for
success.  You know, for example, that you should not wear leisure suits
or white plastic belts and shoes, unless you are going to a costume
party disguised as a pig farmer vacationing at Disney World.
                -- Dave Barry, "How to Dress for Real Success"

--
You received this message from the "vim_dev" 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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: :lmap can't remap to :lnoremap?

Bram Moolenaar
In reply to this post by tyru-2

Tyru wrote:

> 1. :source below code
> 2. Enter insert mode
> 3. Press <C-^>
> 4. Type "bar"
> 5. Vim outputs "noremap!", not "lnoremap"
>
> --- code ---
> " :lmap can't remap?
> "
> " Typing "bar" outputs "noremap!", not "lnoremap".
>
> lnoremap foo <Esc>:<C-u>echomsg 'lnoremap'<CR>
> noremap! foo <Esc>:<C-u>echomsg 'noremap!'<CR>
>
> lmap bar foo
> --- code ---

I first thought that it's the order that matters, but when putting the
lmap last it still doesn't work.  I suppose that's a bug.

> And this is another problem though,
>     set wildchar=<Tab>
>     set wildmode
> and
>     lmap <Tab>
> in command-line does not complete any mapping as :map does.

That's a missing feature.  I'll add it to the todo list.

--
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
You received this message from the "vim_dev" 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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: :lmap can't remap to :lnoremap?

Andy Wokula
Am 07.05.2010 12:59, schrieb Bram Moolenaar:

>
> Tyru wrote:
>
>> 1. :source below code
>> 2. Enter insert mode
>> 3. Press<C-^>
>> 4. Type "bar"
>> 5. Vim outputs "noremap!", not "lnoremap"
>>
>> --- code ---
>> " :lmap can't remap?
>> "
>> " Typing "bar" outputs "noremap!", not "lnoremap".
>>
>> lnoremap foo<Esc>:<C-u>echomsg 'lnoremap'<CR>
>> noremap! foo<Esc>:<C-u>echomsg 'noremap!'<CR>
>>
>> lmap bar foo
>> --- code ---
>
> I first thought that it's the order that matters, but when putting the
> lmap last it still doesn't work.  I suppose that's a bug.

A bug??

I always thought this was intended behaviour (given I understand the issue).

Does it make any sense to remap language-mapped keys to other language-
mapped keys?  IMHO not.

But 'lmaps' to 'imapped' keys are very useful.

for example, the autoclose plugin (or any similar plugin) maps '(' in
Insert mode.
Now with a german key map (which contains
     :lmap * (
), I want '*' to be remapped to the '(' defined by the plugin.

Currently, extra work is needed, because the :loadkeymap command uses
:lnoremap (instead of :lmap), but that's a minor issue.


--
Andy

--
You received this message from the "vim_dev" 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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: :lmap can't remap to :lnoremap?

tyru-2
> What is 'iminsert' set to? (See its help.)
&iminsert is 1.

    lnoremap foo <Esc>:<C-u>echomsg 'lnoremap'<CR>:<C-u>echomsg
&iminsert<CR>
    noremap! foo <Esc>:<C-u>echomsg 'noremap!'<CR>:<C-u>echomsg
&iminsert<CR>

This echoes 'noremap!' and '1' to command-line.


> That's a missing feature.  I'll add it to the todo list.
Thanks!


> A bug??
>
> I always thought this was intended behaviour (given I understand the issue).

That's right, sorry.
I should have titled "Possible bug: ..." to my mail.

On May 7, 8:37 pm, Andy Wokula <[hidden email]> wrote:

> Am 07.05.2010 12:59, schrieb Bram Moolenaar:
>
>
>
>
>
> > Tyru wrote:
>
> >> 1. :source below code
> >> 2. Enter insert mode
> >> 3. Press<C-^>
> >> 4. Type "bar"
> >> 5. Vim outputs "noremap!", not "lnoremap"
>
> >> --- code ---
> >> " :lmap can't remap?
> >> "
> >> " Typing "bar" outputs "noremap!", not "lnoremap".
>
> >> lnoremap foo<Esc>:<C-u>echomsg 'lnoremap'<CR>
> >> noremap! foo<Esc>:<C-u>echomsg 'noremap!'<CR>
>
> >> lmap bar foo
> >> --- code ---
>
> > I first thought that it's the order that matters, but when putting the
> > lmap last it still doesn't work.  I suppose that's a bug.
>
> A bug??
>
> I always thought this was intended behaviour (given I understand the issue).
>
> Does it make any sense to remap language-mapped keys to other language-
> mapped keys?  IMHO not.
>
> But 'lmaps' to 'imapped' keys are very useful.
>
> for example, the autoclose plugin (or any similar plugin) maps '(' in
> Insert mode.
> Now with a german key map (which contains
>      :lmap * (
> ), I want '*' to be remapped to the '(' defined by the plugin.
>
> Currently, extra work is needed, because the :loadkeymap command uses
> :lnoremap (instead of :lmap), but that's a minor issue.
>
> --
> Andy
>
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visithttp://www.vim.org/maillist.php

--
You received this message from the "vim_dev" 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