List of zsh bindkey commands

bindkey -l will give you a list of existing keymap names. bindkey -M <keymap> will list all the bindings in a given keymap. If you use the zsh command line in emacs mode, then the emacs keymap is likely to be most important for you. If you use it in vi mode, then you’d be … Read more

brew installation for zsh?

This worked for me on macOS ARM (Apple M1): /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)” and then: export PATH=”/opt/homebrew/bin:$PATH” >> ~/.zshrc

oh my zsh showing weird character ‘?’ on terminal

Installing a powerline patched font will solve this. This official documentation provides description about installing poweline fonts. There are two ways to enable powerline patched font in iTerm2. Set a powerline patched font as default. Set a powerline patched font for only Non-ASCII characters and use another font for code. Bonus: Collection of powerline patched … Read more

Zsh wants to autocorrect a command, with an _ before it

This is command autocorrection, activated by the correct option. It has nothing to do with completion. You’re seeing _ruby because zsh thinks there is no ruby command and it offers _ruby as the nearest existing match. If you’ve just installed ruby, it’s possible that zsh has memorized the list of available command earlier, and it … Read more

How to remove an entry from the history in ZSH

*BSD/Darwin (macOS): LC_ALL=C sed -i ” ‘/porn/d’ $HISTFILE Linux (GNU sed): LC_ALL=C sed -i ‘/porn/d’ $HISTFILE This will remove all lines matching “porn” from your $HISTFILE. With setopt HIST_IGNORE_SPACE, you can prepend the above command with a space character to prevent it from being written to $HISTFILE. As Tim pointed out in his comment below, … Read more

What does autoload do in zsh?

The autoload feature is not available in bash, but it is in ksh (korn shell) and zsh. On zsh see man zshbuiltins. Functions are called in the same way as any other command. There can be a name conflict between a program and a function. What autoload does is to mark that name as being … Read more