-
Notifications
You must be signed in to change notification settings - Fork 84
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: specify icons
per buffer activity/state
#386
Conversation
29b3ac2
to
0d498bd
Compare
Prevents us having to check and see if `vim.deprecate` is available (since that is 0.8 functionality, and we only require `0.7`)
15a9340
to
d363239
Compare
Very nice, a nice think to have maybe is the pinned tabs be always visible (for a next task) |
dee5155
to
db61a29
Compare
@otavioschwanck feel free to try this PR now, I've been using it for about a day and haven't gotten any errors (but that usually means they're hiding, so an extra tester would be helpful!). I believe your desired configuration would be: require'bufferline'.setup {
icons = {
pinned = {
buffer_index = true,
},
},
} Feel free to make another issue for keeping pinned tabs visible. |
Some issues: If we set the deprecated options, barbar throw an error and close itself. i think the close = 'icon' is a strange option. i had to do that:
Maybe something like: left, icon or button, idk, |
Thanks for sacrificing some time out of your busy schedule! I appreciate it. This is a lot of code; I wanted to get your OK on the high-level concepts even if you didn't have time to go line-by-line. I'll test it one more time before merging. |
The `options` module now caches `g:bufferline`. The cache is updated when either of the following happens: * `bufferline.setup` is called * A key in `g:bufferline` is `:let`-ed in Vimscript Anyone doing `vim.g.bufferline.foo = bar` _in Lua_ should be doing `.setup` by this point.
Prevents clobbering existing settings. Also a performance improvement.
`render.update` now automatically calls `redrawtabline` when necessary
This falls in line with other `vim` methods (e.g. `vim.list_slice`) and our own `utils.list_slice_from_end`
Having a lot of buffers open degrates the performance of the `render.update` call linearly. This commit ensures that no calculations are done in `render` before entering and after exiting the viewport.
We were making a lot of repeat API calls in the `utils.hl` module, so I added a cache for when `utils.hl` is called
This PR allows customization of the
bufferline.icons
setting per activity / state, like so:When multiple options match (e.g.
icons.separator
,icons.modified.separator
, andicons.alternate.separator
), precedence works as follows:icons.(alternate|current|inactive|visible).(modified|pinned).foo
, if the buffer is modified or pinnedicons.(modified|pinned).foo
, if the buffer is modified or pinnedicons.(alternate|current|inactive|visible).foo
icons.foo
Users who specify their
icons
/icon_separator_active
/etc options the old way are prompted with a deprecation notice, but no action is necessary. The old options are automatically translated to the new format, and this will continue until a theoretical v2.0.0 releases.This seemed like the best compromise between letting a user provide a
function
(my initial proposal) and adhering to the simplicity of user configuration (romgrk's preference).Closes #46.
Closes #243.
Closes #379.