Unable to enter functions keys in .vimrc or any other file

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

Unable to enter functions keys in .vimrc or any other file

Mahendra Ladhe
Hi,
   I am using vim 7.3 on Windows XP. I'm trying to map some function keys using 'map'
command in the .vimrc
When I enter the key sequence ctrl-v followed by some function key, say F1,
vim enters the 4-character sequence <F1> instead of the actual control key F1.
Btw, I'm able to use ctrl-v key for visual mode text selection.
How do I enter function or any other control keys in .vimrc

Thanks,
Mahendra

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

Re: Unable to enter functions keys in .vimrc or any other file

Michael Hauser
On Mon, May 2, 2011 at 22:59, Mahendra Ladhe <[hidden email]> wrote:
>    I am using vim 7.3 on Windows XP. I'm trying to map some function keys using 'map'
> command in the .vimrc
> When I enter the key sequence ctrl-v followed by some function key, say F1,
> vim enters the 4-character sequence <F1> instead of the actual control key F1.
> Btw, I'm able to use ctrl-v key for visual mode text selection.
> How do I enter function or any other control keys in .vimrc

Hitting the function keys in insert mode seems to default to print <F1>.
Are you asking about the syntax?
Perhaps I am misunderstanding you here, but mapping e.g. ':q!' to 'F4'
works like this in .vimrc:

map <F4>        :q!<CR>

Regards,
mih

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

Re: Unable to enter functions keys in .vimrc or any other file

Jean-Rene David-2
In reply to this post by Mahendra Ladhe
* Mahendra Ladhe [2011.05.02 18:40]:
> When I enter the key sequence ctrl-v followed by some function key, say F1,
> vim enters the 4-character sequence <F1> instead of the actual control key F1.

Indeed it does. And have you tried to see if your mapping worked with
the 4-character sequence? Because that is the intended behavior and
works fine here.

--
JR

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

Re: Unable to enter functions keys in .vimrc or any other file

Mahendra Ladhe-2
Thanks JR. The mapping is working. On my earlier Windows XP PC with
vim 7.2,
the control keys like F1 would be displayed in blue color, different
than the rest of the text.
That's why I found it odd when vim 7.3 was entering 4-character plain-
text sequence for keys like F1.

On May 2, 7:18 pm, Jean-Rene David <[hidden email]> wrote:

> * Mahendra Ladhe [2011.05.02 18:40]:
>
> > When I enter the key sequence ctrl-v followed by some function key, say F1,
> > vim enters the 4-character sequence <F1> instead of the actual control key F1.
>
> Indeed it does. And have you tried to see if your mapping worked with
> the 4-character sequence? Because that is the intended behavior and
> works fine here.
>
> --
> JR

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

Re: Unable to enter functions keys in .vimrc or any other file

pansz
On Wed, May 4, 2011 at 1:59 AM, Mahendra Ladhe <[hidden email]> wrote:
> Thanks JR. The mapping is working. On my earlier Windows XP PC with
> vim 7.2,
> the control keys like F1 would be displayed in blue color, different
> than the rest of the text.
> That's why I found it odd when vim 7.3 was entering 4-character plain-
> text sequence for keys like F1.

Ctrl-A to Ctrl-Z are real control characters which will display in
real control character, F1 is not a character and it will not shown as
control character in vim.

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