FreeBSD console broken?

2

It seems my FreeBSD console is misconfigured (i guess). I cannot use home or end buttons in command line (it prints ~), and in vi left arrow is switching me from edit to command mode, which makes editing a little difficult. How can I know what's wrong and fix it?

I'm not a root, by the way, I just hope it's something with my profile or bash configuration.

Shell version: GNU bash, version 4.0.35(0)-release (i386-portbld-freebsd8.0)

UPD: fixed home and end keys in console by creating ~/.inputrc and pasting this:

"\e[3~": delete-char
# this is actually equivalent to "\C-?": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H":beginning-of-line
"\e[F":end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~":beginning-of-line
"\e[8~":end-of-line
"\e[1;5C": forward-word     # Ctrl+right  => forward word
"\e[1;5D": backward-word    # Ctrl+left   => backward word

(solution from here)

Still, left arrow in vi bothers me, and I cannot install vim on the machine (maybe it's some vi quirk, idk).

Kuroki Kaze

Posted 2010-05-31T09:22:11.057

Reputation: 301

1Is this locally, or over ssh? – Jeremy Smyth – 2010-05-31T09:34:16.773

Over SSH. Client is NuSphere PHPEd embeded (though I may test with PuTTY). – Kuroki Kaze – 2010-05-31T09:42:28.673

No, PuTTY has the same problems. It must be server. – Kuroki Kaze – 2010-05-31T09:46:33.283

vi does not support arrow keys. When it was written, keyboards had arrows on HJKL keys. – user1686 – 2010-05-31T18:22:05.063

Shouldn't vi use .inputrc stuff? I have another GNU/Linux box where arrows in vi work just fine. – Kuroki Kaze – 2010-06-01T10:17:15.653

@Kuroki: 1) No. inputrc is for readline, and vi uses ncurses. – user1686 – 2010-06-01T20:03:49.423

@Kuroki: 2) That is most likely vim in "vi compatibility mode". (Try :version to check if it is.) – user1686 – 2010-06-01T20:04:52.057

start="2">

  • Ha, you're right. vi is vim in compatibility mode and vim command is not found :)
  • < – Kuroki Kaze – 2010-06-02T09:53:33.947

    Answers

    1

    Fixed by creating .inputrc file (see question update).

    Kuroki Kaze

    Posted 2010-05-31T09:22:11.057

    Reputation: 301

    1

    You may find you can fix it all by doing something like:

    TERM=xterm
    

    ...in your .profile.

    Jeremy Smyth

    Posted 2010-05-31T09:22:11.057

    Reputation: 354

    I checked set and my TERM is already xterm. – Kuroki Kaze – 2010-05-31T09:40:35.870

    Ah, if it's putty, then try the accepted answer to this: http://stackoverflow.com/questions/161676/home-end-keys-in-zsh-dont-work-with-putty

    – Jeremy Smyth – 2010-05-31T09:52:17.093

    I use different clients, not only PuTTY. Still, it seems I partially solved the problem. – Kuroki Kaze – 2010-05-31T10:04:31.107