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

Re: Mapping the > character

Expand Messages
  • Antony Scriven
    ... Try typing a ^V M- in a buffer and then use ga to see what it is. Just a quick check: you are typing M- and not M-. right? In gvim on W32 I find mapping
    Message 1 of 3 , Jul 1, 2005
      On Jun 30, David Fishburn wrote:

      > Vim 6.3.75 WinXP SP2
      >
      > Standard usage:
      > :map <C-F1> :do something<CR>
      >
      > But what if you want to use the "<" and ">" keys in your map?
      >
      > Really I wanted CTRL->, but I do not believe we can use
      > that key since if I type:
      > :<C-V><C->> (^V, followed by ^>)
      > I do not get any output, so I assume this means I cannot
      > map that key.
      >
      > So I tried ALT->, using ^V I can see this has a value.
      > So I can map it using ^V and then the character.
      > However, I do not like doing this since it is not
      > particularily self documenting. Is there anyway to map
      > these characters while escaping them (or something).

      Try typing a ^V M-> in a buffer and then use ga to see what
      it is. Just a quick check: you are typing M-> and not M-.
      right? In gvim on W32 I find mapping <M-.> and <M->> works
      fine.

      Antony
    • David Fishburn
      ... Thanks Antony. I added the following to my .vimrc: These two characters are the ALT- . To determine what character # these are go into insert
      Message 2 of 3 , Jul 7, 2005
        >
        > On Jun 30, David Fishburn wrote:
        >
        > > Vim 6.3.75 WinXP SP2
        > >
        > > Standard usage:
        > > :map <C-F1> :do something<CR>
        > >
        > > But what if you want to use the "<" and ">" keys in your map?
        > >
        > > Really I wanted CTRL->, but I do not believe we can use >
        > that key since if I type:
        > > :<C-V><C->> (^V, followed by ^>)
        > > I do not get any output, so I assume this means I cannot
        > > map that key.
        > >
        > > So I tried ALT->, using ^V I can see this has a value.
        > > So I can map it using ^V and then the character.
        > > However, I do not like doing this since it is not >
        > particularily self documenting. Is there anyway to map >
        > these characters while escaping them (or something).
        >
        > Try typing a ^V M-> in a buffer and then use ga to see what
        > it is. Just a quick check: you are typing M-> and not M-.
        > right? In gvim on W32 I find mapping <M-.> and <M->> works fine.
        >

        Thanks Antony.

        I added the following to my .vimrc:

        " These two characters are the ALT-< and ALT->.
        " To determine what character # these are go into insert mode
        " in a new buffer. Press CTRL-V then ALT and the > key.
        " Leave insert mode, move the cursor onto the character
        " and press ga. This will display the decimal, hex and octal
        " representation of the character. In this case, they are
        " 172 and 174.
        :map <Char-172> :do something<CR>
        :map <Char-174> :do something else<CR>

        Hopefully this might help someone else.

        Dave
      Your message has been successfully submitted and would be delivered to recipients shortly.