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

@ -116,6 +116,8 @@ local default_config = {
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
@ -223,6 +225,8 @@ default_config.adapters = {
['oil-ssh://'] = 'ssh',
[oil_s3_string] = 's3',
['oil-trash://'] = 'trash',
['oil-ftp://'] = 'ftp',
['oil-ftps://'] = 'ftp',
}
default_config.adapter_aliases = {}
-- We want the function in the default config for documentation generation, but if we nil it out
@ -254,6 +258,7 @@ default_config.view_options.highlight_filename = nil
---@field new_dir_mode integer
---@field extra_scp_args string[]
---@field extra_s3_args string[]
---@field extra_curl_args string[]
---@field git oil.GitOptions
---@field float oil.FloatWindowConfig
---@field preview_win oil.PreviewWindowConfig
@ -288,6 +293,7 @@ local M = {}
---@field new_dir_mode? integer Permission mode for new directories in decimal (default 493 = 0755)
---@field extra_scp_args? string[] Extra arguments to pass to SCP when moving/copying files over SSH
---@field extra_s3_args? string[] Extra arguments to pass to aws s3 when moving/copying files using aws s3
---@field extra_curl_args? string[] Extra arguments to pass to curl for FTP operations
---@field git? oil.SetupGitOptions EXPERIMENTAL support for performing file operations with git
---@field float? oil.SetupFloatWindowConfig Configuration for the floating window in oil.open_float
---@field preview_win? oil.SetupPreviewWindowConfig Configuration for the file preview window