ZSH bindings behave strangely out of the box


#1

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.


#2

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.


#3

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.


#4

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


#5

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.


#6

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.


#7

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