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

feat: add builtin source for terminal buffers #78

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

willothy
Copy link
Collaborator

@willothy willothy commented Sep 2, 2023

Allows using the dropdown menu to quickly switch between terminal buffers. Wrote this for my own config but figured I'd share since it's been useful.

All menu properties can be set to either strings or functions in the config, so it can be integrated easily with any terminal-related plugin. I have mine setup to use toggleterm. It will also work with default nvim terminal buffers.

@willothy willothy force-pushed the terminal-source branch 2 times, most recently from d561ccd to 7128566 Compare September 2, 2023 07:16
@Bekaboo
Copy link
Owner

Bekaboo commented Sep 2, 2023

@willothy Thanks, just tested it and it works smoothly. Could you include the changed of the default config in readme and vimdoc and label this as a breaking change? Also we need to explain how to customize the new terminal source, e.g. how to change the name/color/icon of terminal appearing in the winbar, corresponding hlgroups, etc. Lastly it would be nice to include the current terminal itself in the drop-down menu to better align with the behavior of other sources.

@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

@willothy Thanks, just tested it and it works smoothly. Could you include the changed of the default config in readme and vimdoc and label this as a breaking change?

Definitely, will update the docs. Glad it's working well!

Also we need to explain how to customize the new terminal source, e.g. how to change the name/color/icon of terminal appearing in the winbar, corresponding hlgroups, etc.

I can provide an example from my config in the docs, if that works?

Lastly it would be nice to include the current terminal itself in the drop-down menu to better align with the behavior of other sources.

This actually is already an option (opts.sources.terminal.show_current), I'll make it the default setting though.

@Bekaboo
Copy link
Owner

Bekaboo commented Sep 2, 2023

Also we need to explain how to customize the new terminal source, e.g. how to change the name/color/icon of terminal appearing in the winbar, corresponding hlgroups, etc.

I can provide an example from my config in the docs, if that works?

No, I mean explaining each option that terminal source accepts in README sources section and also update the full config table, you might also want to update the hlgroups and icons used, there is a separate section listing all highlight groups used by dropbar. Notice that these updates also applies to the vimdoc help file.

@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

No, I mean explaining each option that terminal source accepts in README sources section and also update the full config table, you might also want to update the hlgroups and icons used, there is a separate section listing all highlight groups used by dropbar. Notice that these updates also applies to the vimdoc help file.

Oh, yes, definitely was going to do that, I meant in addition to that to show an example of integration with another plugin (toggleterm).

Will update the hlgroups as well.

@Bekaboo
Copy link
Owner

Bekaboo commented Sep 2, 2023

I meant in addition to that to show an example of integration with another plugin (toggleterm).

That will be really nice, looking forward for the update!

@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

Working on it right now, though it's late here so might end up finishing the changes tomorrow.

@Bekaboo
Copy link
Owner

Bekaboo commented Sep 2, 2023

@willothy Take your time, we are not in a hurry :)

@willothy willothy force-pushed the terminal-source branch 6 times, most recently from 522e4f4 to db833bf Compare September 2, 2023 09:48
@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

Alright, I think the current setup of hlgroups works well. Is there a different icon that would be preferable?

Updating to use devicons.

@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

I think that's everything, let me know what you think!

@willothy willothy force-pushed the terminal-source branch 2 times, most recently from 8550954 to 21f5b3f Compare September 2, 2023 10:04
@Bekaboo
Copy link
Owner

Bekaboo commented Sep 2, 2023

@willothy Looks great! Could you move the icon customization under opts.icons.kinds and use a fixed hlgroup name? IMO allowing user to change the actual hlgroup used directly could easily cause confusion and increase the work of colorscheme authors, could we use a fixed highlight group for icons/names of terminal buffers in the winbar? Users can still customize the colors using vim.api.nvim_set_hl(). You can check lua/hlgroups.lua for refrence and define the default highlight groups there -- my suggestion is leaving the text highlight group undefined so that they follow hl-WinBar or hl-WinBarNC and only define the icon colors.

@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

@willothy Looks great! Could you move the icon customization under opts.icons.kinds

I actually think the icon customization for the terminal should stay where it is, because the API for it differs from the regular kind icons as it can accept a function for per-terminal dynamic icons. The reason for this is that people may want to show different icons depending on things like the process running in the terminal, like using the git devicon for a lazygit terminal, etc..

IMO allowing user to change the actual hlgroup used directly could easily cause confusion and increase the work of colorscheme authors, could we use a fixed highlight group for icons/names of terminal buffers in the winbar?

That makes sense, will do. Is it reasonable to create a new group such as DropBarIconKindTerminal?

@willothy
Copy link
Collaborator Author

willothy commented Sep 2, 2023

Moved the highlight groups, but I left the icon customization where it is for now as I think it would be confusing to have that in the same place as the kind icons.

Edit: reworked it so that by default the icon will be icons.kinds.symbols.Terminal, and it will use devicons if icons.kinds.use_devicons is set to true, however it can still be overridden with sources.terminal.icon.

allows using the dropdown menu to quickly switch between terminal buffers
@Bekaboo Bekaboo merged commit 6b88dab into Bekaboo:master Sep 3, 2023
4 checks passed
willothy added a commit to willothy/dropbar.nvim that referenced this pull request Sep 3, 2023
allows using the dropdown menu to quickly switch between terminal buffers
willothy added a commit to willothy/dropbar.nvim that referenced this pull request Sep 3, 2023
allows using the dropdown menu to quickly switch between terminal buffers
willothy added a commit to willothy/dropbar.nvim that referenced this pull request Sep 3, 2023
allows using the dropdown menu to quickly switch between terminal buffers
willothy added a commit to willothy/dropbar.nvim that referenced this pull request Sep 4, 2023
allows using the dropdown menu to quickly switch between terminal buffers
willothy added a commit to willothy/dropbar.nvim that referenced this pull request Sep 4, 2023
allows using the dropdown menu to quickly switch between terminal buffers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants