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

opts.[direction].title should accept string and function #59

Closed
1 task done
tummetott opened this issue Nov 12, 2023 · 2 comments · Fixed by #90 or #97
Closed
1 task done

opts.[direction].title should accept string and function #59

tummetott opened this issue Nov 12, 2023 · 2 comments · Fixed by #90 or #97
Labels
enhancement New feature or request stale

Comments

@tummetott
Copy link

tummetott commented Nov 12, 2023

Did you check the docs?

  • I have read all the edgy.nvim docs

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

It would be awesome if opts.[direction].title can accept a string and a function (the functions must return a string).

Two use cases:

bottom = {
    {
        -- Indicate in the windbar which help file is currently open
        title = function() local bufname = vim.api.nvim_buf_get_name(0)
            bufname = vim.fn.fnamemodify(bufname, ':t')
            return string.format('HELP: %s', bufname)
        end,
        ft = 'help',
    },
    {
        -- Indicate whether the location list or quickfix list is currently
        -- displayed
        title = function()
            local loclist = vim.fn.getwininfo(vim.fn.win_getid())[1]['loclist'] == 1
            return loclist and 'LOCATION LIST' or 'QUICKFIX LIST'
        end,
        ft = 'qf',
    }
}

Describe the solution you'd like

opts.[direction].title accepts string and function

Describe alternatives you've considered

Disabling the winbar winbar = false for a filetype and handling it manually with my winbar plugin. However this is a workaround and i'd love to handle all the winbar titles in edgy.nvim

Additional context

No response

@tummetott tummetott added the enhancement New feature or request label Nov 12, 2023
@tummetott tummetott changed the title opts.[direction].title should accept string **and function** opts.[direction].title should accept string and function Nov 12, 2023
@tummetott
Copy link
Author

I realized I can solve the second use case with the filter() function:

{
    title = 'QUICKFIX LIST',
    filter = function(_, win)
        return vim.fn.getwininfo(win)[1]['loclist'] ~= 1
    end,
    ft = 'qf',
},
{
    title = 'LOCATION LIST',
    filter = function(_, win)
        return vim.fn.getwininfo(win)[1]['loclist'] == 1
    end,
    ft = 'qf',
},

However, in cases where a single filetype covers various instances, like help documents and manpages, it would be very helpful to have the filename or bufname included in the winbar information. This feature request is kindly submitted for consideration, aiming to enhance user experience.

gj86 added a commit to gj86/edgy.nvim that referenced this issue Jun 21, 2024
Accept and use function as view title. This provides option to implement per view dynamic/context based title.
Copy link
Contributor

github-actions bot commented Jul 6, 2024

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 Jul 6, 2024
@folke folke closed this as completed in #90 Jul 7, 2024
@folke folke closed this as completed in cdb740f Jul 7, 2024
folke pushed a commit that referenced this issue Jul 7, 2024
🤖 I have created a release *beep* *boop*
---


## [1.10.0](v1.9.1...v1.10.0)
(2024-07-07)


### Features

* **title:** implement dynamic view title feature
([#90](#90))
([cdb740f](cdb740f)),
closes [#59](#59)
* **view:** add collapsed on start option to pinned views
([#89](#89))
([2546a8e](2546a8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
1 participant