Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ config = {
-- action can be a function type, e.g.
-- action = func(path) vim.cmd('Telescope find_files cwd=' .. path) end
project = { enable = true, limit = 8, icon = 'your icon', label = '', action = 'Telescope find_files cwd=' },
mru = { enable = true, limit = 10, icon = 'your icon', label = '', cwd_only = false },
mru = { enable = true, limit = 10, icon = 'your icon', label = '', cwd_only = false, excluded_paths = { '/path/to/exclude/' } },
footer = {}, -- footer
}
```
Expand Down
16 changes: 16 additions & 0 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ local function mru_list(config)
label = ' Most Recent Files:',
cwd_only = false,
enable = true,
excluded_paths = {},
}, config.mru or {})

if not config.mru.enable then
Expand All @@ -201,6 +202,21 @@ local function mru_list(config)
end, mlist)
end

if next(config.mru.excluded_paths) ~= nil then -- check if table exists
mlist = vim.tbl_filter(function(file)
local file_path = vim.fn.fnamemodify(file, ':p')
local file_dir = vim.fn.fnamemodify(file_path, ':h') .. '/'
for _, exclude in ipairs(config.mru.excluded_paths) do
local exclude_path = vim.fn.fnamemodify(exclude, ':p')
local exclude_dir = vim.fn.fnamemodify(exclude_path, ':h') .. '/'
if file_dir:sub(1, #exclude_dir) == exclude_dir then
return false
end
end
return true
end, mlist)
end

local blank_size = config.shortcuts_left_side and 4 or 3
for _, file in pairs(vim.list_slice(mlist, 1, config.mru.limit)) do
local filename = vim.fn.fnamemodify(file, ':t')
Expand Down