You are not logged in.
Pages: 1
Topic closed
So I'm playing with st and I like it a lot, but there's something that's really driving me crazy
The Backspace key works as expected, but what should I do to make the Delete key delete forward? By default it doesn't do anything.
I've already read this, this and this, and I've tried many of the solutions offered. At best they make the Delete key delete backwards, like it was the Backspace key. At worst they cause both keys to either do nothing or print out stuff like "^H", "^?" or "[[P"
I've found a fix for Emacs (set 'normal-erase-is-backspace' to 't'), but no such luck with bash itself (I've also tried zsh, fish, mksh and tcsh just in case it was bash-specific; looks like it's not!) or other terminal programs. Is anyone else here having the same problem?
Offline
Have you seen this, this and have you tried using "stty lnext ^V"?
What's the output of "stty -a"?
I don't know what your preferred shell is but this works for me on zsh:
Add to your .zshrc:
typeset -A key
key[Delete]=${terminfo[kdch1]}
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
And make sure that stty -a contains:
lnext = ^V;
EDIT: In short: erase is the behavior you expect from backspace, lnext is the behavior you expect from delete. See "man stty" for details.
Last edited by Steef435 (2014-09-02 10:27:38)
Offline
$ stty -a
speed 38400 baud; rows 53; columns 170; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
Looks like "lnext" is already set to "^V".
Usually I use bash, but I've just tried zsh with a .zshrc including what you suggested. Still no luck.
And the weird thing is, in zsh (and only in zsh) the Home key doesn't work either, the End, PgUp and PgDown keys print out "~" and the Insert key prints out "h". Not sure if this could be some sort of clue about what the problem could be
Last edited by megadriver (2014-09-02 11:19:01)
Offline
AFAIK that's normal, the wiki explains how to let them work as expected.
Have you seen "Why doesn't the Del key work in some applications?" on the st homepage?
Last edited by Steef435 (2014-09-02 12:11:50)
Offline
Yes. I've tried to put "set enable-keypad on" in .inputrc. I've also tried 'printf "\033?1h\033=" >/dev/tty' and 'echo $(tput smkx) >/dev/tty'. But all these just make the Delete key act like the Backspace key (delete backwards)
Offline
My knowledge of terminal emulators ends here I'm afraid. Hopefully someone else can help you out.
If you're using the git version, did you already try if the same happens with the stable version, or the other way around?
Offline
Offline
I'm having this same issue... can you tell me how exactly did you solved it?
EDIT Nevermind! I found this:
https://github.com/jceb/st-patches/blob … _key.patch
Is yours?
Last edited by pablox (2015-02-13 20:08:29)
Geeks & Linux Atelier
An eye for an eye ... ends in making everybody blind -- Mahatma Gandhi
dotfiles
Offline
I used
{ XK_Delete, XK_ANY_MOD, "\033[C\177", +1, 0, 0},
This basically moves the cursor once to the right and then it deletes. I know it is a little hacky, but *shrug* I actually kind of like it. You should note that if the cursor is at the end of the line, then it deletes the last character on that line.
cheers
Last edited by dylnmc (2017-06-05 03:26:17)
Offline
Thanks for sharing. I'm going to go ahead and close this old thread now.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed