From 9ef57361749040785fd2e4034e49b89f9effd8c6 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Mon, 19 Dec 2022 19:42:03 -0700 Subject: [PATCH] Add file renaming script --- bin/rename_for_shell.sh | 35 +++++++++++++++++++++++++++++++++++ mpv/input.conf | 1 + sway/config | 3 +++ vifm/vifmrc | 1 + 4 files changed, 40 insertions(+) create mode 100755 bin/rename_for_shell.sh diff --git a/bin/rename_for_shell.sh b/bin/rename_for_shell.sh new file mode 100755 index 0000000..3d2b9ae --- /dev/null +++ b/bin/rename_for_shell.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +print_help() { + cat < + +Removes characters that shouldn't be used in file names. Effectively leaves +/[0-9A-z-_.]/ with a few additional rules (like no leading hyphens) +HELP +} + +if [[ -z "$1" ]]; then + print_help + exit 1 +else + echo "$@" | awk '{ + split($0, a, "") + + for (i in a) { + c=a[i] + + if (!length(name) && c == "-") + continue; + else if (c ~ /[0-9A-Za-z_.-\/]/) + name = name c + else if (c == " ") + name = name "_" + else if (c == ":" || c == ";") + name = name "-" + } + } + + END { print name }' +fi diff --git a/mpv/input.conf b/mpv/input.conf index 0f1f9be..b16ccf4 100644 --- a/mpv/input.conf +++ b/mpv/input.conf @@ -187,6 +187,7 @@ ctrl+q quit ctrl+w quit # E cycle edition # switch edition # l ab-loop # set/clear A-B loop points +A ab-loop # set/clear A-B loop points # L cycle-values loop-file "inf" "no" # toggle infinite looping # ctrl+c quit 4 # DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always diff --git a/sway/config b/sway/config index 0be0694..067b921 100644 --- a/sway/config +++ b/sway/config @@ -361,12 +361,15 @@ mode "mpv_global" { bindsym j exec ~/.config/sway/mpv_keys.sh 'j' bindsym k exec ~/.config/sway/mpv_keys.sh 'k' bindsym l exec ~/.config/sway/mpv_keys.sh 'l' + bindsym Left exec ~/.config/sway/mpv_keys.sh 'LEFT' + bindsym Right exec ~/.config/sway/mpv_keys.sh 'RIGHT' bindsym space exec ~/.config/sway/mpv_keys.sh 'SPACE' bindsym bracketleft exec ~/.config/sway/mpv_keys.sh '[' bindsym bracketright exec ~/.config/sway/mpv_keys.sh ']' bindsym minus exec ~/.config/sway/mpv_keys.sh '-' bindsym equal exec ~/.config/sway/mpv_keys.sh '=' bindsym m exec ~/.config/sway/mpv_keys.sh 'm' + bindsym A exec ~/.config/sway/mpv_keys.sh 'A' bindsym return mode "default" bindsym Ctrl+k mode "default" diff --git a/vifm/vifmrc b/vifm/vifmrc index ffbb686..f3575b4 100644 --- a/vifm/vifmrc +++ b/vifm/vifmrc @@ -302,6 +302,7 @@ nnoremap ; :fdmvcursor " =================================================================== " Directory-local options, see :h vifm-'sort' autocmd DirEnter ~/Downloads setlocal sort=-mtime +autocmd DirEnter /dev/shm setlocal sort=-mtime " Tmux won't work with sixel at all. Alacritty is currently very unstable with " it and flickers a lot. Set $TMUX for blurrier faster version. Quanity on