Skip to content

Instantly share code, notes, and snippets.

@nullpixel
Last active December 13, 2023 12:05
Show Gist options
  • Save nullpixel/f740e9373a0ee7f7472cdac9aa26e87b to your computer and use it in GitHub Desktop.
Save nullpixel/f740e9373a0ee7f7472cdac9aa26e87b to your computer and use it in GitHub Desktop.
My zsh configuration & edited dracula theme.
# Path to your oh-my-zsh installation.
export ZSH=/home/null/.oh-my-zsh
# -------------------------------------------------------------------
# General ZSH config
# -------------------------------------------------------------------
ZSH_THEME="dracula"
plugins=(git)
source $ZSH/oh-my-zsh.sh
# -------------------------------------------------------------------
# Git
# -------------------------------------------------------------------
alias ga='git add'
alias gp='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpu='git pull'
alias gcl='git clone'
alias gta='git tag -a -m'
alias gf='git reflog'
# -------------------------------------------------------------------
# Useful Functions
# -------------------------------------------------------------------
# Upload a file to transfer.sh
function transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
# Serve the current folder
alias serve="python -c 'import SimpleHTTPServer; SimpleHTTPServer.test()'"
# Show & Hide hidden files in macOS finder
function hiddenOn() { defaults write com.apple.Finder AppleShowAllFiles YES ; }
function hiddenOff() { defaults write com.apple.Finder AppleShowAllFiles NO ; }
# Get my (public) IP
function pubip() {
echo -n "Current External IP: "
curl icanhazip.com
}
# Get local IPs
function localip() {
ifconfig | grep "inet " | awk '{ print $2 }'
}
# -------------------------------------------------------------------
# User configuration
# -------------------------------------------------------------------
# Setup NVM
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
# I'm a brit, yo.
export LANG=en_GB.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='vim'
fi
# Dracula Theme v1.2.5
#
# https://github.com/dracula/dracula-theme
#
# Copyright 2016, All rights reserved
#
# Code licensed under the MIT license
# http://zenorocha.mit-license.org
#
# @author Zeno Rocha <hi@zenorocha.com>
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
local host_info="%{$fg_bold[magenta]%}"
if [[ "$USER" != "$DEFAULT_USER" ]]; then
host_info+="$USER"
fi
if [[ -n "$SSH_CLIENT" ]]; then
host_info+="@%m"
fi
PROMPT='${host_info} ${ret_status}%{$fg_bold[green]%}%T %{$fg_bold[blue]%}%c $(git_prompt_info)% %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_CLEAN=") %{$fg_bold[green]%}✔ "
ZSH_THEME_GIT_PROMPT_DIRTY=") %{$fg_bold[yellow]%}✗ "
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment