-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from TwIStOy/refactor/dora
Refactor/dora
- Loading branch information
Showing
77 changed files
with
6,333 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
---@class dora.config.icon | ||
local M = {} | ||
|
||
M.icons = { | ||
ActiveLSP = "", | ||
ActiveTS = "", | ||
ArrowLeft = "", | ||
ArrowRight = "", | ||
Bookmarks = "", | ||
BufferClose = "", | ||
DapBreakpoint = "", | ||
DapBreakpointCondition = "", | ||
DapBreakpointRejected = "", | ||
DapLogPoint = ".>", | ||
DapStopped = "", | ||
Debugger = "", | ||
DefaultFile = "", | ||
Diagnostic = "", | ||
DiagnosticError = "", | ||
DiagnosticHint = "", | ||
DiagnosticInfo = "", | ||
DiagnosticWarn = "", | ||
Ellipsis = "…", | ||
FileNew = "", | ||
FileModified = "", | ||
FileReadOnly = "", | ||
FoldClosed = "", | ||
FoldOpened = "", | ||
FoldSeparator = " ", | ||
FolderClosed = "", | ||
FolderEmpty = "", | ||
FolderOpen = "", | ||
Git = "", | ||
GitAdd = "", | ||
GitBranch = "", | ||
GitChange = "", | ||
GitConflict = "", | ||
GitDelete = "", | ||
GitIgnored = "◌", | ||
GitRenamed = "➜", | ||
GitSign = "▎", | ||
GitStaged = "✓", | ||
GitUnstaged = "✗", | ||
GitUntracked = "★", | ||
LSPLoaded = "", | ||
LSPLoading1 = "", | ||
LSPLoading2 = "", | ||
LSPLoading3 = "", | ||
MacroRecording = "", | ||
Package = "", | ||
Paste = "", | ||
Refresh = "", | ||
Search = "", | ||
Selected = "❯", | ||
Session = "", | ||
Sort = "", | ||
Spellcheck = "", | ||
Tab = "", | ||
TabClose = "", | ||
Terminal = "", | ||
Window = "", | ||
WordFile = "", | ||
VimLogo = "", | ||
Bookmark = "", | ||
} | ||
|
||
---@param kind string | ||
---@param padding? number | ||
---@return string | ||
function M.predefined_icon(kind, padding) | ||
local icon = M.icons[kind] | ||
if icon == nil then | ||
return "" | ||
end | ||
return icon .. string.rep(" ", padding or 0) | ||
end | ||
|
||
---@param opts table<string, string> | ||
function M.setup(opts) | ||
M.icons = vim.tbl_extend("force", M.icons, opts) | ||
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,38 @@ | ||
---@class dora.config | ||
local M = { | ||
---@type dora.config.lsp | ||
lsp = require("dora.config.lsp"), | ||
---@type dora.config.nix | ||
nix = require("dora.config.nix"), | ||
---@type dora.config.icon | ||
icon = require("dora.config.icon"), | ||
---@type dora.config.package | ||
package = require("dora.config.package"), | ||
---@type dora.config.ui | ||
ui = require("dora.config.ui"), | ||
---@type dora.config.vim | ||
vim = require("dora.config.vim"), | ||
---@type dora.config.integration | ||
integration = require("dora.config.integration"), | ||
} | ||
|
||
---@class dora.config.SetupOptions | ||
---@field lsp? dora.config.lsp.SetupOptions | ||
---@field nix? dora.config.nix.SetupOption | ||
---@field icons? table<string, string> | ||
---@field ui? dora.config.ui.SetupOptions | ||
---@field packages? string[] | ||
---@field vim? dora.config.vim.SetupOption | ||
|
||
---@param opts dora.config.SetupOptions | ||
function M.setup(opts) | ||
M.lsp.setup(opts.lsp or {}) | ||
M.nix.setup(opts.nix or {}) | ||
M.icon.setup(opts.icons or {}) | ||
M.ui.setup(opts.ui or {}) | ||
M.vim.setup(opts.vim or {}) | ||
|
||
M.package.setup(opts.packages 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
---@class dora.config.integration | ||
local M = {} | ||
|
||
---@class dora.config.integration.SetupOptions | ||
---@field enable_yazi? boolean | ||
---@field enable_lazygit? boolean | ||
|
||
---@type dora.config.integration.SetupOptions | ||
local default_options = {} | ||
|
||
M._ = default_options | ||
|
||
---@param opts dora.config.integration.SetupOptions | ||
function M.setup(opts) | ||
M._ = vim.tbl_deep_extend("force", default_options, opts or {}) | ||
end | ||
|
||
---@param name string | ||
---@return boolean | ||
function M.enabled(name) | ||
return not not M._["enable_" .. name] | ||
end | ||
|
||
return M |
Oops, something went wrong.