Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

Hi,
How can I compare 2 selected files, either in the same directory/pane or not ?

1 Answer

+1 vote
by

Hello,

Assuming that you want to compare files via Vim, the following can be used:

" use Vim to diff files
" uses selection of the current pane when it contains more than one file
" otherwise uses left pane file and right pane file keeping order inside Vim
command! diff : if selected() < 2
            \ |     if paneisat('right') && paneisat('bottom')
            \ |         execute '!vim -d %%C %%c'
            \ |     else
            \ |         execute '!vim -d %%c %%C'
            \ |     endif
            \ | else
            \ |     execute '!vim -d %%f'
            \ | endif

I should actually add this to sample vifmrc.

...