summaryrefslogtreecommitdiff
path: root/.aliases
diff options
context:
space:
mode:
Diffstat (limited to '.aliases')
-rw-r--r--.aliases52
1 files changed, 40 insertions, 12 deletions
diff --git a/.aliases b/.aliases
index d08daf2..a68442a 100644
--- a/.aliases
+++ b/.aliases
@@ -12,7 +12,7 @@ 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 --mouse --quit-if-one-screen --ignore-case --LINE-NUMBERS"
+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"
@@ -22,34 +22,50 @@ 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 sudo="doas"
+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 "$1" in
+ case "$@" in
+ *.d64|*.prg)
+ i3-swallow && x64 "$1" && i3-unswallow
+ ;;
*.wad|*.WAD)
- crispy-doom -iwad "$1" &
+ i3-swallow && crispy-doom -iwad "$1" && i3-unswallow
;;
- *.pdf|*.epub|*.xhtml|*.xps)
- mupdf "$1"
+ *.PDF|*.pdf|*.epub|*.xhtml|*.xps)
+ i3-swallow && mupdf "$@" && i3-unswallow
;;
*.jpg|*.png|*.bmp|*.gif|*.jpeg|*.JPG|*.JPEG|*.webp|*.tiff)
- find "$(dirname $1)" -type f -depth 1 -exec sxiv -a "$1" "{}" + 2>/dev/null &
+ i3-swallow && sxiv -a "$(dirname $1)" "$@" && i3-unswallow
;;
*.xcf)
- gimp "$1" 2>/dev/null &
+ gimp "$@" 2>/dev/null &
;;
*.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og|*.ogagx|*.spx|*.opus)
- mpv --no-video "$1" 2>/dev/null
+ mpv --no-video "$@" 2>/dev/null
;;
*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.qt|*.divx)
- mpv "$1" 2>/dev/null &
+ i3-swallow && mpv "$@" && i3-unswallow
;;
*.html|*.htm)
- $BROWSER "$1" 2>/dev/null &
+ $BROWSER "$@" 2>/dev/null &
;;
*.zip|*.jar|*.war|*.7z|*.7zip|*.tar|*.tar.gz|*.tgz|*.tar.xz|*.xz|*.txz|*.iso)
tar -xvf "$1"
@@ -58,7 +74,7 @@ function o() {
sc-im "$1"
;;
*.lcd|*.ldr|*.mpd)
- leocad "$1"
+ leocad "$@"
;;
*)
[ -f "$1" ] && less "$1" || echo Unsure what to do...
@@ -89,3 +105,15 @@ theme_reset() {
wpg -s "$(wpg -c)"
}
+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
+}