Skip to content

Instantly share code, notes, and snippets.

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@romkatv
romkatv / two-line-prompt.zsh
Last active February 17, 2024 11:00
Two-line ZSH prompt
# Example of two-line ZSH prompt with four components.
#
# top-left top-right
# bottom-left bottom-right
#
# Components can be customized by editing set-prompt function.
#
# Installation:
#
# (cd && curl -fsSLO https://gist.githubusercontent.com/romkatv/2a107ef9314f0d5f76563725b42f7cab/raw/two-line-prompt.zsh)
anonymous
anonymous / zsh-git-info.zsh
Created February 14, 2016 18:24
Provide git repository info in a configurable format
# # Provide git repository info in a configurable format
#
# All information is collected by a single git command and parsed in pure zsh
# with no external tools (sed, grep, cut, etc).
#
#
# ## What it looks like
#
# #1+2-3↪4&5 ↑6↓7 ⚡8 master
# | | | | | | | | |