diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-12-24 18:56:25 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-12-24 18:56:25 -0600 |
commit | 4061c17d9951e45646807c205e7aa6388bc773b5 (patch) | |
tree | d4b58af17a5eaa30b7db4d5ba7109c766e5786c0 /nvim | |
parent | 6b886d52c4c7c106a1af3e2e5cdd47eec880bfa4 (diff) |
perf(nvim): remove dep for alpha
Diffstat (limited to 'nvim')
-rw-r--r-- | nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua b/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua index 4385fb0..73581ff 100644 --- a/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua +++ b/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua @@ -1,7 +1,6 @@ local M = { "goolord/alpha-nvim", lazy = false, - dependencies = { "kyazdani42/nvim-web-devicons" }, } function M.init() @@ -20,44 +19,38 @@ end function M.config() local alpha = require("alpha") - local Icons = require("nvim-web-devicons") local utils = require("tobyvin.utils") + local width = 60 local file_button = function(filename, sc) - local short_fn = utils.fs.shorten_path(filename, 60) + local short_fn = utils.fs.shorten_path(filename, width - 4) local hl = {} - local filetype, _ = vim.filetype.match({ filename = filename }) - filetype = vim.F.if_nil(filetype, "") - local ico, ico_hl = Icons.get_icon_by_filetype(filetype, { default = true }) - table.insert(hl, { ico_hl, 0, 3 }) - local ico_txt = ico .. " " local fn_start = short_fn:match(".*[/\\]") if fn_start ~= nil then - table.insert(hl, { "Comment", #ico_txt - 2, #fn_start + #ico_txt }) + table.insert(hl, { "Comment", 0, #fn_start }) + end + + local edit = function() + vim.cmd.edit(filename) end - local keybind = "<Cmd>e " .. filename .. " <CR>" - local button = { + return { type = "button", - val = ico_txt .. short_fn, - on_press = function() - local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true) - vim.api.nvim_feedkeys(key, "t", false) - end, + val = short_fn, + on_press = edit, opts = { position = "center", shortcut = "[" .. sc .. "]", - cursor = 60, - width = 60, + cursor = width - 2, + width = width, align_shortcut = "right", hl = hl, hl_shortcut = { { "Special", 0, 1 }, { "Number", 1, #sc + 1 }, { "Special", #sc + 1, #sc + 2 } }, shrink_margin = false, - keymap = { "n", sc:gsub("%s", ""), keybind, { desc = "oldfile_" .. sc } }, + keymap = { "n", sc:gsub("%s", ""), edit, { desc = "oldfile_" .. sc } }, }, } - return button end local mru_filter = function(filename) |