Skip to content

Instantly share code, notes, and snippets.

@secondfry
Last active August 10, 2021 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secondfry/79b702d4530966f337bc2fcfdccd63c2 to your computer and use it in GitHub Desktop.
Save secondfry/79b702d4530966f337bc2fcfdccd63c2 to your computer and use it in GitHub Desktop.
Personal additions to grml zsh config
## Common
export EDITOR='subl -w'
export LC_ALL='en_US.UTF-8'
## ZSH
# Virtualenv support
function virtual_env_prompt () {
REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
}
grml_theme_add_token virtual-env -f virtual_env_prompt '%F{magenta}' '%f'
zstyle :prompt:grml:left:setup items rc virtual-env change-root user at host path vcs percent
# Prompt
prompt grml-large
zstyle :prompt:grml-large:left:setup items jobs history shell-level date time newline user at host path vcs virtual-env newline percent
# Plugins
# git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
[ -e ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh ] && source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# git clone https://github.com/zsh-users/zsh-history-substring-search.git ~/.zsh/zsh-history-substring-search
[ -e ~/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh ] && source ~/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
# git clone https://github.com/lukechilds/zsh-better-npm-completion.git ~/.zsh/zsh-better-npm-completion
[ -e ~/.zsh/zsh-better-npm-completion/zsh-better-npm-completion.plugin.zsh ] && source ~/.zsh/zsh-better-npm-completion/zsh-better-npm-completion.plugin.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
setopt append_history share_history histignorealldups
zstyle ':vcs_info:*' enable git
# warning if file exists ('cat /dev/null > ~/.zshrc')
setopt NO_clobber
# alert me if something failed
setopt printexitvalue
# List all occurrences of programm in current PATH
plap() {
emulate -L zsh
if [[ $# = 0 ]] ; then
echo "Usage: $0 program"
echo "Example: $0 zsh"
echo "Lists all occurrences of program in the current PATH."
else
ls -l ${^path}/*$1*(*N)
fi
}
# Find out which libs define a symbol
lcheck() {
if [[ -n "$1" ]] ; then
nm -go /usr/lib/lib*.a 2>/dev/null | grep ":[[:xdigit:]]\{8\} . .*$1"
else
echo "Usage: lcheck <function>" >&2
fi
}
# print hex value of a number
hex() {
emulate -L zsh
if [[ -n "$1" ]]; then
printf "%x\n" $1
else
print 'Usage: hex <number-to-convert>'
return 1
fi
}
## FZF
# git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
# ~/.fzf/install
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
_fzf_compgen_path() {
git ls-files "$1"
}
## Local bin
export PATH="$PATH:$HOME/bin"
## NVM
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
## Python
export PATH="$PATH:$HOME/Library/Python/3.8/bin:$HOME/Library/Python/2.7/bin"
## Brew
export PATH="$HOME/.brew/bin-overrides:$PATH:$HOME/.brew/bin"
export FPATH="$FPATH:$(brew --prefix)/share/zsh/site-functions"
export HOMEBREW_CACHE="/tmp/$USER/Homebrew/Caches"
export HOMEBREW_TEMP="/tmp/$USER/Homebrew/Temp"
mkdir -p $HOMEBREW_CACHE
mkdir -p $HOMEBREW_TEMP
# brew install nano gcc ripgrep tmux htop
## Jabba
# curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash -s -- --skip-rc && . ~/.jabba/jabba.sh
[ -s "$HOME/.jabba/jabba.sh" ] && source "$HOME/.jabba/jabba.sh"
## macfuse
export PATH="$PATH:/Library/Filesystems/macfuse.fs/Contents/Resources"
## CMake
export PATH="$HOME/Applications/CMake.app/Contents/bin":"$PATH"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# export PATH="$PATH:$HOME/.rvm/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment