From c114437cfceb645d4a82d6c63f99c84185b19c26 Mon Sep 17 00:00:00 2001 From: Davey Hughes Date: Mon, 23 Sep 2024 13:06:00 -0700 Subject: [PATCH] Add ability to hide shortcut in hyper theme --- README.md | 3 ++- lua/dashboard/theme/hyper.lua | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4e60852..6513499 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,8 @@ when use `hyper` theme the available options in `config` is config = { shortcut = { -- action can be a function type - { desc = string, group = 'highlight group', key = 'shortcut key', action = 'action when you press key' }, + -- if hide == true, prevents the shortcut from being shown on the dashboard (defaults to false) + { desc = string, group = 'highlight group', key = 'shortcut key', action = 'action when you press key', hide = boolean }, }, packages = { enable = true }, -- show how many plugins neovim loaded -- limit how many projects list, action when you press key or enter it will run this action. diff --git a/lua/dashboard/theme/hyper.lua b/lua/dashboard/theme/hyper.lua index 2da09be..d738f61 100644 --- a/lua/dashboard/theme/hyper.lua +++ b/lua/dashboard/theme/hyper.lua @@ -16,11 +16,13 @@ local function gen_shortcut(config) local lines = '' for _, item in pairs(shortcut) do - local str = item.icon and item.icon .. item.desc or item.desc - if item.key then - str = str .. '[' .. item.key .. ']' + if not item.hide then + local str = item.icon and item.icon .. item.desc or item.desc + if item.key then + str = str .. '[' .. item.key .. ']' + end + lines = lines .. ' ' .. str end - lines = lines .. ' ' .. str end local first_line = api.nvim_buf_line_count(config.bufnr)