Mapping the > character

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

Mapping the > character

David Fishburn

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).

TIA,
Dave

Reply | Threaded
Open this post in threaded view
|

Re: Mapping the > character

Antony Scriven
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
Reply | Threaded
Open this post in threaded view
|

RE: Mapping the > character

David Fishburn
 

>
> 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