-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): implement checkhealth and oil providers
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
---@class PrettyPath.HealthProvider: PrettyPath.Provider | ||
---@field super PrettyPath.Provider | ||
local M = require("lualine-pretty-path.providers.base"):extend() | ||
|
||
function M.can_handle() | ||
return vim.bo.filetype == "checkhealth" | ||
end | ||
|
||
function M:extract_scheme() end | ||
|
||
function M:render_symbols() end | ||
|
||
function M:extract_name() | ||
return "Health" | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
---@class PrettyPath.OilProvider: PrettyPath.Provider | ||
---@field super PrettyPath.Provider | ||
local M = require("lualine-pretty-path.providers.base"):extend() | ||
|
||
function M.can_handle() | ||
return vim.bo.filetype == "oil" | ||
end | ||
|
||
function M:format_path(_) | ||
return require("oil").get_current_dir() | ||
end | ||
|
||
---Renders the oil current directory as if it was the "filename" part. | ||
---@return string | ||
function M:render_dir() | ||
local dir = self.super.render_dir(self) or "" | ||
dir = dir:sub(1, #dir - #self.path_sep) -- remove trailing separator | ||
|
||
return self.hl(dir, self.opts.highlights.filename) | ||
end | ||
|
||
function M:render() | ||
return table.concat({ | ||
self:render_dir() or "", | ||
self:render_symbols() or "", | ||
}, "") | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters