mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-22 15:21:30 +01:00
zsh: add new functions: git-diff-branch, falias, make_backup, make_venv
This commit is contained in:
parent
c6d444c709
commit
43426f7ac5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user