summaryrefslogtreecommitdiff
path: root/.config/shell/aliasrc
blob: 361da2ee79f2e93a0c668156ccd2a17f237a5959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh

# vim selection
command -v nvim >/dev/null 2>&1 && alias vim="nvim" vimdiff="nvim -d" vi="nvim"

# verbosity
alias cp="cp -iv"
alias mv="mv -iv"
alias rm="rm -iv"
alias mkdir="mkdir -pv"

# always use color when available
# exa (exa) instead of ls when available
if command -v eza >/dev/null 2>&1; then
	alias ls="eza -aH --color=automatic --group-directories-first --git"
	alias ll="ls -l"
	alias lt="ls -TL 6"
else
	alias ls="ls -Ah --color=always --group-directories-first"
	alias ll="ls -l"
	alias lll="ls -ltr"
fi

alias grep="grep --color=auto"
alias diff="diff --color=auto"

#
# git related
#
# base
alias gs="git status"
alias gf="git fetch --all --prune"

# add
alias ga="git add"
alias gap="git -c interactive.diffFilter='git diff --color=always --word-diff' add -p"

# commit
alias gc="git commit"
alias gca="gc --amend"
alias gcane="gca --no-edit"

# log
alias gl="git log --graph --all"
alias glol="git log --graph --decorate --pretty=oneline --abbrev-commit"
alias glola="glol --all"

# diff
alias gd="git diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'"
alias gds="gd --staged"
# not really helpful
# alias gd="git diff --color-words=."

# dotfiles bare repository management
# shellcheck disable=SC2139
alias dots="/usr/bin/git --git-dir=$HOME/.mdots/ --work-tree=$HOME"