Integrate file renaming script to vifm

This commit is contained in:
Akemi Izuko 2022-12-19 20:19:18 -07:00
parent 9ef5736174
commit 025a2c457e
No known key found for this signature in database
GPG key ID: 905D444F6A5E4BE4
4 changed files with 16 additions and 9 deletions

View file

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

View file

@ -16,7 +16,7 @@ requires_gui_error() {
} }
open_pdf() { open_pdf() {
zathura "$1" & zathura "$1" &>/dev/null &
} }
open_image() { 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-l> :!/usr/bin/env IS_VIFM_NEST='T' bash -l<cr>
nnoremap <C-f> :!/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 " Rename file/dir under cursor to unix standards Ore[name]
nnoremap <space>ofinder :!open .<cr> nnoremap <space>ore :exe 'goto "'.system("~/.configs_pointer/vifm/scripts/vifm_rename_and_move_file.sh ".expand('%c')).'"'<cr>
nnoremap <space>ogadd :!git add %c<cr>
" Logical conflict mappings " Logical conflict mappings
" Navigate back from symlinks " Navigate back from symlinks
@ -149,9 +147,6 @@ nnoremap <space>m :sync %d<cr><space>
"nnoremap <C-d> 6j "nnoremap <C-d> 6j
"vnoremap <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 " 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' command! cddir :sync! | exe 'wincmd w' | mkdir "%d/%a" | cd "%d/%a" | exe 'wincmd w'