refactor!: change scp:// urls back to oil-ssh://
This commit is contained in:
parent
73c6fcf519
commit
31645370a1
4 changed files with 36 additions and 19 deletions
|
|
@ -67,12 +67,9 @@ local default_config = {
|
|||
-- reason, I'm taking them out of the section above so they won't show up in the autogen docs.
|
||||
default_config.adapters = {
|
||||
["oil://"] = "files",
|
||||
["scp://"] = "ssh",
|
||||
}
|
||||
-- For backwards compatibility
|
||||
default_config.adapter_aliases = {
|
||||
["oil-ssh://"] = "scp://",
|
||||
["oil-ssh://"] = "ssh",
|
||||
}
|
||||
default_config.adapter_aliases = {}
|
||||
|
||||
local M = {}
|
||||
|
||||
|
|
@ -147,6 +144,13 @@ M.get_adapter_by_scheme = function(scheme)
|
|||
local adapter = M._adapter_by_scheme[scheme]
|
||||
if adapter == nil then
|
||||
local name = M.adapters[scheme]
|
||||
if not name then
|
||||
vim.notify(
|
||||
string.format("Could not find oil adapter for scheme '%s'", scheme),
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return nil
|
||||
end
|
||||
local ok
|
||||
ok, adapter = pcall(require, string.format("oil.adapters.%s", name))
|
||||
if ok then
|
||||
|
|
|
|||
|
|
@ -553,12 +553,6 @@ local function load_oil_buffer(bufnr)
|
|||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
local scheme, path = util.parse_url(bufname)
|
||||
if config.adapter_aliases[scheme] then
|
||||
if scheme == "oil-ssh://" then
|
||||
vim.notify_once(
|
||||
'The "oil-ssh://" url scheme is deprecated, use "scp://" instead.\nSupport will be removed on 2023-06-01.',
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end
|
||||
scheme = config.adapter_aliases[scheme]
|
||||
bufname = scheme .. path
|
||||
util.rename_buffer(bufnr, bufname)
|
||||
|
|
@ -603,10 +597,6 @@ end
|
|||
M.setup = function(opts)
|
||||
local config = require("oil.config")
|
||||
|
||||
-- Disable netrw
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
config.setup(opts)
|
||||
set_colors()
|
||||
vim.api.nvim_create_user_command("Oil", function(args)
|
||||
|
|
@ -693,6 +683,20 @@ M.setup = function(opts)
|
|||
end
|
||||
end,
|
||||
})
|
||||
if not config.silence_scp_warning then
|
||||
vim.api.nvim_create_autocmd("BufNew", {
|
||||
desc = "Warn about scp:// usage",
|
||||
group = aug,
|
||||
pattern = "scp://*",
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.notify(
|
||||
"If you are trying to browse using Oil, use oil-ssh:// instead of scp://\nSet `silence_scp_warning = true` in oil.setup() to disable this message.\nSee https://github.com/stevearc/oil.nvim/issues/27 for more information.",
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end,
|
||||
})
|
||||
end
|
||||
vim.api.nvim_create_autocmd("WinNew", {
|
||||
desc = "Restore window options when splitting an oil window",
|
||||
group = aug,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue