screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vim keybindings not working in screen


From: Alain Bench
Subject: Re: Vim keybindings not working in screen
Date: Thu, 31 Jan 2008 13:30:55 +0100 (CET)
User-agent: Mutt/1.5.13 (2006-11-28)

Hello Johan,

 On Saturday, January 26, 2008 at 15:31:14 +0100, Johan Svedberg wrote:

> keybindings in vim using Ctrl and Meta with the Left and Right arrow
> keys [...] works fine outside of screen but not from within.

    Those key combinations are not very portable across terminals. They
are not part of the Screen virtual terminal. So Screen doesn't do
anything special with them, and generic TERM=screen* entries do not
report them (and should not). However Screen lets those keys pass thru,
from real terminal to apps, unmodified. This permits a proper solution:
Create a custom specialized terminfo entry, for Screen inside Xterm.
Such entries give you more out of your terminal, but are less portable:
I mean, if you detach and reattach Screen to another terminal, it might
well break. For a start:

| # specialized entry for Screen when started in an Xterm
| # adds support for ctrl-alt-left and right arrows
| screen.xterm|xterm-sc|GNU Screen inside Xterm,
|       kLFT5=\E[1;5D, kRIT5=\E[1;5C,
|       kLFT3=\E[1;3D, kRIT3=\E[1;3C,
|       kLFT7=\E[1;7D, kRIT7=\E[1;7C,
|       use=screen,

    "tic -x" this file, and export TERM=screen.xterm (if TERM=xterm
before you start Screen, this should be automatic).


    There may still remain a Vim-specific problem: IIRC Vim accepts to
properly interpret those keys only when TERM begins by "xterm". My entry
above defines an "xterm-sc" alias, just for this: When under screen,
alias vim to "vim -T xterm-sc", and it should work.

| $ case $TERM in screen*) alias vim='TERM=xterm-sc vim';; esac
| $ vim


Bye!    Alain.
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]