Home and End keys

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

Home and End keys

Ven Tadipatri
Not sure if this is the place to post this, but my home and end keys
don't appear to work when I set the mode in Bash to vi.
The home and end keys work fine in vim. Does vim use some sort of
different key map file? Maybe I could somehow bind the keys in bash so
that they work as expected.

Thanks,
Ven

--
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: Home and End keys

Christian Brabandt
On Wed, October 13, 2010 5:11 pm, Ven Tadipatri wrote:
> Not sure if this is the place to post this, but my home and end keys
> don't appear to work when I set the mode in Bash to vi.
> The home and end keys work fine in vim. Does vim use some sort of
> different key map file? Maybe I could somehow bind the keys in bash so
> that they work as expected.

This is most likely a termcap/terminfo issue. Either your $TERM does
not corretly identify your actual terminal or your terminfo database
is out of date. Either way, this has nothing to do with vim.

BTW: You can bind those keys using the readline library. man readline
should give you enough info (I did it before, but can't show you an
example right now).

regards,
Christian

--
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: Home and End keys

Christian Brabandt
On Wed, October 13, 2010 5:26 pm, Christian Brabandt wrote:
> BTW: You can bind those keys using the readline library. man readline
> should give you enough info (I did it before, but can't show you an
> example right now).

e.g. put something like this in your .inputrc:
"\e[1~": beginning-of-line
"\e[4~": end-of-line

e.g. press Ctrl-V followed by your key this will most likely output
something like ^[[4~ which translates to \e[4~ in readline terms.

regards,
Christian

--
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: Home and End keys

Ven Tadipatri
On Wed, Oct 13, 2010 at 11:33 AM, Christian Brabandt <[hidden email]> wrote:
> On Wed, October 13, 2010 5:26 pm, Christian Brabandt wrote:
>> BTW: You can bind those keys using the readline library. man readline
>> should give you enough info (I did it before, but can't show you an
>> example right now).
>
> e.g. put something like this in your .inputrc:
> "\e[1~": beginning-of-line
> "\e[4~": end-of-line

I did have this in my inputrc. What's happening when I hit home and
end (The problem is on my windows box, when I'm using Cygwin...home
and end appear to work ok on my linux box), is that it goes forward a
character and changes the case of it.  Sometimes I can see it go
forward 4 characters and change the case, which  is what you would
expect in vi if you hit escape, and then did 1~ or 4~
   I tried taking these lines out of the inputrc and the behavior's the same.

>
> e.g. press Ctrl-V followed by your key this will most likely output
> something like ^[[4~ which translates to \e[4~ in readline terms.

This is really strange, because what I want to specify is that in vi
mode, hitting the home and end keys should map to beginning and end of
line. Instead, it almost seems like when I hit the home and end keys,
it escapes, then does the vi command "1~". How odd. There are no
mappings for home and end in my vimrc. Yet the home and end keys work
fine as soon as I go into vim.  The inputrc on my windows and linux
box is the same, so I'm really puzzled where this strange behavior is
coming from. It only happens in vi mode. In emacs mode the commands
work just fine
   Ah well, maybe I'll just switch back to emacs mode.

Thanks,
Ven

>
> regards,
> Christian
>

--
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: Home and End keys

Christian Brabandt
On Wed, October 13, 2010 6:20 pm, Ven Tadipatri wrote:

> On Wed, Oct 13, 2010 at 11:33 AM, Christian Brabandt <[hidden email]>
> wrote:
>> On Wed, October 13, 2010 5:26 pm, Christian Brabandt wrote:
>>> BTW: You can bind those keys using the readline library. man readline
>>> should give you enough info (I did it before, but can't show you an
>>> example right now).
>>
>> e.g. put something like this in your .inputrc:
>> "\e[1~": beginning-of-line
>> "\e[4~": end-of-line
>
> I did have this in my inputrc. What's happening when I hit home and
> end (The problem is on my windows box, when I'm using Cygwin...home
> and end appear to work ok on my linux box), is that it goes forward a
> character and changes the case of it.  Sometimes I can see it go
> forward 4 characters and change the case, which  is what you would
> expect in vi if you hit escape, and then did 1~ or 4~
>    I tried taking these lines out of the inputrc and the behavior's the
> same.

Please enter cat and press the keys and show the output on both terminals.
As I said, this is terminal dependent and depends on the value of your
$TERM environment variable.

>> e.g. press Ctrl-V followed by your key this will most likely output
>> something like ^[[4~ which translates to \e[4~ in readline terms.
>
> This is really strange, because what I want to specify is that in vi
> mode, hitting the home and end keys should map to beginning and end of
> line. Instead, it almost seems like when I hit the home and end keys,
> it escapes, then does the vi command "1~". How odd. There are no
> mappings for home and end in my vimrc. Yet the home and end keys work
> fine as soon as I go into vim.  The inputrc on my windows and linux
> box is the same, so I'm really puzzled where this strange behavior is
> coming from. It only happens in vi mode. In emacs mode the commands
> work just fine
>    Ah well, maybe I'll just switch back to emacs mode.

No, as I said, this is completely independent of vim. It's a bash behaviour
and has nothing to do with vim.

regards,
Christian

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