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

feature: Footer generalized to all windows #361

Open
1 task done
vdegenne opened this issue Dec 20, 2024 · 1 comment · May be fixed by #363
Open
1 task done

feature: Footer generalized to all windows #361

vdegenne opened this issue Dec 20, 2024 · 1 comment · May be fixed by #363
Labels
enhancement New feature or request stale

Comments

@vdegenne
Copy link
Contributor

Did you check the docs?

  • I have read all the snacks.nvim docs

Is your feature request related to a problem? Please describe.

The scratch window has a nice footer that show registered keys:

image

It'd be real nice to have this feature available for all windows made using the Snacks.win utility.

Describe the solution you'd like

I believe that's the code responsible for showing the footer in the scratch window:

ret.opts.footer = {}
table.sort(ret.keys, function(a, b)
return a[1] < b[1]
end)
for _, key in ipairs(ret.keys) do
local keymap = vim.fn.keytrans(Snacks.util.keycode(key[1]))
table.insert(ret.opts.footer, { " " })
table.insert(ret.opts.footer, { " " .. keymap .. " ", "SnacksScratchKey" })
table.insert(ret.opts.footer, { " " .. (key.desc or keymap) .. " ", "SnacksScratchDesc" })
end
table.insert(ret.opts.footer, { " " })
for _, t in ipairs(ret.opts.footer) do
t[2] = t[2] or "SnacksScratchFooter"
end

If only this could get moved to the win utility instead, with a flag set to false by default that hides the footer (i.e. that prevents the code above from running using a conditional jump).
So we could write:

Snacks.config.style('mystyle', {
  position = "float",
  ...
  keys = {
    { '<c-m>', ..., desc = 'do something' },
    ...
  },
  show_footer = true
})

Describe alternatives you've considered

...

Additional context

No response

@vdegenne vdegenne added the enhancement New feature or request label Dec 20, 2024
@vdegenne vdegenne linked a pull request Dec 20, 2024 that will close this issue
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant