ZSH bindings behave strangely out of the box

I’ve installed the latest Archlabs last night and haven’t modified anything thus far.
First of all, i do love how everything looks and is set up out of the box.

I am however experiencing some strange behavior. Whilst in ZSH i cannot use Ctrl+R, Home, End, Page Up/Down. Home and End just print the letter H a F on a new line. And page up/down change the case of the character that the cursor is on. Just like Ctrl left and right don’t seem to be working. I’m just using the preinstalled Xfce terminal. I did also try to use gnome-terminal. But same problem there. Also going alt+f1 where TERM=linux doesnt work. I’m not experiencing this issue in VIM or when i switch to bash. So i suspect the issue lies somewhere within ZSH. I’d like to keep using ZSH (although i’m new to it) but this isn’t very workable and judging by the configs that are located in .zsh/ this behavior isn’t intentional.

I’ve tried to read my share of stackoverflow questions and i searched around the forum but i couldn’t’ find an answer to this particular question, especially since i haven’t changed anything out of the box.

Thanks for the help in advance.

See this thread Zsh, rxvt-unicode & escape sequences

Note that keys like <Ctrl-Arrow> and <Ctrl-r> are non-standard and can differ depending on the terminal, shell, and shell bindings.

The Ctrl-arrow keys aren’t bound by us, I believe Ctrl-r depends on which editing mode your in, for emacs mode I think it’s reverse search, in vi mode insert I think it’s the same and in normal it’s redo. I might be wrong there, see ~/.zsh/settings/bindings.zsh

In the future, the shell configs are getting simplified. A large portion of it is to suit my taste but most people just find it more confusing and unnecessary than helpful.

I should also point out that we’re using Vi mode by default so if your using Ctrl-Arrow to word jump you should be using b and w in normal mode. Otherwise set bindkey -e for the traditional shell environment (emacs binds)

It is also worth noting that the only reason they do work in bash is I specifically bound the escape sequences for ctrl-left/right as well as some other keys, see ~/.inputrc. These aren’t used in zsh because it has its own line editor (zle) instead of readline like many others. In the zsh setup I’m assuming terminfo support which is detailed further in the thread linked above.

1 Like

So you are the one I have to thank for the cool vimrc? Working on my own right now at the moment, but it was good for the start. Btw, since when are you using vi-mode in zsh? Because installed my archlabs setup in November and added that one by myself. Could be, that I just did not search for it and did it anyways.

Edit: In my November installation there is in fact no vi-mode set and I had to add that myself.


Yea you’re correct, prior to the christmas 2018 release we didn’t include any real shell configuration outside of some basic stuff.

I think we’ll be moving back to a slightly “less-intrusive” setup while still offer some nice defaults. I’ve personally tweaked my shell over time, and thats where most of the additions come from, I really never intended for people to use them stock but instead tweak and edit to their liking, glad to see someone is making them their own.

Re: the vimrc, yea that was also me… :stuck_out_tongue:

I chose some bits and pieces that I thought would be useful to others, if your looking to pilfer some more vim goodness you can see my whole (n)vim configuration here

Ok, now I am impressed. That is a pretty long vimrc. And I see you are using neovim? Any reason for that? I am pretty new to the vi space, but I have looked it up and saw no real reason why I should use nvim instead.

No real reason, I started using it years ago before vim integrated many of the changes.

They’re nearly interchangable now though, neovim definitely has better terminal support, and I still prefer some internal functions and defaults that many people don’t care about.

If your interested, look at the difference in termopen() nvim and term_start() vim… In short, yea they both do the same thing, but as a plugin writer (and just my opinion) one is much nicer to use.

Thanks for the reply, i think after seeing the bindings.zsh file i’ll just teach myself to use those instead. I had a try in a bash shell and things like ctrl+p/ctrl+n seem to work there too, probably obvious to a seasoned linux user but i never knew that, ive always just used the arrow keys.

Feels like its better for me to know whats default behaviour and then maybe tweak it to something i prefer than doing it the other way around. So thanks for the insight

1 Like

Let me chime in here as I had to do a reinstall yesterday (newest install-medium).
I now have the same issues as the OP. Main issue is the non-functioning delete-key.

I have no idea what could be wrong because everything I have checked based on suggestions in this thread, the above linked thread, the arch wiki, etc, looks absolutely fine! I have the same issue in termite and st as well so for me this is highly suspect of a zsh issue. The (out of the box) ~/.zsh/** config files seem to be in order, though. localectl status gives me the previously set locale, keymap and layout. setxkbmap output looks good as well. Terminfo is installed and previously loaded as pre-set in the config files.

edit2: Alright, maybe I have partly figured this out? I added bindkey "^[[3~" delete-char in my bindings.zsh below the #use vi-mode section and reset zsh via exec zsh. Now the delete key works as it’s supposed to. So this has something to do with different modes?

(final) edit 4: I do not know how it took me so long to figure this out but I think I finally did. I knew that there were two “modes” for zsh, one emacs and one vi and that the keybindings probably were not working because of that. But it took me until now to find out how to change those modes: bindkeys -e and bindkeys -v do the trick.

Unimportant edits

edit1: I just read through the zsh section in the st FAQ but the suggested code there is already implemented in the bindings.zsh as well…

edit 3: Man sooo many things have changed with the new install medium!
Also just figured out that you didn’t set the HISTFILE variable in the .zshrc (why not btw, so many other things are preconfigured?). But that is another story.
Back to the topic: in vim, all key commands including Delete, Home, End work. Now I am even more confused.

Yep pretty much, also of note, within vi-mode there is the usual vim modes (normal, visual, insert) and each have their own bindings.

Can also specify the mode with the -M MODE flag and doing something like

bindkey -M viins '^[[3~' delete-char
bindkey -M vicmd '^[[3~' delete-char
bindkey -M emacs '^[[3~' delete-char

# .... etc.