Skip to content

Instantly share code, notes, and snippets.

@eramdam
Last active August 20, 2018 22:59
Show Gist options
  • Save eramdam/1f8be93dbd3dc6c61c1d25289b176201 to your computer and use it in GitHub Desktop.
Save eramdam/1f8be93dbd3dc6c61c1d25289b176201 to your computer and use it in GitHub Desktop.
Get A Nice iTerm2/zsh Config With These Easy Tricks! (random emoji goodness)
# Load the `emoji` plugin
plugins=(... emoji)
# ...
# source oh-my-zsh and whatnots
# ....
# Set a session emoji
session_emoji=`random_emoji fruits`
# Change the window/tab title with current path + session's emoji
precmd () {
tab_label=${PWD/${HOME}/\~} # use 'relative' path
# Here I chose to have the emoji on tab/panes titles but you can add it to the window's title as well!
echo -ne "\e]2;${tab_label}\a" # set window title to full string
# set tab title to rightmost 24 characters + the emoji for quick way to spot
echo -ne "\e]1;${session_emoji} ${tab_label: -24}\a"
}
# Clear the title
title() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment