Integrate file renaming script to vifm

This commit is contained in:
Akemi Izuko 2023-12-23 20:14:04 -07:00
parent 2227a08131
commit 99c1e1519f
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
4 changed files with 16 additions and 9 deletions

View file

@ -22,7 +22,7 @@ else
if (!length(name) && c == "-")
continue;
else if (c ~ /[0-9A-Za-z_.-\/]/)
else if (c ~ /[0-9A-Za-z_.\-\/]/)
name = name c
else if (c == " ")
name = name "_"

View file

@ -16,7 +16,7 @@ requires_gui_error() {
}
open_pdf() {
zathura "$1" &
zathura "$1" &>/dev/null &
}
open_image() {

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
declare newname
newname="$(~/.configs_pointer/bin/rename_for_shell.sh "$@")"
if [[ $? -eq 0 ]]; then
if ! ~/.configs_pointer/bin/rename_and_move.sh "$@"; then
exit 1
fi
printf '%s' "$newname"
else
exit 2
fi

View file

@ -39,10 +39,8 @@ nnoremap s :sort<cr>
nnoremap <C-l> :!/usr/bin/env IS_VIFM_NEST='T' bash -l<cr>
nnoremap <C-f> :!/usr/bin/env IS_VIFM_NEST='T' bash -l<cr>
" Open cwd in finder
nnoremap <space>ofinder :!open .<cr>
nnoremap <space>ogadd :!git add %c<cr>
" Rename file/dir under cursor to unix standards Ore[name]
nnoremap <space>ore :exe 'goto "'.system("~/.configs_pointer/vifm/scripts/vifm_rename_and_move_file.sh ".expand('%c')).'"'<cr>
" Logical conflict mappings
" Navigate back from symlinks
@ -149,9 +147,6 @@ nnoremap <space>m :sync %d<cr><space>
"nnoremap <C-d> 6j
"vnoremap <C-d> 6j
nnoremap <space>orestore :!git restore %c<cr>
nnoremap <space>oadd :!git add %c<cr>
" Make and navigate to a directory in the other pane
command! cddir :sync! | exe 'wincmd w' | mkdir "%d/%a" | cd "%d/%a" | exe 'wincmd w'