-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Groups #938
Groups #938
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
NOT bufferline.txt /*NOT* | ||
NOTE: bufferline.txt /*NOTE:* | ||
bufferline bufferline.txt /*bufferline* | ||
bufferline-colorscheme-development bufferline.txt /*bufferline-colorscheme-development* | ||
bufferline-commands bufferline.txt /*bufferline-commands* | ||
bufferline-configuration bufferline.txt /*bufferline-configuration* | ||
bufferline-contents bufferline.txt /*bufferline-contents* | ||
bufferline-custom-areas bufferline.txt /*bufferline-custom-areas* | ||
bufferline-diagnostics bufferline.txt /*bufferline-diagnostics* | ||
bufferline-filtering bufferline.txt /*bufferline-filtering* | ||
bufferline-functions bufferline.txt /*bufferline-functions* | ||
bufferline-group-commands bufferline.txt /*bufferline-group-commands* | ||
bufferline-groups bufferline.txt /*bufferline-groups* | ||
bufferline-highlights bufferline.txt /*bufferline-highlights* | ||
bufferline-hover-events bufferline.txt /*bufferline-hover-events* | ||
bufferline-introduction bufferline.txt /*bufferline-introduction* | ||
bufferline-issues bufferline.txt /*bufferline-issues* | ||
bufferline-mappings bufferline.txt /*bufferline-mappings* | ||
bufferline-mouse-actions bufferline.txt /*bufferline-mouse-actions* | ||
bufferline-numbers bufferline.txt /*bufferline-numbers* | ||
bufferline-offset bufferline.txt /*bufferline-offset* | ||
bufferline-ordering-groups bufferline.txt /*bufferline-ordering-groups* | ||
bufferline-pick bufferline.txt /*bufferline-pick* | ||
bufferline-pinning bufferline.txt /*bufferline-pinning* | ||
bufferline-regular-tabs bufferline.txt /*bufferline-regular-tabs* | ||
bufferline-sorting bufferline.txt /*bufferline-sorting* | ||
bufferline-style-presets bufferline.txt /*bufferline-style-presets* | ||
bufferline-styling bufferline.txt /*bufferline-styling* | ||
bufferline-tabpages bufferline.txt /*bufferline-tabpages* | ||
bufferline-usage bufferline.txt /*bufferline-usage* | ||
bufferline-working-with-elements bufferline.txt /*bufferline-working-with-elements* | ||
bufferline.nvim bufferline.txt /*bufferline.nvim* | ||
optional bufferline.txt /*optional* | ||
strongly bufferline.txt /*strongly* | ||
vertical bufferline.txt /*vertical* | ||
your bufferline.txt /*your* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ local tabpages = lazy.require("bufferline.tabpages") ---@module "bufferline.tabp | |
local highlights = lazy.require("bufferline.highlights") ---@module "bufferline.highlights" | ||
local hover = lazy.require("bufferline.hover") ---@module "bufferline.hover" | ||
|
||
local get_tabline_text_and_highlights = require("bufferline.pr").get_tabline_text_and_highlights | ||
|
||
-- @v:lua@ in the tabline only supports global functions, so this is | ||
-- the only way to add click handlers without autoloaded vimscript functions | ||
_G.___bufferline_private = _G.___bufferline_private or {} -- to guard against reloads | ||
|
@@ -50,6 +52,8 @@ local M = { | |
} | ||
-----------------------------------------------------------------------------// | ||
|
||
local capture_next_render = false | ||
|
||
--- @return string, bufferline.Segment[][] | ||
local function bufferline() | ||
local is_tabline = config:is_tabline() | ||
|
@@ -83,6 +87,13 @@ local function bufferline() | |
left_offset_size = tabline.left_offset_size, | ||
right_offset_size = tabline.right_offset_size, | ||
}) | ||
|
||
-- :BufferLineDebug -> prints the rendered tabline from the BufferLineDebug command | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this command should be added at all tbh, fine to use something like this whilst debugging but not looking to have this sort of functionality exposed especially using global state like it appears to |
||
if capture_next_render then | ||
print("Current Tabline and Highlights:\n" .. vim.inspect(get_tabline_text_and_highlights(tabline.str))) | ||
capture_next_render = false | ||
end | ||
|
||
return tabline.str, tabline.segments | ||
end | ||
|
||
|
@@ -179,6 +190,22 @@ local function setup_commands() | |
nargs = 1, | ||
complete = groups.complete, | ||
}) | ||
--- New commands | ||
--- 1. Print the current rendered tabline so users can easily find which Highlight group to change | ||
command("BufferLineDebug", function() | ||
debug_tabline = true | ||
ui.refresh() | ||
end, { nargs = 0 }) | ||
-- 2. Remove Command to remove a single buffer from a Group instead of only allowing buffer naming to control groups | ||
-- Moves the buf from the group to the ungrouped group | ||
command("BufferLineRemove", function(opts) | ||
local args = vim.split(opts.args, " ") | ||
local buffer_id, group_id = tonumber(args[1]), args[2] | ||
if buffer_id and group_id then | ||
groups.remove_buf_from_group(buffer_id, group_id) | ||
ui.refresh() | ||
end | ||
end, { nargs = "+", complete = function(ArgLead, CmdLine, CursorPos) return {} end }) | ||
end | ||
|
||
local function setup_diagnostic_handler(preferences) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -671,7 +671,10 @@ local function get_defaults() | |
diagnostics_update_in_insert = true, | ||
diagnostics_update_on_event = true, | ||
offsets = {}, | ||
groups = { items = {}, options = { toggle_hidden_on_enter = true } }, | ||
groups = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing defaults like this would require some conversation and convincing. |
||
items = {}, | ||
options = { toggle_hidden_on_enter = true, separator_position = "both", separator_style = "thin" }, | ||
}, | ||
hover = { enabled = false, reveal = {}, delay = 200 }, | ||
debug = { logging = false }, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file should not be committed I believe this is something generated locally IIRC