Add file renaming script
This commit is contained in:
parent
44dfd38077
commit
9ef5736174
35
bin/rename_for_shell.sh
Executable file
35
bin/rename_for_shell.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
print_help() {
|
||||
cat <<HELP
|
||||
Converts a given file name to something more sensible
|
||||
|
||||
USAGE: $(basename "$0") <file-name>
|
||||
|
||||
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
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -302,6 +302,7 @@ nnoremap <space>; :fdmvcursor<cr>
|
|||
" ===================================================================
|
||||
" 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
|
||||
|
|
Loading…
Reference in a new issue