Skip to content

Commit

Permalink
Merge pull request #8 from TwIStOy/refactor/dora
Browse files Browse the repository at this point in the history
Refactor/dora
  • Loading branch information
TwIStOy authored Feb 28, 2024
2 parents b96da4b + a90ed28 commit 90ce1f7
Show file tree
Hide file tree
Showing 77 changed files with 6,333 additions and 6 deletions.
83 changes: 83 additions & 0 deletions lua/dora/config/icon.lua
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
38 changes: 38 additions & 0 deletions lua/dora/config/init.lua
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
24 changes: 24 additions & 0 deletions lua/dora/config/integration.lua
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
Loading

0 comments on commit 90ce1f7

Please sign in to comment.