summaryrefslogtreecommitdiffstatshomepage
path: root/nvim
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-10-04 11:45:02 -0500
committerToby Vincent <tobyv13@gmail.com>2022-10-04 11:45:02 -0500
commitc480adcf9ea5064df4a23a1575294deeae30f85e (patch)
tree1d02725fb333511777d0a0943141c31bd2345ce4 /nvim
parentd23e3bd34f6e096416c741a227702a8d8c9ebe76 (diff)
fix(nvim): fix filetype filter for MRU
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua b/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua
index 5c23d86..66b6881 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/alpha.lua
@@ -1,17 +1,13 @@
---@diagnostic disable: missing-parameter
-local Filetype = require("plenary.filetype")
local Icons = require("nvim-web-devicons")
local utils = require("tobyvin.utils")
local M = {
position = "center",
width = 60,
}
----@alias Alignment
----| '"left"' # Left align
----| '"right"' # Right align
----| '"center"' # Center align
+
--- @param str string
---- @param position Alignment | string
+--- @param position '"left"' | '"right"' | '"center"'
M.format_string = function(str, position)
local fmt
if position == "right" then
@@ -63,7 +59,10 @@ end
M.file_button = function(filename, sc)
local short_fn = utils.fs.shorten_path(filename, M.width)
local hl = {}
- local ico, ico_hl = Icons.get_icon_by_filetype(Filetype.detect(filename), { default = true })
+
+ 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(".*[/\\]")
@@ -77,12 +76,13 @@ M.file_button = function(filename, sc)
end
M.mru_filter = function(filename)
- local ignored_ft = { "Git.*" }
+ local ignored_ft = { "gitcommit" }
local cwd = vim.fn.getcwd()
- local ft = vim.F.if_nil(Filetype.detect(filename), "")
+ local filetype, _ = vim.filetype.match({ filename = filename })
+ filetype = vim.F.if_nil(filetype, "")
local ignored = false
for _, pattern in pairs(ignored_ft) do
- ignored = ignored or ft:match(pattern) ~= nil
+ ignored = ignored or filetype:match(pattern) ~= nil
end
return not ignored and (vim.fn.filereadable(filename) == 1) and vim.startswith(filename, cwd)
end