A Ranger plugin/script collection that adds cross support for macos Finder and mpv player. Uses Finder to preview virtually anything, the rest depends on quicklook plugins you use. Or mpv player for instant playback of video files and image previews.
- Follow selection in Finder. Useful with Gallery view mode (Command+4 in Finder).
- Reveals selected file from active Finder window to Ranger.
- Reveals selected files from Ranger to Finder.
- Tell Finder to copy, paste or move files and undo / redo last actions. (With this copy method it is even possible to paste a file directly into a web page.)
- Send to system trash currently selected files / empty the trash.
- Toggle synced red tag on selection in Finder and Ranger.
- Toggle instant playback or image preview through mpv.
- Synced playback of selected video files (up to 4) through mpv.
- Add the contents of commands.py to your
~/.config/ranger/commands.py
file. - Copy fplug.py and termplug.py to ~/.config/ranger/plugins
- Copy executables to somewhere in the $PATH(If you don't know: /usr/local/bin/).
- Install dependencies:
brew install iterm2 mpv tag trash
(If you are using another terminal application, then change iterm in the scripts to desired manually.) - Copy setting for mpv from mpv.conf to
~/.config/mpv/mpv.conf
- Add key maps to your
~/.config/ranger/rc.conf
- Grant permissions in
System Settings > Privacy & Security > Accessibility
toiTerm
andosascript
map <Space> findger # Toggle followed file preview through Finder
map <alt>/ finder_show # Show selected files in Finder
map <alt>? finder_get # Go to path of the front Finder window
map <alt>c shell -s finder-copy %p # Copy selected files
map <alt>v shell -f finder-paste %d # Paste files to current folder
map <alt>x shell -f finder-move %d # Move files to current folder
map <alt>z shell -s finder-undo # Undo last Finder action with files
map <alt>Z shell -s finder-redo # Redo last Finder action with files
map <Alt><backspace> shell -s trash -F %s # Move selected files and folders to system trash
map <delete> shell -s trash -e -y # Empty system trash
map ' red_tag # Mark file red in ranger and Finder
map <a-i> finder_info %f # Open Finder's file info on selection
map p findger_mpv # Toggle instant video playback / Image previews with mpv
map ms shell mpv-play-synced %p # Play in sync up to 4 selected video files
Todo: Add better cross support for Finder's color tags.
Inspired by termplug