Skip to content
Discussion options

You must be logged in to vote

https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md#%EF%B8%8F-config

Note

There is no way to differentiate which section an item is related to.
It would be nice to pass some field to ctx to be able to distinguish which section an item belongs to.

dashboard = {
  formats = {
    file = function(item, ctx)
      -- local fname = vim.fn.fnamemodify(item.file, ":~")
      local fname = vim.fn.fnamemodify(item.file, ":.")
      fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname
      if #fname > ctx.width then
        local dir = vim.fn.fnamemodify(fname, ":h")
        local file = vim.fn.fnamemodify(fname, ":t")
        if dir and file then
          f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kliu99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants