Can't use CTRL + Arrow in Terminal zsh

I have 3 PCs running KDE Linux, and on two of them I can’t use Ctrl + Left Arrow or Right Arrow to change the cursor when I am in the default zsh terminal. It instead writes 5D or 5C instead of just switching the cursor position. If I switch to bash everything works fine.
I’m not sure if this is the intended behaviour or not but it is really annoying.

The two PCs who have this problem have this file .zshrc :

# This file sets up some sane defaults and a nicer prompt for ZSH.
# Comment out the below line to reset ZSH to its default settings.
source '/usr/share/zsh/plugins/kde-linux-default/kde-linux-default-zshrc.zsh'

The 3rd PC is running bash by default for some reason. If I try to switch to zsh, It doesn’t have any customisation like it is on my other two PCs.

On this PC the .zshrc file looks a lot different. It is 342 lines so I can’t paste it here but it’s mostly commented except for this :

if [ -r ~/.zshrc -a -r ~/.zshrc.global -a ! -r ~/.zshrc.local ] ; then
    printf '-!-\n'
    printf '-!- Looks like you are using the old zshrc layout of grml.\n'
    printf '-!- Please read the notes in the grml-zsh-refcard, being'
    printf '-!- available at: http://grml.org/zsh/\n'
    printf '-!-\n'
    printf '-!- If you just want to get rid of this warning message execute:\n'
    printf '-!-        touch ~/.zshrc.local\n'
    printf '-!-\n'
fi

Is there a way I can fix this issue with the arrows ?
And why is zsh not enabled on this other PC ?

# ======================
# Word navigation
# ======================
bindkey '^[[1;5D' backward-word     # Ctrl+Left
bindkey '^[[1;5C' forward-word      # Ctrl+Right
bindkey '^H' backward-kill-word     # Ctrl+Backspace
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word

I think this might be helpful - but honestly I just tend to use Fish more now.

Are the affected systems fully up-to-date? rg VERSION_ID /etc/os-release should list a date in 2026.

If they’re up-to-date, on those systems, what’s the output of diff /usr/share/factory/etc/zsh/zshrc /etc/zsh/zshrc?

All the PCs I have are on 2026-01-22.

There’s no difference between those two files for all the PCs, including the one which is not using zsh.

Thank you, adding this to .zshrc fix the issue with word navigation.

I think it would be a lot better if it was by default @ngraham

1 Like

That would be an issue for the zsh developers or the packager of zsh for you distro, not kde.

I use KDE Linux, the distro

Indeed, it could be a good idea to submit the config snippet from Can't use CTRL + Arrow in Terminal zsh - #2 by ben2talk to mkosi.extra/usr/share/zsh/plugins/kde-linux-default/kde-linux-default-zshrc.zsh · master · KDE Linux / KDE Linux · GitLab

Would you like to do so? This would be a great first contribution!

1 Like

Yes, I’ll try to get this done tomorrow.

1 Like

Can setopt interactivecomments also be added to zshrc? If not every time I paste comment lines starting with # I get

KDE Linux does not include the “#” command.

If you know it exists, and it's important for your workflow, learn about options for getting it at
https://community.kde.org/KDE_Linux/Install_software_not_available_in_Discover#Software_not_listed_above