You are not logged in.

#1 2010-10-27 04:22:23

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

urxvt + vim arrow keys in insert mode problem

There's this annoying problem I've been experiencing for a while now that I haven't been able to fix.

I'm running urxvt-unicode-256color as my terminal emulator. When I'm using vim in insert mode, accidentally hitting the arrow keys inserts A B C D or into the file. I don't use the arrows keys, but accidentally hitting them can get really annoying. I've read all sorts of ways to resolve this and none of the seem to work. The only way I was able to get around this was to set $TERM to be xterm, but that seems like a weird fix for this.

Is there another way of solving this?

Offline

#2 2010-10-27 10:27:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: urxvt + vim arrow keys in insert mode problem

nan wrote:

Is there another way of solving this?

Map the keys in vim to something useful or to nothing at all.

BTW, I have the same setup and my cursor keys result in movement like hjkl, so:
- check if you're using vim and not vi,
- change your settings in .vimrc.

Last edited by karol (2010-10-27 10:29:36)

Offline

#3 2010-10-27 10:52:40

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: urxvt + vim arrow keys in insert mode problem

set your TERM to rxvt-256color, make sure vim is not in compatible mode (and that you are actually using vim and not vi)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#4 2010-10-27 11:20:38

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: urxvt + vim arrow keys in insert mode problem

Mr.Elendig wrote:

set your TERM to rxvt-256color

Not quite so. With rxvt-unicode-256color 9.07-10 TERM has changed to rxvt-unicode.

I had to enter this line to my /etc/DIR_COLORS definitions file ("TERM rxvt-unicode"). My ~/.bashrc does evaluate the current DIR_COLORS settings (which set the LS_COLORS environment variable):

# Use current DIRCOLORS settings
eval `dircolors -b /etc/DIR_COLORS`

Therefore urxvt will then use the proper terminal definitions next time it is called.


To know or not to know ...
... the questions remain forever.

Offline

#5 2010-10-27 11:25:10

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: urxvt + vim arrow keys in insert mode problem

Well, simply set URxvt*termName: to  rxvt-unicode then.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2010-10-27 13:45:12

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

karol wrote:
nan wrote:

Is there another way of solving this?

Map the keys in vim to something useful or to nothing at all.

BTW, I have the same setup and my cursor keys result in movement like hjkl, so:
- check if you're using vim and not vi,
- change your settings in .vimrc.

I've already mapped the keys to do nothing. But it doesn't seem to work. I'm using map and imap, I've also use set t_ku, etc.

How do I check if I'm using vim as opposed to vi? I've already installed the vim package.

I have set nocompatible in my .vimrc but it doesn't seem to do anything.

Mr.Elendig wrote:

set your TERM to rxvt-256color, make sure vim is not in compatible mode (and that you are actually using vim and not vi)

My term vairable is already set to rxvt-unicode.

Offline

#7 2010-10-27 14:43:58

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: urxvt + vim arrow keys in insert mode problem

Are you executing `vi` or `vim`?
And to see what you are running.. :version


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#8 2010-10-27 15:45:41

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

I'm executing vim. The version is 7.3

Offline

#9 2010-10-27 15:57:05

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt + vim arrow keys in insert mode problem

What do you get when pressing Ctrl-V followed by the left arrow key in your shell?

Offline

#10 2010-10-27 16:14:04

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

When I press Ctrl-V then left arrow I get ^[[D

Offline

#11 2010-11-01 17:55:08

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

A very curious thing is that the arrow keys work fine when I use vi and not vim.... gvim also works as expected...

Offline

#12 2010-11-01 20:55:54

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: urxvt + vim arrow keys in insert mode problem

Try commenting out setting in your $HOME/.vimrc and see if you can find one setting which is causing the foo.

Offline

#13 2010-11-02 00:58:09

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

A fully commented .vimrc or simply deleteing the .vimrc both do not fix the problem.

Offline

#14 2010-11-02 02:05:52

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: urxvt + vim arrow keys in insert mode problem

nan wrote:
karol wrote:
nan wrote:

Is there another way of solving this?

Map the keys in vim to something useful or to nothing at all.

BTW, I have the same setup and my cursor keys result in movement like hjkl, so:
- check if you're using vim and not vi,
- change your settings in .vimrc.

I've already mapped the keys to do nothing. But it doesn't seem to work. I'm using map and imap, I've also use set t_ku, etc.

How do I check if I'm using vim as opposed to vi? I've already installed the vim package.

I have set nocompatible in my .vimrc but it doesn't seem to do anything.

Mr.Elendig wrote:

set your TERM to rxvt-256color, make sure vim is not in compatible mode (and that you are actually using vim and not vi)

My term vairable is already set to rxvt-unicode.

Set it to 'rxvt-256color'

Offline

#15 2010-11-02 02:09:55

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

Still no luck.

I did export TERM=rxvt-256color then echo $TERM to make sure it was set properly. However, the results are still the same.

Offline

#16 2010-11-02 02:17:52

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: urxvt + vim arrow keys in insert mode problem

setting 'nocompatible' in your .vimrc (which you should pastie) is more important than the terminal setting.

Offline

#17 2010-11-02 02:39:52

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

I already have that set.

This is my .vimrc

filetype plugin indent on
syntax on
set nocompatible
set number
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set guioptions-=m
set guioptions-=T
set vb t_vb=
set ruler
set incsearch

colorscheme soruby
set guifont=ProFont\ 7

set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
let g:Tex_MultipleCompileFormats = "pdf"
set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after
 
set vb t_vb=

I've removed the mappings for the arrows keys since they don't seem to work.

Offline

#18 2010-11-03 15:55:10

nan
Member
From: Waterloo, Canada
Registered: 2008-07-16
Posts: 70

Re: urxvt + vim arrow keys in insert mode problem

I'm convinced that there is something wrong with my vim installation on my machine...
I sshed to a remote server, checked that my $TERM was set to rxvt-unicode, started vim with no .vimrc and everything was fine.

Any idea what's wrong with my local installation of vim?

Offline

#19 2010-11-17 01:36:53

rockdragon
Member
Registered: 2010-05-02
Posts: 5

Re: urxvt + vim arrow keys in insert mode problem

I've exactly the same problem. "set nocompatible" is set in .vimrc , but I still get ABCD when pressing the arrowkeys.

Offline

#20 2010-11-17 02:36:56

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: urxvt + vim arrow keys in insert mode problem

To test try:

$ vim -u NONE

If it still doesn't work try testing with a differnet terminal program (eg xterm).

Offline

Board footer

Powered by FluxBB