mirror of
https://github.com/jiriks74/presence.nvim
synced 2024-12-28 11:02:34 +01:00
feat: Support oil.nvim file explore (#58)
* feat: Support oil.nvim file explore * feat: more explicitly look for oil at the start of file_path * feat: oil working with git buttons work by @nick22985
This commit is contained in:
parent
2f77b19e9d
commit
25076ce092
2 changed files with 9 additions and 1 deletions
|
@ -7,4 +7,5 @@ return {
|
||||||
["TelescopePrompt"] = "Telescope",
|
["TelescopePrompt"] = "Telescope",
|
||||||
["neo-tree"] = "Neotree",
|
["neo-tree"] = "Neotree",
|
||||||
["fern"] = "Fern",
|
["fern"] = "Fern",
|
||||||
|
["oil"] = "Oil",
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,7 +439,10 @@ function Presence:get_project_name(file_path)
|
||||||
if not file_path then
|
if not file_path then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
-- if filepath has oil:// remove it
|
||||||
|
if file_path:find("^oil://") then
|
||||||
|
file_path = file_path:gsub("oil://", "")
|
||||||
|
end
|
||||||
-- Escape quotes in the file path
|
-- Escape quotes in the file path
|
||||||
file_path = file_path:gsub([["]], [[\"]])
|
file_path = file_path:gsub([["]], [[\"]])
|
||||||
|
|
||||||
|
@ -763,6 +766,10 @@ end
|
||||||
|
|
||||||
-- Get either user-configured buttons or the create default "View Repository" button definition
|
-- Get either user-configured buttons or the create default "View Repository" button definition
|
||||||
function Presence:get_buttons(buffer, parent_dirpath)
|
function Presence:get_buttons(buffer, parent_dirpath)
|
||||||
|
if parent_dirpath ~= nil and parent_dirpath:find("^oil://") then
|
||||||
|
parent_dirpath = parent_dirpath:gsub("oil://", "")
|
||||||
|
end
|
||||||
|
|
||||||
-- User configured a static buttons table
|
-- User configured a static buttons table
|
||||||
if type(self.options.buttons) == "table" then
|
if type(self.options.buttons) == "table" then
|
||||||
local is_plural = #self.options.buttons > 1
|
local is_plural = #self.options.buttons > 1
|
||||||
|
|
Loading…
Reference in a new issue