Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to hide shortcut in hyper theme #485

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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.
Expand Down
10 changes: 6 additions & 4 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down