feat(api): add get_current_url() for adapter-agnostic URL access (#119)
Problem: `get_current_dir()` returns nil for non-local adapters (SSH, S3, trash), leaving users with no public API to get the current buffer's location. Solution: add `get_current_url()` which returns the full canola URL for any adapter, or nil if not in a canola buffer. Based on: stevearc/oil.nvim#646
This commit is contained in:
parent
9d29243faf
commit
9298b48c5d
3 changed files with 25 additions and 2 deletions
|
|
@ -395,7 +395,17 @@ toggle_hidden() *canola.toggle_hi
|
|||
|
||||
|
||||
get_current_dir({bufnr}): nil|string *canola.get_current_dir*
|
||||
Get the current directory
|
||||
Get the current directory as a local filesystem path. Returns nil for
|
||||
non-local adapters (SSH, S3, trash). See |canola.get_current_url| for an
|
||||
adapter-agnostic alternative.
|
||||
|
||||
Parameters:
|
||||
{bufnr} `nil|integer`
|
||||
|
||||
get_current_url({bufnr}): nil|string *canola.get_current_url*
|
||||
Get the current buffer's canola URL (e.g. "canola:///path/" or
|
||||
"canola-ssh://host/path/"). Works for all adapters. Returns nil if the
|
||||
buffer is not a canola buffer.
|
||||
|
||||
Parameters:
|
||||
{bufnr} `nil|integer`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue