summaryrefslogtreecommitdiff
path: root/fedora/.config/shell/scripts.bash
diff options
context:
space:
mode:
Diffstat (limited to 'fedora/.config/shell/scripts.bash')
-rw-r--r--fedora/.config/shell/scripts.bash54
1 files changed, 54 insertions, 0 deletions
diff --git a/fedora/.config/shell/scripts.bash b/fedora/.config/shell/scripts.bash
new file mode 100644
index 0000000..f257809
--- /dev/null
+++ b/fedora/.config/shell/scripts.bash
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+###########################################################################################
+###########################################################################################
+### --- COMMAND OUTPUT --- ###
+alias ilco=insert_last_command_output
+insert_last_command_output() {
+ local last_cmd
+ last_cmd=$(history | tail -n 2 | head -n 1 | sed 's/^[ ]*[0-9]\+[ ]*//')
+ eval "$last_cmd"
+}
+
+###########################################################################################
+###########################################################################################
+### --- CREATE --- ###
+alias mc=mkcd
+mkcd() { mkdir -p "$1" && cd "$1" || return; }
+
+mkdt() {
+ mkdir -p "${1:+$1/}$(date +%F)"
+}
+
+###########################################################################################
+###########################################################################################
+### --- PASS --- ###
+pass_otp() { pass otp uri -q "$1"; }
+pass_otp_insert() { pass otp insert "$1"; }
+
+alias cpqr=pass_qr
+pass_qr() { qrencode -o "$1.png" -t png -Sv 40 < "$1.pgp"; }
+
+###########################################################################################
+###########################################################################################
+### --- STOW --- ###
+alias dstw=dotfiles_stw
+dotfiles_stw() {
+ "${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/$(whereami)/.local/bin/stw"
+}
+
+###########################################################################################
+###########################################################################################
+### --- SUDO --- ###
+pre_cmd() {
+ local prepend_command="$1"
+ local buffer="${READLINE_LINE:-}"
+
+ if [ -z "$buffer" ]; then
+ buffer=$(history | tail -n 2 | head -n 1 | sed 's/^[ ]*[0-9]\+[ ]*//')
+ fi
+
+ READLINE_LINE="$prepend_command $buffer"
+ READLINE_POINT=${#READLINE_LINE}
+}
+bind -x '"\es":pre_cmd sudo'