Skip to content

Instantly share code, notes, and snippets.

@ForestKatsch
Last active April 25, 2023 03:50
Show Gist options
  • Save ForestKatsch/51bc2865703800c7f0604b9ad1c0fbf7 to your computer and use it in GitHub Desktop.
Save ForestKatsch/51bc2865703800c7f0604b9ad1c0fbf7 to your computer and use it in GitHub Desktop.
Personal zshrc with minimal prompt.
# Forest Katsch's zshrc
# Last updated 2021-01-12
# Make the given directory and cd into it.
function take() {
mkdir -p "$1" && cd "$1"
}
# btw i use emacs
EDITOR=`which emacs`
# Use colors on LS.
# Note: for non-BSD systems, use `ls --color=auto`
alias ls='ls -G'
alias emacs='TERM=xterm emacs'
# The right way to do this is a symlink. But that doesn't fit well in a gist.
alias em='emacs'
# user @ host ~ $
# red green gray normal
PROMPT=$'%F{red}%n%f @ %F{green}%m%f %{\e[38;5;241m%}%~ %f# '
# Change the color to blue if you aren't root.
if [ "$EUID" -ne 0 ]
then PROMPT=$'%F{blue}%n%f @ %F{green}%m%f %{\e[38;5;241m%}%~ %f$ '
fi
# sToRaGe iS cHeAp
HISTFILE=~/.histfile
export HISTSIZE=1000000000
export SAVEHIST=$HISTSIZE
# Honestly I forget what this does. But I didn't add it for no reason, so it stays.
setopt EXTENDED_HISTORY
# Ignore duplicates. Makes it easier to skip past `ls` and `cd`.
setopt HIST_IGNORE_ALL_DUPS
# NO F*CKING BEEPING IN MY HOUSE.
unsetopt beep
bindkey -e
# Uh, this seems to work for me. YMMV. Feel free to replace with a stub function.
func set_title() {
echo -ne "\e]1;${1}\a"
}
# emacs /Users/forest/.ssh/config
preexec() {
set_title "$1 `dirs`"
}
# /Users/forest/.ssh/config
precmd() {
set_title "`dirs`"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment