From d2ba250f90c5a6e4f2b1476cfe8ac2de7e37bfe1 Mon Sep 17 00:00:00 2001 From: Hawtian Wang Date: Fri, 29 Mar 2024 23:13:29 +0800 Subject: [PATCH] ... --- lua/dotvim/legacy/packages/coding/init.lua | 18 ------------- .../legacy/packages/treesitter/init.lua | 11 -------- lua/dotvim/legacy/packages/ui/init.lua | 14 ---------- lua/dotvim/pkgs/coding/init.lua | 19 ++++++++++++++ .../coding/plugins/comment.lua | 2 +- .../coding/plugins/conform.lua | 8 +++--- .../coding/plugins/luasnip.lua | 2 +- .../coding/plugins/neogen.lua | 2 +- .../coding/plugins/nvim-cmp.lua | 2 +- .../coding/plugins/nvim-lint.lua | 8 +++--- .../coding/plugins/nvim-surround.lua | 2 +- .../plugins/nvim-ts-context-commentstring.lua | 2 +- .../coding/plugins/ultimate-autopair.lua | 2 +- lua/dotvim/pkgs/treesitter/init.lua | 13 ++++++++++ lua/dotvim/pkgs/treesitter/plugins/just.lua | 17 ++++++++++++ .../treesitter/plugins/nvim-treesitter.lua | 2 +- .../treesitter/plugins/others.lua} | 18 +------------ lua/dotvim/pkgs/ui/dashboard.lua | 26 +++++++++++++++++++ lua/dotvim/pkgs/ui/init.lua | 14 ++++++++++ .../packages => pkgs}/ui/plugins/_others.lua | 12 ++++----- .../packages => pkgs}/ui/plugins/alpha.lua | 24 +++++++++-------- .../ui/plugins/bufferline.lua | 6 ++--- .../packages => pkgs}/ui/plugins/lualine.lua | 18 ++++++------- .../packages => pkgs}/ui/plugins/noice.lua | 8 +++--- lua/dotvim/utils/fn.lua | 25 ++++++++++++++++++ 25 files changed, 166 insertions(+), 109 deletions(-) delete mode 100644 lua/dotvim/legacy/packages/coding/init.lua delete mode 100644 lua/dotvim/legacy/packages/treesitter/init.lua delete mode 100644 lua/dotvim/legacy/packages/ui/init.lua create mode 100644 lua/dotvim/pkgs/coding/init.lua rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/comment.lua (93%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/conform.lua (92%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/luasnip.lua (97%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/neogen.lua (93%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/nvim-cmp.lua (98%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/nvim-lint.lua (84%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/nvim-surround.lua (72%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/nvim-ts-context-commentstring.lua (90%) rename lua/dotvim/{legacy/packages => pkgs}/coding/plugins/ultimate-autopair.lua (95%) create mode 100644 lua/dotvim/pkgs/treesitter/init.lua create mode 100644 lua/dotvim/pkgs/treesitter/plugins/just.lua rename lua/dotvim/{legacy/packages => pkgs}/treesitter/plugins/nvim-treesitter.lua (98%) rename lua/dotvim/{legacy/packages/treesitter/plugins/_others.lua => pkgs/treesitter/plugins/others.lua} (79%) create mode 100644 lua/dotvim/pkgs/ui/dashboard.lua create mode 100644 lua/dotvim/pkgs/ui/init.lua rename lua/dotvim/{legacy/packages => pkgs}/ui/plugins/_others.lua (93%) rename lua/dotvim/{legacy/packages => pkgs}/ui/plugins/alpha.lua (95%) rename lua/dotvim/{legacy/packages => pkgs}/ui/plugins/bufferline.lua (95%) rename lua/dotvim/{legacy/packages => pkgs}/ui/plugins/lualine.lua (81%) rename lua/dotvim/{legacy/packages => pkgs}/ui/plugins/noice.lua (95%) diff --git a/lua/dotvim/legacy/packages/coding/init.lua b/lua/dotvim/legacy/packages/coding/init.lua deleted file mode 100644 index 2bd51159..00000000 --- a/lua/dotvim/legacy/packages/coding/init.lua +++ /dev/null @@ -1,18 +0,0 @@ ----@type dora.lib -local lib = require("dora.lib") - ----@type dora.core.package.PackageOption -return { - name = "dora.packages.coding", - plugins = lib.tbl.flatten_array { - require("dora.packages.coding.plugins.nvim-cmp"), - require("dora.packages.coding.plugins.luasnip"), - require("dora.packages.coding.plugins.conform"), - require("dora.packages.coding.plugins.ultimate-autopair"), - require("dora.packages.coding.plugins.nvim-surround"), - require("dora.packages.coding.plugins.nvim-ts-context-commentstring"), - require("dora.packages.coding.plugins.comment"), - require("dora.packages.coding.plugins.neogen"), - require("dora.packages.coding.plugins.nvim-lint"), - }, -} diff --git a/lua/dotvim/legacy/packages/treesitter/init.lua b/lua/dotvim/legacy/packages/treesitter/init.lua deleted file mode 100644 index 0f2759c9..00000000 --- a/lua/dotvim/legacy/packages/treesitter/init.lua +++ /dev/null @@ -1,11 +0,0 @@ ----@type dora.lib -local lib = require("dora.lib") - ----@type dora.core.package.PackageOption -return { - name = "dora.packages.treesitter", - plugins = lib.tbl.flatten_array { - require("dora.packages.treesitter.plugins.nvim-treesitter"), - require("dora.packages.treesitter.plugins._others"), - }, -} diff --git a/lua/dotvim/legacy/packages/ui/init.lua b/lua/dotvim/legacy/packages/ui/init.lua deleted file mode 100644 index 26a1d2aa..00000000 --- a/lua/dotvim/legacy/packages/ui/init.lua +++ /dev/null @@ -1,14 +0,0 @@ ----@type dora.lib -local lib = require("dora.lib") - ----@type dora.core.package.PackageOption -return { - name = "dora.packages.ui", - plugins = lib.tbl.flatten_array { - require("dora.packages.ui.plugins._others"), - require("dora.packages.ui.plugins.bufferline"), - require("dora.packages.ui.plugins.lualine"), - require("dora.packages.ui.plugins.noice"), - require("dora.packages.ui.plugins.alpha"), - }, -} diff --git a/lua/dotvim/pkgs/coding/init.lua b/lua/dotvim/pkgs/coding/init.lua new file mode 100644 index 00000000..fd5cd577 --- /dev/null +++ b/lua/dotvim/pkgs/coding/init.lua @@ -0,0 +1,19 @@ +---@type dotvim.utils +local Utils = require("dotvim.utils") + +---@type dotvim.core.package.PackageOption +return { + name = "coding", + depends = { "treesitter" }, + plugins = Utils.tbl.flatten_array { + require("dotvim.pkgs.coding.plugins.comment"), + require("dotvim.pkgs.coding.plugins.conform"), + require("dotvim.pkgs.coding.plugins.luasnip"), + require("dotvim.pkgs.coding.plugins.neogen"), + require("dotvim.pkgs.coding.plugins.nvim-cmp"), + require("dotvim.pkgs.coding.plugins.nvim-lint"), + require("dotvim.pkgs.coding.plugins.nvim-surround"), + require("dotvim.pkgs.coding.plugins.nvim-ts-context-commentstring"), + require("dotvim.pkgs.coding.plugins.ultimate-autopair"), + }, +} diff --git a/lua/dotvim/legacy/packages/coding/plugins/comment.lua b/lua/dotvim/pkgs/coding/plugins/comment.lua similarity index 93% rename from lua/dotvim/legacy/packages/coding/plugins/comment.lua rename to lua/dotvim/pkgs/coding/plugins/comment.lua index 65176bd0..11a0dbb8 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/comment.lua +++ b/lua/dotvim/pkgs/coding/plugins/comment.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "numToStr/Comment.nvim", gui = "all", diff --git a/lua/dotvim/legacy/packages/coding/plugins/conform.lua b/lua/dotvim/pkgs/coding/plugins/conform.lua similarity index 92% rename from lua/dotvim/legacy/packages/coding/plugins/conform.lua rename to lua/dotvim/pkgs/coding/plugins/conform.lua index 7aa853c1..605ca85e 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/conform.lua +++ b/lua/dotvim/pkgs/coding/plugins/conform.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "stevearc/conform.nvim", gui = "all", @@ -43,8 +43,8 @@ return { end end - ---@type dora.utils - local utils = require("dora.utils") + ---@type dotvim.utils + local Utils = require("dotvim.utils") local custom_formatters = {} for _, formatter in ipairs(used_formatters) do @@ -62,7 +62,7 @@ return { if command == nil then error("Formatter " .. formatter .. " does not have a command") end - local resolved_command = utils.which_binary(command) + local resolved_command = Utils.which(command) if resolved_command ~= command then custom_formatters[formatter] = vim.tbl_extend("force", formatter_opts, { command = resolved_command, diff --git a/lua/dotvim/legacy/packages/coding/plugins/luasnip.lua b/lua/dotvim/pkgs/coding/plugins/luasnip.lua similarity index 97% rename from lua/dotvim/legacy/packages/coding/plugins/luasnip.lua rename to lua/dotvim/pkgs/coding/plugins/luasnip.lua index 485a9a6c..b05ca4a8 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/luasnip.lua +++ b/lua/dotvim/pkgs/coding/plugins/luasnip.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { { "TwIStOy/luasnip-snippets", diff --git a/lua/dotvim/legacy/packages/coding/plugins/neogen.lua b/lua/dotvim/pkgs/coding/plugins/neogen.lua similarity index 93% rename from lua/dotvim/legacy/packages/coding/plugins/neogen.lua rename to lua/dotvim/pkgs/coding/plugins/neogen.lua index abbe9c88..c294d161 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/neogen.lua +++ b/lua/dotvim/pkgs/coding/plugins/neogen.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { { "danymat/neogen", diff --git a/lua/dotvim/legacy/packages/coding/plugins/nvim-cmp.lua b/lua/dotvim/pkgs/coding/plugins/nvim-cmp.lua similarity index 98% rename from lua/dotvim/legacy/packages/coding/plugins/nvim-cmp.lua rename to lua/dotvim/pkgs/coding/plugins/nvim-cmp.lua index c1279ea4..198532e9 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/nvim-cmp.lua +++ b/lua/dotvim/pkgs/coding/plugins/nvim-cmp.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "hrsh7th/nvim-cmp", event = "InsertEnter", diff --git a/lua/dotvim/legacy/packages/coding/plugins/nvim-lint.lua b/lua/dotvim/pkgs/coding/plugins/nvim-lint.lua similarity index 84% rename from lua/dotvim/legacy/packages/coding/plugins/nvim-lint.lua rename to lua/dotvim/pkgs/coding/plugins/nvim-lint.lua index b886bae4..9f490a11 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/nvim-lint.lua +++ b/lua/dotvim/pkgs/coding/plugins/nvim-lint.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "mfussenegger/nvim-lint", event = { "BufReadPost", "BufNewFile" }, @@ -19,14 +19,14 @@ return { end end - ---@type dora.utils - local utils = require("dora.utils") + ---@type dotvim.utils + local Utils = require("dotvim.utils") for _, name in pairs(used_linters) do local linter = require("lint").linters[name] if linter == nil then error("Linter " .. linter .. " not found") end - linter.cmd = utils.which_binary(linter.cmd) + linter.cmd = Utils.which(linter.cmd) end vim.api.nvim_create_autocmd("BufWritePost", { diff --git a/lua/dotvim/legacy/packages/coding/plugins/nvim-surround.lua b/lua/dotvim/pkgs/coding/plugins/nvim-surround.lua similarity index 72% rename from lua/dotvim/legacy/packages/coding/plugins/nvim-surround.lua rename to lua/dotvim/pkgs/coding/plugins/nvim-surround.lua index 696cb413..c4b97f53 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/nvim-surround.lua +++ b/lua/dotvim/pkgs/coding/plugins/nvim-surround.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "kylechui/nvim-surround", gui = "all", diff --git a/lua/dotvim/legacy/packages/coding/plugins/nvim-ts-context-commentstring.lua b/lua/dotvim/pkgs/coding/plugins/nvim-ts-context-commentstring.lua similarity index 90% rename from lua/dotvim/legacy/packages/coding/plugins/nvim-ts-context-commentstring.lua rename to lua/dotvim/pkgs/coding/plugins/nvim-ts-context-commentstring.lua index fefc1dcc..b7f5efe0 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/nvim-ts-context-commentstring.lua +++ b/lua/dotvim/pkgs/coding/plugins/nvim-ts-context-commentstring.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "JoosepAlviste/nvim-ts-context-commentstring", gui = "all", diff --git a/lua/dotvim/legacy/packages/coding/plugins/ultimate-autopair.lua b/lua/dotvim/pkgs/coding/plugins/ultimate-autopair.lua similarity index 95% rename from lua/dotvim/legacy/packages/coding/plugins/ultimate-autopair.lua rename to lua/dotvim/pkgs/coding/plugins/ultimate-autopair.lua index 4e3dadd5..e6fc6388 100644 --- a/lua/dotvim/legacy/packages/coding/plugins/ultimate-autopair.lua +++ b/lua/dotvim/pkgs/coding/plugins/ultimate-autopair.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "altermo/ultimate-autopair.nvim", gui = "all", diff --git a/lua/dotvim/pkgs/treesitter/init.lua b/lua/dotvim/pkgs/treesitter/init.lua new file mode 100644 index 00000000..1958e636 --- /dev/null +++ b/lua/dotvim/pkgs/treesitter/init.lua @@ -0,0 +1,13 @@ +---@type dotvim.utils +local Utils = require("dotvim.utils") + +---@type dotvim.core.package.PackageOption +return { + name = "treesitter", + plugins = Utils.tbl.flatten_array { + require("dotvim.pkgs.treesitter.plugins.nvim-treesitter"), + require("dotvim.pkgs.treesitter.plugins.just"), + require("dotvim.pkgs.treesitter.plugins.others"), + }, + setup = function() end, +} diff --git a/lua/dotvim/pkgs/treesitter/plugins/just.lua b/lua/dotvim/pkgs/treesitter/plugins/just.lua new file mode 100644 index 00000000..c12e697e --- /dev/null +++ b/lua/dotvim/pkgs/treesitter/plugins/just.lua @@ -0,0 +1,17 @@ +---@type dotvim.core.plugin.PluginOption +return { + "IndianBoy42/tree-sitter-just", + gui = "all", + lazy = true, + config = function() + require("nvim-treesitter.parsers").get_parser_configs().just = { + install_info = { + url = "https://github.com/IndianBoy42/tree-sitter-just", -- local path or git repo + files = { "src/parser.c", "src/scanner.cc" }, + branch = "main", + use_makefile = true, -- this may be necessary on MacOS (try if you see compiler errors) + }, + maintainers = { "@IndianBoy42" }, + } + end, +} diff --git a/lua/dotvim/legacy/packages/treesitter/plugins/nvim-treesitter.lua b/lua/dotvim/pkgs/treesitter/plugins/nvim-treesitter.lua similarity index 98% rename from lua/dotvim/legacy/packages/treesitter/plugins/nvim-treesitter.lua rename to lua/dotvim/pkgs/treesitter/plugins/nvim-treesitter.lua index 93e31bc1..e138896a 100644 --- a/lua/dotvim/legacy/packages/treesitter/plugins/nvim-treesitter.lua +++ b/lua/dotvim/pkgs/treesitter/plugins/nvim-treesitter.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "nvim-treesitter/nvim-treesitter", gui = "all", diff --git a/lua/dotvim/legacy/packages/treesitter/plugins/_others.lua b/lua/dotvim/pkgs/treesitter/plugins/others.lua similarity index 79% rename from lua/dotvim/legacy/packages/treesitter/plugins/_others.lua rename to lua/dotvim/pkgs/treesitter/plugins/others.lua index 942a8feb..eb0df5bf 100644 --- a/lua/dotvim/legacy/packages/treesitter/plugins/_others.lua +++ b/lua/dotvim/pkgs/treesitter/plugins/others.lua @@ -1,21 +1,5 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { - { - "IndianBoy42/tree-sitter-just", - gui = "all", - lazy = true, - config = function() - require("nvim-treesitter.parsers").get_parser_configs().just = { - install_info = { - url = "https://github.com/IndianBoy42/tree-sitter-just", -- local path or git repo - files = { "src/parser.c", "src/scanner.cc" }, - branch = "main", - use_makefile = true, -- this may be necessary on MacOS (try if you see compiler errors) - }, - maintainers = { "@IndianBoy42" }, - } - end, - }, { "windwp/nvim-ts-autotag", gui = "all", diff --git a/lua/dotvim/pkgs/ui/dashboard.lua b/lua/dotvim/pkgs/ui/dashboard.lua new file mode 100644 index 00000000..f161e0c8 --- /dev/null +++ b/lua/dotvim/pkgs/ui/dashboard.lua @@ -0,0 +1,26 @@ +local M = {} + +M.dashboard_header_winnee = { + [[ $$$$F**+ .oW$$$eu]], + [[ ..ueeeWeeo.. e$$$$$$$$$]], + [[ .eW$$$$$$$$$$$$$$$b- d$$$$$$$$$$W]], + [[ ,,,,,,,uee$$$$$$$$$$$$$$$$$$$$$ H$$$$$$$$$$$~]], + [[ :eoC$$$$$$$$$$$C""?$$$$$$$$$$$$$$$ T$$$$$$$$$$"]], + [[ $$$*$$$$$$$$$$$$$e "$$$$$$$$$$$$$$i$$$$$$$$F"]], + [[ ?f"!?$$$$$$$$$$$$$$ud$$$$$$$$$$$$$$$$$$$$*Co]], + [[ $ o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$]], + [[ !!!!m.*eeeW$$$$$$$$$$$f?$$$$$$$$$$$$$$$$$$$$$$$$$$$$$U]], + [[ !!!!!! !$$$$$$$$$$$$$$ T$$$$$$$$$$$$$$$$$$$$$$$$$$$$$]], + [[ *!!*.o$$$$$$$$$$$$$$$e,d$$$$$$$$$$$$$$$$$$$$$$$$$$$$$:]], + [[ "eee$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$C]], + [[b ?$$$$$$$$$$$$$$**$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!]], + [[Tb "$$$$$$$$$$$$$$*uL"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$']], + [[ $$o."?$$$$$$$$F" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$]], + [[ $$$$en ``` .e$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$']], + [[ $$$B* =*"?.e$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$F]], + [[ $$$W"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"]], + [[ "$$$o#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"]], + [[ ?$$$W$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"]], +} + +return M diff --git a/lua/dotvim/pkgs/ui/init.lua b/lua/dotvim/pkgs/ui/init.lua new file mode 100644 index 00000000..b2091853 --- /dev/null +++ b/lua/dotvim/pkgs/ui/init.lua @@ -0,0 +1,14 @@ +---@type dotvim.utils +local Utils = require("dotvim.utils") + +---@type dotvim.core.package.PackageOption +return { + name = "ui", + plugins = Utils.tbl.flatten_array { + require("dotvim.pkgs.ui.plugins._others"), + require("dotvim.pkgs.ui.plugins.alpha"), + require("dotvim.pkgs.ui.plugins.bufferline"), + require("dotvim.pkgs.ui.plugins.lualine"), + require("dotvim.pkgs.ui.plugins.noice"), + }, +} diff --git a/lua/dotvim/legacy/packages/ui/plugins/_others.lua b/lua/dotvim/pkgs/ui/plugins/_others.lua similarity index 93% rename from lua/dotvim/legacy/packages/ui/plugins/_others.lua rename to lua/dotvim/pkgs/ui/plugins/_others.lua index 6a129f46..acf62758 100644 --- a/lua/dotvim/legacy/packages/ui/plugins/_others.lua +++ b/lua/dotvim/pkgs/ui/plugins/_others.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { { "rcarriga/nvim-notify", @@ -66,17 +66,17 @@ return { vim.defer_fn(function() require("notify").setup(opts) - ---@type dora.core.registry - local registry = require("dora.core.registry") + ---@type dotvim.utils + local Utils = require("dotvim.utils") - if registry.has("telescope.nvim") then + if Utils.lazy.has("telescope.nvim") then require("telescope").load_extension("notify") end end, 30) end, actions = function() - ---@type dora.core.action - local action = require("dora.core.action") + ---@type dotvim.core.action + local action = require("dotvim.core.action") return action.make_options { from = "nvim-notify", diff --git a/lua/dotvim/legacy/packages/ui/plugins/alpha.lua b/lua/dotvim/pkgs/ui/plugins/alpha.lua similarity index 95% rename from lua/dotvim/legacy/packages/ui/plugins/alpha.lua rename to lua/dotvim/pkgs/ui/plugins/alpha.lua index 610d0dee..1ff9baa4 100644 --- a/lua/dotvim/legacy/packages/ui/plugins/alpha.lua +++ b/lua/dotvim/pkgs/ui/plugins/alpha.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { { "goolord/alpha-nvim", @@ -14,10 +14,8 @@ return { "nvim-lua/plenary.nvim", }, opts = function() - ---@type dora.lib - local lib = require("dora.lib") - ---@type dora.config - local config = require("dora.config") + ---@type dotvim.utils + local Utils = require("dotvim.utils") local redraw_alpha_autocmd = nil @@ -34,7 +32,7 @@ return { ---@param opts? table local function make_button(sc, txt, callback, opts) opts = opts or {} - local on_press = lib.func.normalize_callback( + local on_press = Utils.fn.normalize_callback( callback, vim.F.if_nil(opts.feedkeys, true) ) @@ -234,13 +232,13 @@ return { local function make_recent_project_buttons() local function _build_buttons() - local recent_projects = lib.func.require_then( + local recent_projects = Utils.fn.require_then( "project_nvim", function(project_nvim) return project_nvim.get_recent_projects() end ) or {} - lib.tbl.list_reverse(recent_projects) + Utils.tbl.list_reverse(recent_projects) local buttons = {} local special_shortcuts = { "a", "s", "d" } @@ -302,7 +300,9 @@ return { local function make_header_liens() local lines = {} - for i, line in ipairs(config.ui.dashboard_header) do + for i, line in + ipairs(require("dotvim.pkgs.ui.dashboard").dashboard_header_winnee) + do lines[i] = { type = "text", val = line, @@ -315,7 +315,7 @@ return { end lines[#lines + 1] = { type = "text", - val = "dora.version: " .. require("dora.version").version(), + val = "dotvim.version: " .. require("dotvim.version").version(), opts = { hl = "SpecialComment", position = "center", @@ -343,7 +343,9 @@ return { buttons[#buttons + 1] = make_button("e", "󱪝 New File", ":ene startinsert ") - if lib.vim.current_gui() ~= nil then + local cwd = vim.fn.getcwd() + + if cwd == "/" then buttons[#buttons + 1] = make_button("p", " Projects", "PickRecentProject", { feedkeys = false, diff --git a/lua/dotvim/legacy/packages/ui/plugins/bufferline.lua b/lua/dotvim/pkgs/ui/plugins/bufferline.lua similarity index 95% rename from lua/dotvim/legacy/packages/ui/plugins/bufferline.lua rename to lua/dotvim/pkgs/ui/plugins/bufferline.lua index 120a2ad6..17b7cfd9 100644 --- a/lua/dotvim/legacy/packages/ui/plugins/bufferline.lua +++ b/lua/dotvim/pkgs/ui/plugins/bufferline.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { { "akinsho/bufferline.nvim", @@ -51,8 +51,8 @@ return { }, }, actions = function() - ---@type dora.core.action - local action = require("dora.core.action") + ---@type dotvim.core.action + local action = require("dotvim.core.action") return action.make_options { from = "bufferline.nvim", diff --git a/lua/dotvim/legacy/packages/ui/plugins/lualine.lua b/lua/dotvim/pkgs/ui/plugins/lualine.lua similarity index 81% rename from lua/dotvim/legacy/packages/ui/plugins/lualine.lua rename to lua/dotvim/pkgs/ui/plugins/lualine.lua index 3ccde188..4ee50a9f 100644 --- a/lua/dotvim/legacy/packages/ui/plugins/lualine.lua +++ b/lua/dotvim/pkgs/ui/plugins/lualine.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption +---@type dotvim.core.plugin.PluginOption return { "nvim-lualine/lualine.nvim", event = "VeryLazy", @@ -13,8 +13,8 @@ return { end end, opts = function() - ---@type dora.config - local config = require("dora.config") + ---@type dotvim.utils + local Utils = require("dotvim.utils") local function cwd() local dir = vim.fn.getcwd() @@ -23,7 +23,7 @@ return { if match == 1 then dir = "~" .. string.sub(dir, #home + 1) end - return config.icon.predefined_icon("FolderOpen", 1) .. dir + return Utils.icon.predefined_icon("FolderOpen", 1) .. dir end local function fileinfo() @@ -64,7 +64,7 @@ return { "mode", icons_enabled = true, icon = { - config.icon.predefined_icon("VimLogo", 1), + Utils.icon.predefined_icon("VimLogo", 1), align = "left", }, }, @@ -77,10 +77,10 @@ return { { "diagnostics", symbols = { - error = config.icon.predefined_icon("DiagnosticError", 1), - warn = config.icon.predefined_icon("DiagnosticWarn", 1), - info = config.icon.predefined_icon("DiagnosticInfo", 1), - hint = config.icon.predefined_icon("DiagnosticHint", 1), + error = Utils.icon.predefined_icon("DiagnosticError", 1), + warn = Utils.icon.predefined_icon("DiagnosticWarn", 1), + info = Utils.icon.predefined_icon("DiagnosticInfo", 1), + hint = Utils.icon.predefined_icon("DiagnosticHint", 1), }, }, "branch", diff --git a/lua/dotvim/legacy/packages/ui/plugins/noice.lua b/lua/dotvim/pkgs/ui/plugins/noice.lua similarity index 95% rename from lua/dotvim/legacy/packages/ui/plugins/noice.lua rename to lua/dotvim/pkgs/ui/plugins/noice.lua index dd1a0395..144b899f 100644 --- a/lua/dotvim/legacy/packages/ui/plugins/noice.lua +++ b/lua/dotvim/pkgs/ui/plugins/noice.lua @@ -1,4 +1,4 @@ ----@type dora.core.plugin.PluginOption[] +---@type dotvim.core.plugin.PluginOption[] return { { "folke/noice.nvim", @@ -14,7 +14,7 @@ return { override = { ["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.stylize_markdown"] = true, - -- ["cmp.entry.get_documentation"] = true, + ["cmp.entry.get_documentation"] = false, }, signature = { enabled = false, @@ -93,8 +93,8 @@ return { end) end, actions = function() - ---@type dora.core.action - local action = require("dora.core.action") + ---@type dotvim.core.action + local action = require("dotvim.core.action") return action.make_options { from = "noice.nvim", diff --git a/lua/dotvim/utils/fn.lua b/lua/dotvim/utils/fn.lua index da9996c3..909c923a 100644 --- a/lua/dotvim/utils/fn.lua +++ b/lua/dotvim/utils/fn.lua @@ -27,6 +27,31 @@ function M.require_then(name, callback) end end +---@param callback string|fun(): any +---@param feedkeys? boolean +---@return fun(): any +function M.normalize_callback(callback, feedkeys) + if type(callback) == "string" then + if feedkeys == true then + return function() + local key = vim.api.nvim_replace_termcodes( + callback .. "", + true, + false, + true + ) + vim.api.nvim_feedkeys(key, "t", false) + end + else + return function() + vim.api.nvim_command(callback) + end + end + else + return callback + end +end + ---@class dotvim.utils.fn.CacheManager ---@field private entries table local CacheManager = {}