remove bloat

This commit is contained in:
Cy Pokhrel 2024-11-04 10:18:00 -05:00
parent f101a775c2
commit 44f3b94f66

176
zshrc
View file

@ -1,6 +1,3 @@
# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell" ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion. # Uncomment the following line to use case-sensitive completion.
@ -18,35 +15,7 @@ zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to enable command auto-correction. # Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true" # ENABLE_CORRECTION="true"
plugins=(git
archlinux
colored-man-pages
copybuffer
docker
docker-compose
eza
fancy-ctrl-z
git
gitignore
gitfast
golang
python
safe-paste
ssh
sudo
tmux
zsh-syntax-highlighting
)
ZSH_DISABLE_COMPFIX=true ZSH_DISABLE_COMPFIX=true
source $ZSH/oh-my-zsh.sh
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
alias vi=nvim alias vi=nvim
alias vim=nvim alias vim=nvim
@ -90,148 +59,3 @@ export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source <(fzf --zsh) source <(fzf --zsh)
ghcs() {
FUNCNAME="$funcstack[1]"
TARGET="shell"
local GH_DEBUG="$GH_DEBUG"
local GH_HOST="$GH_HOST"
read -r -d '' __USAGE <<-EOF
Wrapper around \`gh copilot suggest\` to suggest a command based on a natural language description of the desired output effort.
Supports executing suggested commands if applicable.
USAGE
$FUNCNAME [flags] <prompt>
FLAGS
-d, --debug Enable debugging
-h, --help Display help usage
--hostname The GitHub host to use for authentication
-t, --target target Target for suggestion; must be shell, gh, git
default: "$TARGET"
EXAMPLES
- Guided experience
$ $FUNCNAME
- Git use cases
$ $FUNCNAME -t git "Undo the most recent local commits"
$ $FUNCNAME -t git "Clean up local branches"
$ $FUNCNAME -t git "Setup LFS for images"
- Working with the GitHub CLI in the terminal
$ $FUNCNAME -t gh "Create pull request"
$ $FUNCNAME -t gh "List pull requests waiting for my review"
$ $FUNCNAME -t gh "Summarize work I have done in issues and pull requests for promotion"
- General use cases
$ $FUNCNAME "Kill processes holding onto deleted files"
$ $FUNCNAME "Test whether there are SSL/TLS issues with github.com"
$ $FUNCNAME "Convert SVG to PNG and resize"
$ $FUNCNAME "Convert MOV to animated PNG"
EOF
local OPT OPTARG OPTIND
while getopts "dht:-:" OPT; do
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG
OPT="${OPTARG%%=*}" # extract long option name
OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty)
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
fi
case "$OPT" in
debug | d)
GH_DEBUG=api
;;
help | h)
echo "$__USAGE"
return 0
;;
hostname)
GH_HOST="$OPTARG"
;;
target | t)
TARGET="$OPTARG"
;;
esac
done
# shift so that $@, $1, etc. refer to the non-option arguments
shift "$((OPTIND-1))"
TMPFILE="$(mktemp -t gh-copilotXXXXXX)"
trap 'rm -f "$TMPFILE"' EXIT
if GH_DEBUG="$GH_DEBUG" GH_HOST="$GH_HOST" gh copilot suggest -t "$TARGET" "$@" --shell-out "$TMPFILE"; then
if [ -s "$TMPFILE" ]; then
FIXED_CMD="$(cat $TMPFILE)"
print -s "$FIXED_CMD"
echo
eval "$FIXED_CMD"
fi
else
return 1
fi
}
ghce() {
FUNCNAME="$funcstack[1]"
local GH_DEBUG="$GH_DEBUG"
local GH_HOST="$GH_HOST"
read -r -d '' __USAGE <<-EOF
Wrapper around \`gh copilot explain\` to explain a given input command in natural language.
USAGE
$FUNCNAME [flags] <command>
FLAGS
-d, --debug Enable debugging
-h, --help Display help usage
--hostname The GitHub host to use for authentication
EXAMPLES
# View disk usage, sorted by size
$ $FUNCNAME 'du -sh | sort -h'
# View git repository history as text graphical representation
$ $FUNCNAME 'git log --oneline --graph --decorate --all'
# Remove binary objects larger than 50 megabytes from git history
$ $FUNCNAME 'bfg --strip-blobs-bigger-than 50M'
EOF
local OPT OPTARG OPTIND
while getopts "dh-:" OPT; do
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG
OPT="${OPTARG%%=*}" # extract long option name
OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty)
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
fi
case "$OPT" in
debug | d)
GH_DEBUG=api
;;
help | h)
echo "$__USAGE"
return 0
;;
hostname)
GH_HOST="$OPTARG"
;;
esac
done
# shift so that $@, $1, etc. refer to the non-option arguments
shift "$((OPTIND-1))"
GH_DEBUG="$GH_DEBUG" GH_HOST="$GH_HOST" gh copilot explain "$@"
}