feat(ftp): add FTP/FTPS adapter via curl

Problem: canola has no way to browse or edit files on FTP servers,
despite the adapter system being designed for exactly this pattern.
curl speaks FTP natively, including FTPS (FTP over TLS), and requires
no new dependencies.

Solution: implement `lua/oil/adapters/ftp.lua` with `oil-ftp://` and
`oil-ftps://` schemes. Parses Unix and IIS LIST output, supports
`size`, `mtime`, and `permissions` columns, and implements the full
adapter API (list, read_file, write_file, render_action, perform_action).
Same-host renames use RNFR/RNTO; cross-host and local↔FTP copies use
curl download/upload through a tmpfile. Adds `extra_curl_args` config
option and documents the adapter in `doc/oil.txt`.

Based on: stevearc/oil.nvim#210
This commit is contained in:
Barrett Ruth 2026-03-17 21:40:17 -04:00
parent d67195b637
commit a5cfee05a4
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 692 additions and 1 deletions

View file

@ -173,6 +173,8 @@ The full list of options with their defaults:
extra_scp_args = {},
-- Extra arguments to pass to aws s3 when creating/deleting/moving/copying files using aws s3
extra_s3_args = {},
-- Extra arguments to pass to curl for FTP operations
extra_curl_args = {},
-- EXPERIMENTAL support for performing file operations with git
git = {
-- Return true to automatically git add/mv/rm files
@ -993,6 +995,50 @@ S3 *oil-adapter-s
Older versions of Neovim (0.11 and earlier) don't support numbers in the
URL scheme, so use `oil-sss` instead of `oil-s3`.
FTP *oil-adapter-ftp*
Browse files over FTP or FTPS (FTP over TLS). Open a buffer with: >
nvim oil-ftp://[username[:password]@]hostname[:port]/[path]/
nvim oil-ftps://[username[:password]@]hostname[:port]/[path]/
<
The `oil-ftps://` scheme connects with `--ssl-reqd`, requiring a valid TLS
certificate. Use `oil-ftp://` for plain FTP.
Authentication ~
Credentials can be supplied in the URL (`user:pass@host`) or stored in
`~/.netrc` (recommended — keeps passwords out of shell history): >
machine ftp.example.com login myuser password mypass
<
How it works ~
The FTP adapter uses `curl` to perform all operations. Directory listings
come from FTP LIST output (Unix and IIS/Windows formats are both supported).
File reads download to a local tempfile; file writes upload from a tempfile.
Renames on the same server use the FTP RNFR/RNTO commands. File copies
between servers go through a local tempfile.
Limitations ~
Symbolic links cannot be created over FTP. Directory copies are not
supported (copy individual files instead). Moving or copying directories
across different FTP hosts is not supported.
Configuration ~
Pass extra flags to `curl` with `extra_curl_args`: >lua
require("oil").setup({
extra_curl_args = { "--insecure" },
})
<
The adapter supports the `size`, `mtime`, and `permissions` columns.
Permission changes use the FTP `SITE CHMOD` command; not all servers
support it.
Dependencies ~
Requires `curl` (standard on Linux and macOS).
Trash *oil-adapter-trash*
See |oil-trash| for details on the built-in trash adapter.

View file

@ -40,7 +40,7 @@ issues against this fork.
| [#156](https://github.com/stevearc/oil.nvim/issues/156) | Paste path of files into oil buffer | fixed — added `oil-recipe-paste-file-from-clipboard` |
| [#200](https://github.com/stevearc/oil.nvim/issues/200) | Highlights not working when opening a file | not actionable — cannot reproduce, nvim 0.9.4 |
| [#207](https://github.com/stevearc/oil.nvim/issues/207) | Suppress "no longer available" message | fixed — `cleanup_buffers_on_delete` option |
| [#210](https://github.com/stevearc/oil.nvim/issues/210) | FTP support | open |
| [#210](https://github.com/stevearc/oil.nvim/issues/210) | FTP support | fixed |
| [#213](https://github.com/stevearc/oil.nvim/issues/213) | Disable preview for large files | fixed ([#85](https://github.com/barrettruth/canola.nvim/pull/85)) |
| [#226](https://github.com/stevearc/oil.nvim/issues/226) | K8s/Docker adapter | not actionable — no demand |
| [#232](https://github.com/stevearc/oil.nvim/issues/232) | Cannot close last window | consolidated into [#149](https://github.com/barrettruth/canola.nvim/issues/149) |