LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-21-2014, 03:21 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
Striking End key within vim prints 'F' (GUI terminal).


Slackware 14.0-32

Hi: from within a virtual console (the consoles given the user just after booting slackware), if I run vim and press the End key the result is the same as pressing $ in command mode (cursor goes to end of line). The same sequence of events started from a GUI terminal gets an 'F' printed. I tried this escape sequence in ~/.inputrc:
Code:
"\e[4~": end-of-line           # End key
but the shell does not even read that file when I start a terminal in the GUI. Any known solution, assuming this is a problem? Does vim read the same init files when running from the GUI as when running from a virtual console?
 
Old 10-21-2014, 03:38 PM   #2
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
If you add this to .bashrc it should read .inputrc:
Code:
export INPUTRC=~/.inputrc
I believe the problem is in the terminfo files, which may be non-existent or poorly written for your particular terminal emulator (but don't quote me on that).
 
Old 10-21-2014, 03:58 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Still printing 'F'. If I say bash does not read ~/.inputrc it's only because writing junk in it I don't get an error when starting a terminal from the GUI, but that's not correct, as opening a virtual console does not give an error either.
 
Old 10-21-2014, 04:23 PM   #4
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
Code:
$ echo $INTUPRC
in the terminal should tell you if the variable was properly exported. If you are using a login shell in X (for shame) then it won't be sourced unless you have something like this in .bash_profile:
Code:
if [ -e ~/.bashrc ]; then
    . .bashrc
fi
If the variable *is* properly exported when you open a new terminal, and it still doesn't work, then I don't know what else to say.

[edit] Actually that line should already be in /etc/inputrc which bash should automatically source...see this thread for more information, and there is another linked thread there. I haven't read it all.

[edit2] If you're getting F printed then the line you want is this one I think:
Code:
"\e[F": end-of-line
...or maybe
Code:
"\eOF": end-of-line
or just
Code:
"\eF": end-of-line
??

Last edited by T3slider; 10-21-2014 at 04:30 PM.
 
Old 10-21-2014, 04:36 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
I wrote a /usr/local/bin/bw.sh:

AUX=$TERM
TERM=linux-m
vim $1
TERM=$AUX

and use alias vim=/usr/local/bin/bw.sh in /etc/profile, so that vim runs with TERM=linux-m (m stands for monochrome) in the GUI. So the stated problem vanishes if I start vim as
Code:
$ \vim
which undoes the alias when running from the GUI. Until I find a more straightforward solution I'll keep using this.

Last edited by stf92; 10-21-2014 at 04:41 PM.
 
Old 10-21-2014, 04:44 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Sorry, I didn't read your post. TERM is set to '/etc/inputrc', where I have the escape sequences, to no avail. But I wrote above what was happening.
 
Old 10-21-2014, 06:22 PM   #7
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
maybe a weird key mapping from X?
What value do you have for keycode and keysym when running xev in gui terminal and pressing the end key?
 
Old 10-21-2014, 07:33 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
115, 0xff57. But the keyboard mapping works at a low level, and the key is trapped by higher level software. Please remember TERM=linux-m is the immediate cause of the problem here.
 
Old 10-21-2014, 08:11 PM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Is it the same with any X terminal, xterm, rxvt, konsole...?
 
Old 10-21-2014, 08:36 PM   #10
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
xterm and konsole have the same problem as described. rxvt works nicely in this respect.
 
Old 10-21-2014, 08:39 PM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Maybe $TERM is set differently in rxvt? try echo $TERM in those x terminals to see
 
Old 10-21-2014, 08:42 PM   #12
ljb643
Member
 
Registered: Nov 2003
Posts: 528

Rep: Reputation: Disabled
Quote:
Originally Posted by stf92 View Post
I wrote a /usr/local/bin/bw.sh:

AUX=$TERM
TERM=linux-m
vim $1
TERM=$AUX

and use alias vim=/usr/local/bin/bw.sh in /etc/profile, so that vim runs with TERM=linux-m (m stands for monochrome) in the GUI. So the stated problem vanishes if I start vim as
Code:
$ \vim
which undoes the alias when running from the GUI. Until I find a more straightforward solution I'll keep using this.
You can't do that. The linux-m terminal type is not compatible with X terminals - it is only for the virtual consoles. The escape sequences are different. For the END key, linux-m tells vim to expect Esc-[4~, but the X terminal is actually sending Esc-OF (that last F is what you are seeing when vim and the libraries don't understand the sequence).
 
Old 10-22-2014, 05:26 AM   #13
phi11ip
Member
 
Registered: Jul 2007
Location: Nottingham, UK
Distribution: Slackware64-current
Posts: 93

Rep: Reputation: 23
Vim doesn't use ~/.inputrc or /etc/inputrc as its initiation file it uses ~/.vimrc. The END key works ok for me in vim (console and gui). Try putting this line in your ~/.vimrc file:-
Code:
nnoremap <END> $
 
Old 10-22-2014, 12:17 PM   #14
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by keefaz View Post
Maybe $TERM is set differently in rxvt? try echo $TERM in those x terminals to see
No, TERM= xterm in rxvt as well as in Terminal 0.4.8 (/usr/bin/Terminal, from the Xfce suite), which is the terminal I use on the GUI.

Trying to see if X is running by script, I wrote
Code:
#!/bin/sh

#### WATCH THE ARGUMENT TO ps IS asdf, NON EXISTING PROCESS.
VAR1="$( /bin/ps -C asdf )"    #VAR1 gets the text output from /bin/ps
echo $VAR1
echo END

# echo outputs to stdout, grep takes input from stdout. Last command
# in the pipe gives ? its exit code.
echo $VAR1 | grep X           

# print grep exit code, 0= 'X' found, 1= 'X' not found, else= error.
echo "exit code= $?"

# So far so well. As asdf is not running, I expect the if echoing 
# 'Xnotrunning'. But it'll output 'Xisrunning'! However the printed
# exit code was 1.
if [ $? -eq 0 ]
then
    echo Xisrunning
else
    echo Xnotrunning
fi
exit
But there is something with the [ xxxx -eq xxxx ] that won't work, as the code above will show. May I ask why

Last edited by stf92; 10-22-2014 at 12:21 PM.
 
Old 10-22-2014, 12:24 PM   #15
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You're testing previous command which is echo "exit code= $?"

Last edited by keefaz; 10-22-2014 at 12:28 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] The Home and End keys in vim under the GUI terminals. stf92 Slackware 9 12-07-2013 07:39 PM
gui read out of back end command lines from gui front end activation? how? Siljrath Linux - General 0 10-24-2008 10:11 AM
vim: rich ("gui") colorschemes in a terminal emulator? prell Linux - Software 13 09-10-2008 10:07 AM
VIM Users: Do you use VIM via console or gui? JMJ_coder Linux - General 48 04-16-2008 03:12 AM
rxvt prints ~ on home/end keypress mpn Linux - General 2 10-17-2004 04:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration