Loading ...
Sorry, an error occurred while loading the content.

Re: Built-in Maps

Expand Messages
  • Tony Mechelynck
    ... I agree. ... If several mappings {lhs}es _begin_ with Alt-N, you ll see them with ... or ... but to undo them you ll have to give the exact {lhs}es. Or
    Message 1 of 7 , Aug 26 5:25 PM
    • 0 Attachment
      On 27/08/08 01:43, Bill McCarthy wrote:
      > On Tue 26-Aug-08 6:26pm -0600, Tony Mechelynck wrote:
      >
      >> On 27/08/08 01:07, Bill McCarthy wrote:
      >>> Hello Vim Developers,
      >>>
      >>> I've noticed that some mappings are built into Gvim and Vim.
      >>> Here are the ones built into Gvim (from the output of:
      >>> :map|map!) - if it matters, I'm running under Windows XP:
      >>>
      >>> v<C-X> "*d
      >>> v<C-Del> "*d
      >>> v<S-Del> "*d
      >>> v<C-Insert> "*y
      >>> v<S-Insert> "-d"*P
      >>> n<S-Insert> "*P
      >>> !<S-Insert> <C-R><C-O>*
      >>>
      >>> The following are the built-in maps for Vim:
      >>>
      >>> v<C-X> "-d
      >>> nv<C-End> <C-End>
      >>> nv<C-Home> <C-Home>
      >>> v ÎØ "*d
      >>> v Î× "*d
      >>> v ÎÕ "*y
      >>> v ÎÔ "-d"*P
      >>> n ÎÔ "*P
      >>> !<C-End> <C-End>
      >>> !<C-Home> <C-Home>
      >>> i ÎÔ<C-R><C-O>*
      >>>
      >>> The Gvim maps remind of some Windows shortcuts that have
      >>> apparently been borrowed by Bram. Those 5 vmaps are quite
      >>> odd. They should work fine as xmaps but we'll not behave as
      >>> intended as smaps. To fix this problem, I've added to my
      >>> _vimrc:
      >>>
      >>> sunmap<C-X>
      >>> if has("gui")
      >>> sunmap<C-Del>
      >>> sunmap<S-Del>
      >>> sunmap<C-Insert>
      >>> sunmap<S-Insert>
      >>> endif
      >>>
      >>> The maps in the has("gui") can't be unmapped that way in
      >>> Vim. Also, what is being accomplished by mapping<C-End>
      >>> and<C-Home> to themselves?
      >>>
      >> I suspect they are set by some script; maybe mswin.vim or maybe some
      >> "system vimrc":
      >>
      >> 1. Try starting Vim by typing
      >>
      >> vim -N -u NONE
      >> or
      >> gvim -N -u NONE
      >
      > That's how I started to capture only the maps I show above
      > (and yes I used redir with "verb map" and "verb map!" to do
      > it). There are no script files involved.
      >
      >> This will tell you where all these mappings came from. The strange
      >> two-character {lhs}es might represent Alt-key chords.
      >
      > Yes they are. I can see them with:
      >
      > vmap<M-N>
      >
      > which is a bit strange for<C-Del>,<S-Del>,<C-Insert> and
      > <S-Insert>.

      I agree.

      >
      > sunmap<M-N>
      >
      > gives: E31: No such mapping

      If several mappings' {lhs}es _begin_ with Alt-N, you'll see them with

      :map <M-N>
      or
      :map! <M-N>

      but to undo them you'll have to give the exact {lhs}es. Or else, you
      should be able to undo _all_ mappings by adding

      silent mapclear
      silent mapclear!

      at the top of your vimrc and again of your gvimrc if you have one (or at
      the GUIEnter event if you don't). However ":help :mapclear" says
      "Warning: This also removes the default mappings." I suppose those
      "default mappings" are, on Windows, the ones you found, and that my vim
      for Linuw/X11/GTK2 doesn't have any (see below).


      Here's what I see on Linux:

      vim -N -u NONE

      :map
      No mapping found
      :map!
      No mapping found

      gvim -N -u NONE

      :map
      No mapping found
      :map!
      No mapping found

      ----------------------------------
      Ah! I found them !!!!!!!!!!!!!!!!!
      ----------------------------------
      see ":help dos-standard-mappings"


      Best regards,
      Tony.
      --
      If entropy is increasing, where is it coming from?

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bill McCarthy
      ... Thanks Tony! I ve revised my _vimrc correction to work fine for Vim as well as Gvim: Remove the not useful select mode versions sunmap if
      Message 2 of 7 , Aug 26 9:05 PM
      • 0 Attachment
        On Tue 26-Aug-08 7:25pm -0600, Tony Mechelynck wrote:

        > ----------------------------------
        > Ah! I found them !!!!!!!!!!!!!!!!!
        > ----------------------------------
        > see ":help dos-standard-mappings"

        Thanks Tony! I've revised my _vimrc correction to work fine
        for Vim as well as Gvim:

        " Remove the not useful select mode versions
        sunmap <C-X>
        if has("GUI")
        sunmap <C-Del>
        sunmap <S-Del>
        sunmap <C-Insert>
        sunmap <S-Insert>
        else
        sunmap <M-N><M-T>
        sunmap <M-N><M-U>
        sunmap <M-N><M-W>
        sunmap <M-N><M-X>
        " and these strange mappings
        unmap! <C-End>
        unmap! <C-Home>
        unmap <C-End>
        unmap <C-Home>
        endif

        --
        Best regards,
        Bill



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tony Mechelynck
        ... For Windows this is OK (I think), but remember (just in case) that on Unix/Linux a single executable can work either in Console mode or GUI mode. There,
        Message 3 of 7 , Aug 26 9:48 PM
        • 0 Attachment
          On 27/08/08 06:05, Bill McCarthy wrote:
          > On Tue 26-Aug-08 7:25pm -0600, Tony Mechelynck wrote:
          >
          >> ----------------------------------
          >> Ah! I found them !!!!!!!!!!!!!!!!!
          >> ----------------------------------
          >> see ":help dos-standard-mappings"
          >
          > Thanks Tony! I've revised my _vimrc correction to work fine
          > for Vim as well as Gvim:
          >
          > " Remove the not useful select mode versions
          > sunmap<C-X>
          > if has("GUI")
          > sunmap<C-Del>
          > sunmap<S-Del>
          > sunmap<C-Insert>
          > sunmap<S-Insert>
          > else
          > sunmap<M-N><M-T>
          > sunmap<M-N><M-U>
          > sunmap<M-N><M-W>
          > sunmap<M-N><M-X>
          > " and these strange mappings
          > unmap!<C-End>
          > unmap!<C-Home>
          > unmap<C-End>
          > unmap<C-Home>
          > endif
          >

          For Windows this is OK (I think), but remember (just in case) that on
          Unix/Linux a single executable can work either in Console mode or GUI
          mode. There, has('gui') and has('gui_running') are different:

          has('gui')
          GUI capability is compiled-in
          has('gui_running')
          we are in the GUI, or about to start it

          In addition, on Unix/Linux you can start a GUI-enabled Vim in Console
          mode and later start the GUI with ":gui". In that case your vimrc will
          already have been sourced with !has('gui_running'), but sourcing the
          gvimrc, triggering the GUIEnter event starting the GUI, and possibly
          forking from the console terminal, will all happen as a result of the
          ":gui" command (and with has('gui_running') on). (Personally I don't use
          that copmmand, but some other people sometimes do.)

          In all GUI versions, the 'term' setting is set to builtin_gui when
          starting the GUI. The termcap settings (including e.g. the visualbell
          screen code) are then changed and maybe also the "default Dos/Windows
          mappings". In that case undoing the default GUI mappings in the vimrc
          could be too soon, in that case you can use either a gvimrc or a
          GUIEnter autocommand.


          Best regards,
          Tony.
          --
          This is for all ill-treated fellows
          Unborn and unbegot,
          For them to read when they're in trouble
          And I am not.
          -- A. E. Housman

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Bill McCarthy
          ... Since, in Windows, Gvim has the GUI and Vim doesn t, I don t believe there s a difference. Anyway, I would have preferred that Bram didn t build in these
          Message 4 of 7 , Aug 27 12:42 AM
          • 0 Attachment
            On Tue 26-Aug-08 11:48pm -0600, Tony Mechelynck wrote:

            > For Windows this is OK (I think), but remember (just in case) that on
            > Unix/Linux a single executable can work either in Console mode or GUI
            > mode. There, has('gui') and has('gui_running') are different:

            Since, in Windows, Gvim has the GUI and Vim doesn't, I don't
            believe there's a difference.

            Anyway, I would have preferred that Bram didn't build in
            these mappings at all. They should be in mswin.vim (some,
            if not all, already are there).

            --
            Best regards,
            Bill


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.