homes/common/.config/xonsh/rc_common_aliases.xsh
2023-10-02 00:57:35 +02:00

107 lines
2.7 KiB
Text
Executable file

#!/usr/bin/env xonsh
aliases["diff"] = "colordiff"
aliases["gitci"] = "git commit -S"
aliases["gitcia"] = "git commit -Sa"
aliases["gitco"] = "git checkout"
aliases["gitdiff"] = "git diff"
aliases["gitgrep"] = "git grep"
aliases["gitlog"] = "git log --name-status"
aliases["gitlstags"] = "git describe --tags"
aliases["gittag"] = "git tag -a"
aliases["gittree"] = "git log --graph"
aliases["gitw"] = "git instaweb --httpd=webrick"
aliases["l"] = "ls --color -pa"
aliases["less"] = "nvimpager"
aliases["lg"] = "lazygit"
aliases["ll"] = "ls --color -pla"
aliases["ls"] = "ls --color -p"
aliases["lzd"] = "lazydocker"
aliases["make"] = "colormake"
aliases["mbsync"] = "mbsync -c ~/.config/mbsync/mbsyncrc"
aliases["more"] = "nvimpager"
aliases["tig"] = "TERM=tmux-256color tig"
aliases["txor"] = "tmuxinator"
aliases["vim"] = "lvim -p"
aliases["vimdiff"] = "lvim -d -o"
def _gitgrephistory(args):
if len(args) == 1:
git rev-list --all | xargs git grep @(args[1])
else:
git rev-list --all | sed 's!$!:'@('"' + args[0] + '"')'!' | xargs git grep @(' '.join(args[1:]))
aliases["gitgrephistory"] = _gitgrephistory
def _gitpr(args):
"""git pull rebase and update modules"""
git pull --stat --progress --rebase @(' '.join(args))
git submodule update
aliases["gitpr"] = _gitpr
def _gitprp(args):
"""
git pull, rebase, update modules and push
"""
git pull --stat --progress --rebase @(' '.join(args))
git submodule update
git push
aliases["gitprp"] = _gitprp
def _gitprst(args):
"""
git stash, pull, rebase, update modules and apply stash
"""
git stash
git pull --stat --progress --rebase @(' '.join(args))
git submodule update
git stash apply
aliases["gitprst"] = _gitprst
def _gitprstp(args):
"""
git stash, pull, rebase, update modules, apply stash and push
"""
git stash
git pull --stat --progress --rebase @(' '.join(args))
git submodule update
git stash apply
git push
aliases["gitprstp"] = _gitprstp
def _gitpull(args):
"""
git pull and update submodules
"""
git pull --stat --progress @(' '.join(args))
git submodule update
aliases["gitpull"] = _gitpull
def _gitst(args):
"""
git status
"""
git status @(' '.join(args)) | nvimpager
aliases["gitst"] = _gitst
def _pip_upgrade(args):
"""
Upgrade python user-installed packaged
"""
pip freeze --user | cut -d'=' -f1 | xargs -n1 pip install -U --user @(' '.join(args))
aliases["pip_upgrade"] = _pip_upgrade
def _pip_upgrade_venv(args):
"""
Upgrade virtualenv
"""
pip freeze | cut -d'=' -f1 | xargs -n1 pip install -U @(' '.join(args))
aliases["pip_upgrade_venv"] = _pip_upgrade_venv