Files on the device
Device files are the files stored on the device’s own filesystem, as opposed to the files in your project. These commands work on them directly. To copy project files onto the device, see Upload.
All of them, including writing an mp:// buffer, need the port: quit the
REPL first.
:MP files
Section titled “:MP files”Opens a browser showing the device’s filesystem as a tree, with file sizes and the free space on the device. It loads in the background, so Neovim stays responsive while the device answers.
| Key | Action |
|---|---|
<CR> |
Open the file under the cursor for editing |
d |
Delete the file or folder under the cursor (asks first) |
D |
Download the file under the cursor into the project, at the same path |
a |
Create a folder inside the folder under the cursor |
u |
Upload the file you opened the browser from into the folder under the cursor (save it first) |
R |
Refresh |
q |
Close |
Keys that act on a folder use the folder under the cursor, or the folder of the file under the cursor. On the header lines they use the root of the device.
Editing device files
Section titled “Editing device files”A device file opens in an mp://<path> buffer. Edit it and :w writes it straight back to the
device. You can also open one directly:
:e mp://lib/led.pyBinary files can’t be edited. If a file can’t be read, its buffer stays read-only, so :w can
never replace a device file with an empty one. When you quit Neovim, it waits for writes that
are still in progress.
:MP list_files
Section titled “:MP list_files”Prints every file and folder on the device as a tree (mpremote tree), in a terminal.
:MP erase
Section titled “:MP erase”Lists the files and folders at the top of the device and erases the one you pick, once you
confirm. It asks Delete <path>?, or Delete <folder>/ and everything in it? for a folder,
which is deleted with everything in it. Only Yes deletes: No, or closing the picker, deletes
nothing and says so. The delete runs in the background.
:MP erase_all
Section titled “:MP erase_all”Erases every file and folder on the device, in a terminal. It asks
Delete every file on <port>? first. Only Yes starts it: No, or closing the picker, deletes
nothing and says so.
The firmware isn’t affected: MicroPython keeps running, it just has no files. On boards with
custom firmware, parts of the filesystem may be read-only, and erase_all can stop with an
error when it reaches them.