Skip to content

Commit 5f29798

Browse files
feat(hyper): add mru.enable option (#494)
1 parent d2c5a4d commit 5f29798

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ config = {
9999
-- action can be a functino type, e.g.
100100
-- action = func(path) vim.cmd('Telescope find_files cwd=' .. path) end
101101
project = { enable = true, limit = 8, icon = 'your icon', label = '', action = 'Telescope find_files cwd=' },
102-
mru = { limit = 10, icon = 'your icon', label = '', cwd_only = false },
102+
mru = { enable = true, limit = 10, icon = 'your icon', label = '', cwd_only = false },
103103
footer = {}, -- footer
104104
}
105105
```

lua/dashboard/theme/hyper.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,13 @@ local function mru_list(config)
164164
icon_hl = 'DashboardMruIcon',
165165
label = ' Most Recent Files:',
166166
cwd_only = false,
167+
enable = true,
167168
}, config.mru or {})
168169

170+
if not config.mru.enable then
171+
return {}, {}
172+
end
173+
169174
local list = {
170175
config.mru.icon .. config.mru.label,
171176
}
@@ -352,12 +357,20 @@ local function gen_center(plist, config)
352357
local first_line = api.nvim_buf_line_count(config.bufnr)
353358
api.nvim_buf_set_lines(config.bufnr, first_line, -1, false, plist)
354359

355-
local start_col = plist[plist_len + 2]:find('[^%s]') - 1
360+
if not config.project.enable and not config.mru.enable then
361+
return
362+
end
363+
356364
local _, scol = plist[2]:find('%S')
357365
if scol == nil then
358366
scol = 0
359367
end
360368

369+
local start_col = scol
370+
if config.mru.enable then
371+
start_col = plist[plist_len + 2]:find('[^%s]') - 1
372+
end
373+
361374
local hotkey = gen_hotkey(config)
362375

363376
api.nvim_buf_add_highlight(config.bufnr, 0, 'DashboardProjectTitle', first_line + 1, 0, -1)

0 commit comments

Comments
 (0)