refactor: revert canola namespace to oil and remove vim.g config (#120)
Some checks are pending
quality / changes (push) Waiting to run
quality / Lua Format Check (push) Blocked by required conditions
quality / Lua Lint Check (push) Blocked by required conditions
quality / Lua Type Check (push) Blocked by required conditions
quality / Markdown Format Check (push) Blocked by required conditions
test / Test (Neovim nightly) (push) Waiting to run
test / Test (Neovim stable) (push) Waiting to run
Some checks are pending
quality / changes (push) Waiting to run
quality / Lua Format Check (push) Blocked by required conditions
quality / Lua Lint Check (push) Blocked by required conditions
quality / Lua Type Check (push) Blocked by required conditions
quality / Markdown Format Check (push) Blocked by required conditions
test / Test (Neovim nightly) (push) Waiting to run
test / Test (Neovim stable) (push) Waiting to run
* refactor: revert module namespace from canola back to oil
Problem: the canola rename creates unnecessary friction for users
migrating from stevearc/oil.nvim — every `require('oil')` call and
config reference must change.
Solution: revert all module paths, URL schemes, autocmd groups,
highlight groups, and filetype names back to `oil`. The repo stays
`canola.nvim` for identity; the code is a drop-in replacement.
* refactor: remove `vim.g.oil` declarative config
Problem: the `vim.g.oil` configuration path was added prematurely.
It adds a second config entrypoint before the plugin has stabilized
enough to justify it.
Solution: remove `vim.g.oil` support from `plugin/oil.lua`,
`config.setup()`, docs, and tests. Users configure via
`require("oil").setup({})`.
This commit is contained in:
parent
9298b48c5d
commit
e2cd1e66cf
69 changed files with 1724 additions and 1754 deletions
48
lua/oil/shell.lua
Normal file
48
lua/oil/shell.lua
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
local M = {}
|
||||
|
||||
M.run = function(cmd, opts, callback)
|
||||
if not callback then
|
||||
callback = opts
|
||||
opts = {}
|
||||
end
|
||||
local stdout
|
||||
local stderr = {}
|
||||
local jid = vim.fn.jobstart(
|
||||
cmd,
|
||||
vim.tbl_deep_extend('keep', opts, {
|
||||
stdout_buffered = true,
|
||||
stderr_buffered = true,
|
||||
on_stdout = function(j, output)
|
||||
stdout = output
|
||||
end,
|
||||
on_stderr = function(j, output)
|
||||
stderr = output
|
||||
end,
|
||||
on_exit = vim.schedule_wrap(function(j, code)
|
||||
if code == 0 then
|
||||
callback(nil, stdout)
|
||||
else
|
||||
local err = table.concat(stderr, '\n')
|
||||
if err == '' then
|
||||
err = 'Unknown error'
|
||||
end
|
||||
local cmd_str = type(cmd) == 'string' and cmd or table.concat(cmd, ' ')
|
||||
callback(string.format("Error running command '%s'\n%s", cmd_str, err))
|
||||
end
|
||||
end),
|
||||
})
|
||||
)
|
||||
local exe
|
||||
if type(cmd) == 'string' then
|
||||
exe = vim.split(cmd, '%s+')[1]
|
||||
else
|
||||
exe = cmd[1]
|
||||
end
|
||||
if jid == 0 then
|
||||
callback(string.format("Passed invalid arguments to '%s'", exe))
|
||||
elseif jid == -1 then
|
||||
callback(string.format("'%s' is not executable", exe))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue