summaryrefslogtreecommitdiff
path: root/.aliases
blob: 84427d9c994f66fa14907aa6dfdcdae7dd1ae2a6 (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Aliases

alias monero-wallet-cli='monero-wallet-cli --config-file=/home/atc/.config/bitmonero/monero-wallet-cli.conf '
alias cp="cp -i"
alias dd="dd status=progress"
alias define="dict -d gcide"
alias df="df -h"
alias du="du -h -c"
alias e="$EDITOR"
alias ffmpeg="ffmpeg -hide_banner"
alias ffprobe="ffprobe -hide_banner"
alias g="git status -s"
alias gg="git add -A && git commit ; git push"
alias grep="grep --color -i"
alias l="ls"
alias less="less --long-prompt --mouse --quit-if-one-screen --ignore-case --LINE-NUMBERS"
alias lightgtk="GTK2_RC_FILES= GTK_DATA_PREFIX= GTK_THEME=Adwaita"
alias ll="ls -lahGF"
alias ln="ln -v"
alias lr="ls -R"
alias ls="ls -GF"
alias noprompt="PROMPT= RPROMPT= "
alias q="ls|grep"
alias qq="find .|grep"
alias sigil="crispy-doom -iwad ~/games/doom/DOOM.WAD -file ~/games/doom/SIGIL_v1_21/SIGIL_COMPAT_v1_21.wad"
alias doas="doas "
alias sudo="doas "
alias synonym="dict -d moby-thesaurus"
alias tar="tar -v"

# Useful functions

function i3-swallow() {
	i3-msg -q "mark swallowed$$"
	i3-msg -q "[con_mark=\"swallowed$$\"] split toggle"
	i3-msg -q "[con_mark=\"swallowed$$\"] layout tabbed"
}

function i3-unswallow() {
	i3-msg -q "[con_mark=\"swallowed$$\"] layout default"
	i3-msg -q "[con_mark=\"swallowed$$\"] split toggle"
	i3-msg -q "unmark swallowed$$"
}

function o() {
	case "$@" in 
		*.d64|*.prg)
			i3-swallow && x64 "$1" && i3-unswallow
			;;
		*.wad|*.WAD)
			i3-swallow && crispy-doom -iwad "$1" && i3-unswallow
			;;
		*.PDF|*.pdf|*.epub|*.xhtml|*.xps)
			i3-swallow && mupdf "$@" && i3-unswallow
			;;
		*.jpg|*.png|*.bmp|*.gif|*.jpeg|*.JPG|*.JPEG|*.webp|*.tiff)
			i3-swallow && sxiv -a "$@" "$(dirname $1)" && i3-unswallow
			;;
		*.xcf)
			gimp "$@" 2>/dev/null &
			;;
		*.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og|*.ogagx|*.spx|*.opus)
			mpv --no-video "$@" 2>/dev/null
			;;
		*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.qt|*.divx)
			i3-swallow && mpv "$@" && i3-unswallow
			;;
		*.html|*.htm)
			$BROWSER "$@" 2>/dev/null &
			;;
		*.zip|*.jar|*.war|*.7z|*.7zip|*.tar|*.tar.gz|*.tgz|*.tar.xz|*.xz|*.txz|*.iso)
			tar -xvf "$1"
			;;
		*.xls|*.xlsx|*.csv)
			sc-im "$1"
			;;
		*.lcd|*.ldr|*.mpd)
			leocad "$@"
			;;
		*)
			[ -f "$1" ] && less "$1" || echo Unsure what to do...
			;;
	esac
}

bak() {
	mv -n "$1" "$1".bak
}

rename() {
	# Reads filenames from args, uses vim to generate their new filenames, and then mv's them.
	src="$(mktemp -t rename)"
	dst="$(mktemp -t rename)"
	printf '%s\n' "$@" | tee "$src" > "$dst"
	$EDITOR "$dst"
	diff -s "$src" "$dst" > /dev/null || paste "$src" "$dst" | sed -e "s/\t/' '/" -e "s/^/mv -i '/" -e "s/$/'/" | sh 
}