diff --git a/conf.d/20_bindings.fish b/conf.d/20_bindings.fish index 3e49be6..fd882ad 100644 --- a/conf.d/20_bindings.fish +++ b/conf.d/20_bindings.fish @@ -1,5 +1,2 @@ # Key bindings -function fish_user_key_bindings - fzf --fish | source -end \ No newline at end of file diff --git a/functions/ddc.fish b/functions/ddc.fish new file mode 100644 index 0000000..26cd77d --- /dev/null +++ b/functions/ddc.fish @@ -0,0 +1,3 @@ +function ddc --description "dd with progress" + command dd status=progress $argv +end \ No newline at end of file diff --git a/functions/extract.fish b/functions/extract.fish new file mode 100644 index 0000000..683ebcb --- /dev/null +++ b/functions/extract.fish @@ -0,0 +1,55 @@ +function extract --description "Extract common archive formats" + if test (count $argv) -ne 1 + echo "Usage: extract " + return 1 + end + + set -l file $argv[1] + + if not test -f "$file" + echo "File not found: $file" + return 1 + end + + switch "$file" + case "*.tar.bz2" "*.tbz2" + tar -xjf "$file" + + case "*.tar.gz" "*.tgz" + tar -xzf "$file" + + case "*.tar.xz" "*.txz" + tar -xJf "$file" + + case "*.tar.zst" + tar --zstd -xf "$file" + + case "*.tar" + tar -xf "$file" + + case "*.zip" + unzip "$file" + + case "*.7z" + 7z x "$file" + + case "*.rar" + unrar x "$file" + + case "*.gz" + gunzip "$file" + + case "*.bz2" + bunzip2 "$file" + + case "*.xz" + unxz "$file" + + case "*.zst" + unzstd "$file" + + case '*' + echo "Unsupported archive format." + return 1 + end +end \ No newline at end of file diff --git a/functions/fish_user_key_bindings.fish b/functions/fish_user_key_bindings.fish new file mode 100644 index 0000000..3e49be6 --- /dev/null +++ b/functions/fish_user_key_bindings.fish @@ -0,0 +1,5 @@ +# Key bindings + +function fish_user_key_bindings + fzf --fish | source +end \ No newline at end of file diff --git a/functions/indent_python.fish b/functions/indent_python.fish new file mode 100644 index 0000000..3eec1f8 --- /dev/null +++ b/functions/indent_python.fish @@ -0,0 +1,3 @@ +function indent_python --description "Fix Python indentation" + python3 /opt/misc_scripts/fix_indent.py $argv +end \ No newline at end of file diff --git a/functions/mkcd.fish b/functions/mkcd.fish new file mode 100644 index 0000000..11fc286 --- /dev/null +++ b/functions/mkcd.fish @@ -0,0 +1,4 @@ +function mkcd --description "Create a directory and enter it" + mkdir -p $argv + and cd $argv[-1] +end \ No newline at end of file diff --git a/functions/updt.fish b/functions/updt.fish new file mode 100644 index 0000000..5167ba5 --- /dev/null +++ b/functions/updt.fish @@ -0,0 +1,32 @@ +function updt --description "Update the system and common package managers" + sudo apt update + or return + + sudo apt full-upgrade -y + or return + + sudo apt autoremove -y + or return + + sudo apt clean + + if command -q flatpak + flatpak update -y + end + + if command -q snap + sudo snap refresh + end + + if command -q rustup + rustup update + end + + if command -q cargo-install-update + cargo install-update -a + end + + if command -q pipx + pipx upgrade-all + end +end \ No newline at end of file