simple-mtpfs.yazi uses simple-mtpfs to transparently mount and unmount MTP devices in read/write mode, allowing you to navigate inside, view, and edit individual or groups of files.
simple-mtpfs.yazi use MTP and FUSE to mount MTP devices, like Android, Camera, etc. But because using MTP so it's way slow than using other method such as Android adb.
DEPRECATED in favor of gvfs.yazi
- Mount and Unmount MTP device, tested with android 14
- Auto select the first device if there is only one device listed.
- Jump to device's mounted location.
- After jumped to device's mounted location, jump back to the previous location with a single keybind. Make it easier to copy/paste files.
- Auto jump after successfully mounted a device (use
--jump
)
-
A relatively modern (>= 25.4.8) version of yazi.
-
This plugin only supports Linux, and requires having simple-mtpfs and safe-rm (Optional) installed.
ya pack -a boydaihungst/simple-mtpfs
Modify your ~/.config/yazi/init.lua
to include:
require("simple-mtpfs"):setup({})
The plugin supports the following options, which can be assigned during setup:
mount_point
: The folder path will be created to mount. The default value is$HOME/Media
. DO NOT include forward slash (/
) at the end, environment variable won't work (instead useos.getenv("VARIABLE")
).mount_opts
: a table of Fuse options after-o
, get list of them by usingsimple-mtpfs --help
. The default value is{"enable-move"}
.
require("simple-mtpfs"):setup({
mount_point = os.getenv("HOME") .. "/Android"),
mount_opts = { "debug", "max_read=1000" }
})
Add this to your ~/.config/yazi/keymap.toml
:
[manager]
prepend_keymap = [
# simple-mtpfs plugin
{ on = [ "M", "m" ], run = "plugin simple-mtpfs -- select-then-mount", desc = "Select device then mount" },
# or this if you want to jump to mountpoint after mounted
{ on = [ "M", "m" ], run = "plugin simple-mtpfs -- select-then-mount --jump", desc = "Select device to mount and jump to its mount point" },
# This will remount device under cwd (e.g. cwd = $HOME/Media/1_ZTEV5/Downloads/, device mountpoint = $HOME/Media/1_ZTEV5/)
{ on = [ "M", "r" ], run = "plugin simple-mtpfs -- remount-current-cwd-device", desc = "Remount device under cwd" },
{ on = [ "M", "u" ], run = "plugin simple-mtpfs -- select-then-unmount", desc = "Select device then unmount" },
{ on = [ "g", "m" ], run = "plugin simple-mtpfs -- jump-to-device", desc = "Select device then jump to its mount point" },
{ on = [ "`", "`" ], run = "plugin simple-mtpfs -- jump-back-prev-cwd", desc = "Jump back to the position before jumped to device" },
]
It's highly recommended to add these lines to your ~/.config/yazi/yazi.toml
,
because MTP is so slow that makes yazi freeze when it previews a large file,
in that case unplug your MTP device and re-mount. replace boydaihungst
with your username
[plugin]
preloaders = [
# Do not preload MTP mount_point, cause they are very slow.
# Environment variable won't work here.
# Using absolute path instead.
{ name = "/home/boydaihungst/Media/**/*", run = "noop" },
#... the rest of preloaders
]
previewers = [
# Allow to preview folder.
{ name = "*/", run = "folder", sync = true },
# Do not preview MTP mount_point (uncomment to except text file)
# { mime = "{text/*,application/x-subrip}", run = "code" },
# Using absolute path.
{ name = "/home/boydaihungst/Media/**/*", run = "noop" },
#... the rest of previewers
]
You can also create udev rules to automounting a device Udev Rule. (Not tested yet)