diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-07 18:16:05 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-07 18:16:05 +0900 |
| commit | 5ff02959d3069923bca63cb54c4bb246b86bf20d (patch) | |
| tree | 7ef1b56fb85a48c563bb3af51c26f181741282be /fedora/.config/shell/scripts.bash | |
| parent | f65fe7591c18d6c8f4ecac5f379407a910aba1bc (diff) | |
deleted .gnupg/gpg-agent.conf, created .gnupg/, created .config/, created .local/, created .gnupg/
Diffstat (limited to 'fedora/.config/shell/scripts.bash')
| -rw-r--r-- | fedora/.config/shell/scripts.bash | 54 |
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' |
