Vim Arrow key problem under Linux

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

Vim Arrow key problem under Linux

akineko
Hello everyone,

I have been using VIM for many years under Solaris.
I've never had any problem using VIM under Solaris.

Now, in my work place I need to use RH Linux from PC using Exceed.
I started to notice that some features of VIM were not working
in my work place's environment.

I intensively use split window and use ^W+(arrow key) to navigate it.
I still can use ^W+t or ^W+b to switch the window but I cannot do such
using the arrow keys.

So, I talked to the system administrator about my problem.
He has claimed that there is nothing wrong with the system setting
because I can still use arrow keys to move the cursor in the VIM window.

I suspected terminal setting (termcap and TERM).
But the feature (navigating the split windows using arrow keys) works
fine in both TERM=sun-cmd and TERM=xterm if it is under Solaris.

Is there anybody using ^W+(arrow keys) under Linux?

One thing may be contributing is that I use csh under Solaris
while tcsh is the shell under Linux. 'tcsh' also traps arrow keys
to do some 'stuff'. 'csh' under Linux is just an alias to 'tcsh'
so that I cannot tell if this is the source of the problem.

//

I tried to find a solution from newsgroups, FAQ, archives.
So far, I cannot find any working solution.

I spent days figuring this and so far not successful and I almost
exhausted what I can try.

Any suggestions, comments are highly appreciated.

Best regards,
Aki Niimura
Reply | Threaded
Open this post in threaded view
|

Re: Vim Arrow key problem under Linux

akineko
luis jure wrote:
> i tried ^W+(arrow keys) and it works OK here. it's vim 6.3 on gentoo linux,
> and i'm using bash.

Good to hear that there is a case where ^W+(arrow keys) works under Linux.
Very encouraging ... ;-)


> ... can't you switch to bash and see if it changes anything?

I already tried. It didn't help. However, I don't have a super-user
password, I cannot change my native shell setting. The one tried is
bash shell invoked from a tcsh shell so that key events are maybe
already manipulated before reaching to the bash shell.

Aki-

Reply | Threaded
Open this post in threaded view
|

Re: Vim Arrow key problem under Linux

A.J.Mechelynck
In reply to this post by akineko
----- Original Message -----
From: <[hidden email]>
To: <[hidden email]>
Sent: Saturday, July 23, 2005 1:10 PM
Subject: Vim Arrow key problem under Linux


> Hello everyone,
>
> I have been using VIM for many years under Solaris.
> I've never had any problem using VIM under Solaris.
>
> Now, in my work place I need to use RH Linux from PC using Exceed.
> I started to notice that some features of VIM were not working
> in my work place's environment.
>
> I intensively use split window and use ^W+(arrow key) to navigate it.
> I still can use ^W+t or ^W+b to switch the window but I cannot do such
> using the arrow keys.
>
> So, I talked to the system administrator about my problem.
> He has claimed that there is nothing wrong with the system setting
> because I can still use arrow keys to move the cursor in the VIM window.
>
> I suspected terminal setting (termcap and TERM).
> But the feature (navigating the split windows using arrow keys) works
> fine in both TERM=sun-cmd and TERM=xterm if it is under Solaris.
>
> Is there anybody using ^W+(arrow keys) under Linux?
>
> One thing may be contributing is that I use csh under Solaris
> while tcsh is the shell under Linux. 'tcsh' also traps arrow keys
> to do some 'stuff'. 'csh' under Linux is just an alias to 'tcsh'
> so that I cannot tell if this is the source of the problem.
>
> //
>
> I tried to find a solution from newsgroups, FAQ, archives.
> So far, I cannot find any working solution.
>
> I spent days figuring this and so far not successful and I almost
> exhausted what I can try.
>
> Any suggestions, comments are highly appreciated.
>
> Best regards,
> Aki Niimura

Rather than letting yourself get exhausted, use (at least temporarily) the
following (synonymous) key bindings:

    Ctrl-W h    for    Ctrl-W Left
    Ctrl-W j    for    Ctrl-W Down
    Ctrl-W k    for    Ctrl-W Up
    Ctrl-W l    for    Ctrl-W Right

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: Vim Arrow key problem under Linux

Will Maier
In reply to this post by akineko
On Sat, Jul 23, 2005 at 04:10:34AM -0700, [hidden email] wrote:
> I intensively use split window and use ^W+(arrow key) to navigate it.
> I still can use ^W+t or ^W+b to switch the window but I cannot do such
> using the arrow keys.

As Tony said, substitute hjkl for your arrow keys until you find a more
permanent solution (I know it's hard to change old ways).

> Is there anybody using ^W+(arrow keys) under Linux?

I use ^W+[hjkl] on Linux...I prefer the 'home row' key placement Vim uses.

> One thing may be contributing is that I use csh under Solaris
> while tcsh is the shell under Linux. 'tcsh' also traps arrow keys
> to do some 'stuff'. 'csh' under Linux is just an alias to 'tcsh'
> so that I cannot tell if this is the source of the problem.

This is still something you can test without being superuser. Not all Linuxes
alias csh -> tcsh; I'd verify that your preferred shell doesn't exist (`unalias
csh; which csh`). Whether or not you can use good ole csh, there are almost
certainly other shells available. Take a look in /etc/shells -- try running any
of those shells from within tcsh. Should work fine.

I personally use zsh and have no problem using the arrow keys (even if I prefer
hjkl). I think you're right to question your shell; see if manually running the
shell from a logged-in tcsh makes any difference. If all else fails, you
adminstrator should be kind enough to change your default shell...

--

Will Maier

Reply | Threaded
Open this post in threaded view
|

Re: Vim Arrow key problem under Linux

John (Eljay) Love-Jensen
[off-topic for the forum; but some might find this useful]

> I personally use zsh and have no problem using the arrow keys (even if I
prefer hjkl). I think you're right to question your shell; see if manually
running the shell from a logged-in tcsh makes any difference. If all else fails,
you adminstrator should be kind enough to change your default shell...

I prefer bash, but the Unix admin folks have everyone use csh or tcsh.  And
bash is not in /etc/shells so no "passwd -e".  :-(

So this workaround is my ~/.login file...
-------------------------------------------
if (-x /bin/bash) then
 alias bash "exec /bin/bash"
else if (-x /usr/bin/bash) then
 alias bash "exec /usr/bin/bash"
else if (-x /usr/local/bin/bash) then
 alias bash "exec "/usr/local/bin/bash"
endif

echo "Autolaunching bash from csh."
bash
-------------------------------------------

The same trick can work for zsh, or whatever preferred shell one uses.

HTH,
--Eljay


Reply | Threaded
Open this post in threaded view
|

Re: Vim Arrow key problem under Linux

A.J.Mechelynck
----- Original Message -----
From: "Eljay Love-Jensen" <[hidden email]>
To: "Will Maier" <[hidden email]>; <[hidden email]>
Cc: <[hidden email]>
Sent: Monday, July 25, 2005 2:02 PM
Subject: Re: Vim Arrow key problem under Linux


> [off-topic for the forum; but some might find this useful]
>
>> I personally use zsh and have no problem using the arrow keys (even if I
> prefer hjkl). I think you're right to question your shell; see if manually
> running the shell from a logged-in tcsh makes any difference. If all else
> fails,
> you adminstrator should be kind enough to change your default shell...
>
> I prefer bash, but the Unix admin folks have everyone use csh or tcsh.
> And
> bash is not in /etc/shells so no "passwd -e".  :-(
>
> So this workaround is my ~/.login file...
> -------------------------------------------
> if (-x /bin/bash) then
> alias bash "exec /bin/bash"
> else if (-x /usr/bin/bash) then
> alias bash "exec /usr/bin/bash"
> else if (-x /usr/local/bin/bash) then
> alias bash "exec "/usr/local/bin/bash"
> endif
>
> echo "Autolaunching bash from csh."
> bash
> -------------------------------------------
>
> The same trick can work for zsh, or whatever preferred shell one uses.
>
> HTH,
> --Eljay

It can work, but considering that all three of /bin, /usr/bin and
/usr/local/bin are usually in the $PATH, is it necessary to define an alias?
Just the last two lines ought to be enough, unless you deliberately want to
reverse the search order for bash.

Best regards,
Tony.