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

mapleader to tilde "~"

Expand Messages
  • Henrique Camargo
    Hi, I m trying to map my leader key to tilde ~ since it lays in a convenient position in a ABNT2 keyboard layout [1] and I don t use the toggle case
    Message 1 of 4 , Nov 22, 2012
    • 0 Attachment
      Hi, I'm trying to map my leader key to tilde "~" since it lays in a
      convenient position in a ABNT2 keyboard layout [1] and I don't use the
      toggle case functionality too often.

      I have the following line in my .vimrc file:

      let mapleader = "~"

      But it is doest not work, setting the leader key to another key like
      "p" works as expected.

      Do I have to escape the tilde? I tried using It's unicode
      representation with no success.

      Thanks for the help,

      [1] http://nando.oui.com.br/_images/teclado-abnt2.png

      --
      Henrique Camargo

      Email: henrique@...
      Phone: +55 41 99152915

      --
      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
    • Ivan S. Freitas
      On Thu, Nov 22, 2012 at 2:20 PM, Henrique Camargo ... I don t think you will be able to do that just using vim, since the tilde is a dead key on the abnt2
      Message 2 of 4 , Nov 22, 2012
      • 0 Attachment
        On Thu, Nov 22, 2012 at 2:20 PM, Henrique Camargo
        <henrique@...> wrote:
        > Hi, I'm trying to map my leader key to tilde "~" since it lays in a
        > convenient position in a ABNT2 keyboard layout [1] and I don't use the
        > toggle case functionality too often.

        I don't think you will be able to do that just using vim, since the tilde is a
        dead key on the abnt2 layout.

        > let mapleader = "~"

        Try (works for me):
        map ~ <Nop>
        let mapleader = "~"

        (Without the Nop mapping it always uses the tilde to toggle between
        lower and upper case)

        The problem (tilde being a dead key) is that you will have to press it
        two times in order
        to have the effect of just one "leader" character.

        Assuming a Linux machine, you may be able to turn that to only one
        keystroke by using
        xmodmap, but AFAIK there is no direct way to make it affect only vim,
        i.e., it is changed
        globally. Also, if you make it a non-dead key, you may be unable to
        enter accented characters
        by usual means.

        --
        Ivan Sichmann Freitas
        GNU/Linux user #509059
        SDF Arpa Member http://isf.sdf.org/about.html

        --
        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
      • Henrique Camargo
        On Thu, Nov 22, 2012 at 4:27 PM, Ivan S. Freitas ... Thanks, that s exactly what is happening. If I change the keyboard layout from Portuguese (Brazil) to
        Message 3 of 4 , Nov 22, 2012
        • 0 Attachment
          On Thu, Nov 22, 2012 at 4:27 PM, Ivan S. Freitas
          <ivansichfreitas@...> wrote:
          > On Thu, Nov 22, 2012 at 2:20 PM, Henrique Camargo
          > <henrique@...> wrote:
          >> Hi, I'm trying to map my leader key to tilde "~" since it lays in a
          >> convenient position in a ABNT2 keyboard layout [1] and I don't use the
          >> toggle case functionality too often.
          >
          > I don't think you will be able to do that just using vim, since the tilde is a
          > dead key on the abnt2 layout.

          Thanks, that's exactly what is happening.

          If I change the keyboard layout from "Portuguese (Brazil)" to
          "Portuguese (Brazil, eliminate dead keys)" vim starts to behave as
          expected (since now the system is not waiting for the next character
          and sends the tilde immediately to vim).

          > Assuming a Linux machine, you may be able to turn that to only one
          > keystroke by using
          > xmodmap, but AFAIK there is no direct way to make it affect only vim,
          > i.e., it is changed
          > globally. Also, if you make it a non-dead key, you may be unable to
          > enter accented characters
          > by usual means.

          I'll try to find a solution to only modify the key when running vim. I
          can then map ~a to ã (as well as the others especial characters)
          manually using inoremap. But, for now, I'll find another leader key.

          Thanks,

          --
          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
        • Ivan S. Freitas
          ... AFAIK the no-deadkey layout can behave like the normal if you press altgr + accent key instead of just the accent key. Still one more key to press, but if
          Message 4 of 4 , Nov 22, 2012
          • 0 Attachment
            > I'll try to find a solution to only modify the key when running vim. I
            > can then map ~a to ã (as well as the others especial characters)
            > manually using inoremap. But, for now, I'll find another leader key.

            AFAIK the no-deadkey layout can behave like the normal if you
            press altgr + accent key instead of just the accent key. Still one
            more key to press, but if you get used to it then you can use tilde
            as your leader key.

            --
            Ivan Sichmann Freitas
            GNU/Linux user #509059
            SDF Arpa Member http://isf.sdf.org/about.html

            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.