Today I Learned

4 posts about #zsh

Send commands to all panes in iTerm

Problem

I just edited my shell profile (~/.zshrc). Now I need to remember to reload any pane that needs the changes.

Solution

Send commands to all panes:

  1. Cmd + Shift + I
  2. source ~/.zshrc

Magic!

Skip duplicate history entries in zsh

In zsh, pressing UP searches through the history and brings up all matching commands, even if they are duplicates. That means, sometimes you need to press UP many times to actually find a previous match.

However, it is possible to disable this behaviour and skip duplicate entries from the history. To do that, add one line to your ~/.zshrc:
setopt HIST_FIND_NO_DUPS

Mass replace and copy by file extension

Problem

I just cloned a Rails project. There are a bunch of files with the .yml.sample extension under the config directory.

I'd like to copy all those files without the .sample prefix.

Solution

zsh functions to the rescue!

Add this to your .zshrc file:

autoload -U zmv

Then run:

zmv -C 'config/(*.yml).sample' 'config/$1'

By default, zmv will move files. -C puts it in copy mode.

For more info:

man zshcontrib

Oh-My-Zsh Plugins List

I feel like I just discovered the Internet when I look at this page:

https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins