From 254007ceb10d431d246ec8017918617f3a964177 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Wed, 13 Nov 2019 22:08:50 +0300 Subject: [PATCH] vim, vifm: renamepdfs: syntax highlighting, shortkeys --- etc/soft/vifm/commands | 2 +- etc/soft/vim/vim/+ftplugin/rename.vim | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/etc/soft/vifm/commands b/etc/soft/vifm/commands index 6861049..e71c4c8 100644 --- a/etc/soft/vifm/commands +++ b/etc/soft/vifm/commands @@ -45,5 +45,5 @@ command config :nvim $MYVIFMRC 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 +command renamepdfs !renamepdfs --directory %d %f diff --git a/etc/soft/vim/vim/+ftplugin/rename.vim b/etc/soft/vim/vim/+ftplugin/rename.vim index a3360df..0986367 100644 --- a/etc/soft/vim/vim/+ftplugin/rename.vim +++ b/etc/soft/vim/vim/+ftplugin/rename.vim @@ -17,3 +17,16 @@ endfun setlocal omnifunc=PdfTags +syntax region newName start=/\v"/ skip=/\v\\[^"]/ end=/\v"\s*$/ +syntax match oldName '^"[^"]*"\s' +syntax match errorLine '^"[^"]*"$' + +highlight errorLine ctermfg=red +highlight oldName ctermfg=darkblue +highlight newName ctermfg=darkgreen cterm=bold + +" ----------------------------------------------------- + +cabbrev q cq +nmap D :g/^"[^"]*"\s*$/d +