diff --git a/functions.zsh b/functions.zsh index bbcf18c..8d576f0 100755 --- a/functions.zsh +++ b/functions.zsh @@ -280,6 +280,11 @@ git-fixup() { git -c sequence.editor=true rebase --interactive --autosquash $1^ } +compdef __git_branch_names git-diff-branch +git-diff-branch() { + git diff $@ +} + if command -v pacman &>/dev/null ; then compdef _pacman_completions_installed_packages pacbins pacbins() { @@ -294,7 +299,33 @@ then } fi -# dotfiles user functions -if [[ -f $HOME/.dotfiles_functions ]]; then - source "$HOME/.dotfiles_functions" +if command -v fzf &>/dev/null ; then + compdef _fzf_complete + falias() { + alias | fzf $@ | cut -d= -f 1 + } fi + +make_backup() { + name="$1" + backup_name="backup_$1_$(date +%Y-%m-%d).tar.gz" + echo "Backing up to $backup_name" + tar -czf "$backup_name" "$1" + echo "done" +} + +make_venv(){ + python -m venv .venv && echo "created venv: .venv" + + read -q source_venv + + if [[ $source_venv == "y" ]]; then + source .venv/bin/activate && echo "sourced venv" + fi + +} + +# # dotfiles user functions +# if [[ -f $HOME/.dotfiles_functions ]]; then +# source "$HOME/.dotfiles_functions" +# fi