Skip to content

Instantly share code, notes, and snippets.

@shikhir-arora
Last active July 21, 2024 19:51
Show Gist options
  • Save shikhir-arora/ff756f7c52ff8530eb70220eb8f2d23a to your computer and use it in GitHub Desktop.
Save shikhir-arora/ff756f7c52ff8530eb70220eb8f2d23a to your computer and use it in GitHub Desktop.
Dotfiles - March 2024 (Antidote)
# Powerlevel10k theme for a beautiful prompt
romkatv/powerlevel10k
# Plugin for command completion suggestions
zsh-users/zsh-completions
# Syntax highlighting for the command line
zdharma-continuum/fast-syntax-highlighting
# Enables smarter navigation of directories
ajeetdsouza/zoxide
# Provides syntax highlighting in the command line
zsh-users/zsh-syntax-highlighting
# Offers suggestions based on command history
zsh-users/zsh-autosuggestions
fpath+=( /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-powerlevel10k )
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-powerlevel10k/powerlevel10k.zsh-theme
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-powerlevel10k/powerlevel9k.zsh-theme
fpath+=( /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions )
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions/zsh-completions.plugin.zsh
fpath+=( /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting )
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
fpath+=( /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ajeetdsouza-SLASH-zoxide )
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ajeetdsouza-SLASH-zoxide/zoxide.plugin.zsh
fpath+=( /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting )
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
fpath+=( /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
source /Users/shikhirarora/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
# Function to source files with error handling
source_with_error_handling() {
source "$1" || true
}
# Initialize Antidote
[ -f ~/.antidote/antidote.zsh ] && source_with_error_handling ~/.antidote/antidote.zsh
# Load the static plugin file generated by Antidote
[ -f ~/.zsh_plugins.zsh ] && source_with_error_handling ~/.zsh_plugins.zsh
# Initialize Homebrew command-not-found handler
HB_CNF_HANDLER="$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh"
[ -f "$HB_CNF_HANDLER" ] && source_with_error_handling "$HB_CNF_HANDLER"
# Enable Powerlevel10k instant prompt
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source_with_error_handling "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Source Powerlevel10k configuration
[[ -f ~/.p10k.zsh ]] && source_with_error_handling ~/.p10k.zsh
# Initialize pyenv
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)" || true
# Misc setup
DEFAULT_USER="shikhirarora"
prompt_context() { }
# Function to remove, edit, and run scripts
rmrun() {
local filename=$1
local extension="${filename##*.}"
local use_sudo="n"
# Prompt check for sudo (rare)
read -p "Do you need to run this script with sudo? (y/n): " use_sudo
# Remove the file if it exists
[ -f "$filename" ] && rm "$filename"
# Open the file in nano
nano "$filename"
# Determine the command to run based on the file extension
case "$extension" in
sh)
chmod +x "$filename"
if [ "$use_sudo" = "y" ]; then
sudo ./"$filename"
else
./"$filename"
fi
;;
py)
if [ "$use_sudo" = "y" ]; then
sudo python3 "$filename"
else
python3 "$filename"
fi
;;
*)
echo "No run command defined for *.$extension files"
;;
esac
}
# Misc Aliases
alias cd="z"
alias Applications="cd /Applications"
alias applications="cd /Applications"
alias disk="sudo du -hsc * | sort -h"
alias python="python3.12"
alias handoff="cd $HOME && ./handoff.sh"
alias dropbox="cd /Users/shikhirarora/Library/CloudStorage/Dropbox-TSGDropbox/Shikhir\ Arora"
# Add directories to PATH
export PATH="/usr/local/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$PATH:/Users/shikhirarora/.local/bin"
# Dropbox directory environment variable
export dropboxcd="/Users/shikhirarora/Library/CloudStorage/Dropbox-TSGDropbox/Shikhir\ Arora"
# Initialize zoxide
eval "$(zoxide init zsh)" || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment