Browse Source

vim, vifm: pdf renamer

Maxim Likhachev 6 years ago
parent
commit
cbd2badd5f
  1. 2
      etc/soft/vifm/commands
  2. 19
      etc/soft/vim/vim/+ftplugin/rename.vim
  3. 2
      etc/soft/vim/vim/ftdetect/detect.vim
  4. 1
      etc/soft/vim/vim/ftplugin/go/go.custom.vim
  5. 1
      etc/soft/vim/vim/ftplugin/rename/rename.custom.vim

2
etc/soft/vifm/commands

@ -45,3 +45,5 @@ command config :nvim $MYVIFMRC
command z !!zathura %c:p command z !!zathura %c:p
command renamepdf !f() { for f in "$@"; do echo "\"$f\""; done }; cd %d; f %f | viper +'set ft=rename' +"let b:rename_dir=\"$(pwd)\"" | sed "s/^/mv /" | sh

19
etc/soft/vim/vim/+ftplugin/rename.vim

@ -0,0 +1,19 @@
"--------------------------
" Переименование PDF-файлов
"--------------------------
function! PdfTags(findstart, base)
if a:findstart
return col('.') + 1
else
silent let res = map(systemlist("exiftool -Author -Title " .
\b:rename_dir . "/" .
\trim(getline('.')) .
\" 2>&- | cut -d : -f 2- | tr '\n' ' ' | sed 's/ / - /' "),
\"'\"' . trim(v:val) . '.pdf\"'")
return res
endif
endfun
setlocal omnifunc=PdfTags

2
etc/soft/vim/vim/ftdetect/detect.vim

@ -57,3 +57,5 @@ au BufRead,BufNewFile *.note setf note
au BufRead,BufNewFile *.rsc set filetype=rsc au BufRead,BufNewFile *.rsc set filetype=rsc
au BufNewFile,BufRead *.rename set filetype=rename

1
etc/soft/vim/vim/ftplugin/go/go.custom.vim

@ -0,0 +1 @@
../../+ftplugin/go.vim

1
etc/soft/vim/vim/ftplugin/rename/rename.custom.vim

@ -0,0 +1 @@
../../+ftplugin/rename.vim
Loading…
Cancel
Save