diff --git a/terminal/.config/vifm/scripts/vifmdiff b/terminal/.config/vifm/scripts/vifmdiff new file mode 100755 index 0000000..4e362a8 --- /dev/null +++ b/terminal/.config/vifm/scripts/vifmdiff @@ -0,0 +1,31 @@ +#!/bin/bash + +if [ $# != 2 ] ; then + echo 'Expected exactly two arguments' + exit 1 +fi + +if [ -f "$1" ] && [ -f "$2" ]; then + args= +elif [ -d "$1" ] && [ -d "$2" ]; then + args='-r' +else + if [ -f "$1" ]; then + type_of_1='file' + else + type_of_1='directory' + fi + if [ -f "$2" ]; then + type_of_2='file' + else + type_of_2='directory' + fi + echo "Arguments are of different type ($type_of_1/$type_of_2)" + exit 1 +fi + +if diff $args "$1" "$2" > /dev/null 2>&1; then + echo 'Equal' +else + echo 'Not equal' +fi diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index b5443b1..30973e9 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -297,6 +297,13 @@ nnoremap te :execute ':tree! | echo ":tree"' nnoremap tt t nnoremap ti :toggleicons +" fzf movements +nnoremap f :fzf +nnoremap F :fzfhome +nnoremap c :fzfcd +nnoremap C :fzfcdhome +nnoremap w :grep + " external commands " extract currently selected file(s) noremap ,xx :!atool -x %f @@ -309,13 +316,6 @@ noremap ,xz :!atool -a %c:r.zip %f " combine selected PDFs into single one (named output.pdf) noremap ,pc :!pdftk %f cat output output.pdf -" fzf movements -nnoremap f :fzf -nnoremap F :fzfhome -nnoremap c :fzfcd -nnoremap C :fzfcdhome -nnoremap w :grep - " preview thumbnails of current folder " select thumbnails with m/M in nsxiv " to generate a filtered view on them @@ -650,3 +650,12 @@ filetype * open " vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd '$PWD'" " " let $VIFM_SERVER_NAME = v:servername + +command! cmpinternal vifmdiff %a %S +command! cmp : if expand('%%c') == expand('%%f') + \ | echo expand('Comparing %%"c and %%"C:t ...') + \ | cmpinternal %c %C + \ | else + \ | echo expand('Comparing files: %%"f ...') + \ | cmpinternal %f + \ | endif