ZSH Command History: Cursor at the end of the line!

About five or so years ago, Debian decided to mess with their ZSH package. One of the things that changed is the cursor location when browsing your command history. On every other OS, when you browse your command history, whether in vi mode (viins or vicmd) or in emacs mode, the cursor always goes to the end of the command. Debian decided to change it so that it goes to the beginning of the line. WTF!

This isn’t a huge change, but when you are going back and forth between systems all day and the same action has different results, it can get pretty infuriating. There was really no need to change this whatsoever. Unfortunately, the stance they have is:

tag 383737 + wontfix

Unfortunately this boils down to a binary division in a fundamental belief,
and either way people are unhappy.

Essentially, they decided to make the change to be non-compliant with the rest of the ZSH community, and then call it a binary division as an excuse for their change. Nice.

The issue manifested because they decided to put values in the global /etc/zsh/zshrc which causes this behavior. There’s horrible hacks you can do in your personal .zshrc to sort of fix the functionality, or if you have sudo on the box you can change the behavior for everyone by altering the global rc file. However, there is a much easier way shown to me by zi. I hadn’t seen this solution anywhere I searched so I thought I’d write it up for anyone who wants a clean fix:

% echo 'unsetopt global_rcs' >> ~/.zprofile

Fixed! You’ll have to invoke a new shell for this to take effect of course. What this does is it tells ZSH to ignore the global rc file before loading your own. The only drawback from this is that if there are any specific things from the global rc file that you wanted, you’ll have to copy them into your own. Is it a pain that we have to do this at all just because Debian wants to be different? Sure. But it’s a few extra seconds tacked onto copying your own .zshrc file to the machine that I am more than happy to take to get ZSH behaving like it should!

Determining the Right CND Tool for a Job

Throughout the day a SOC team uses dozens of tools to complete tasks in a few minutes that would normally take much longer. Tools improve...… Continue reading

CRITs Authentication

Published on June 24, 2014

CRITs: Collaborative Research Into Threats

Published on June 18, 2014