vim-tpipeline
vim-tpipeline copied to clipboard
No support for mouse events
Describe the bug
When installing vim-tpipeline alongside Zeioth/heirline-components.nvim you can no longer click on the the clickable components such as git_branch, git_diff, diagnostics, lsp, etc. for quick access to info and actions.
To reproduce
- Install
vimpostor/vim-tpipeline - Install
zeioth/heirline-components.nvim - Configure heirline statusline with any component implementing
on_click
Expected behavior
Statusline components should behave normally with clickable sections
Terminal emulator
Kitty
Debug output
#[fg=#6c7689,bg=#2e323c]#[fg=#14141f,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg=#f5f6fa,bg=#14141f]#[fg=#6c7689,bg=#2e323c]#[fg=#f5f6fa,bg=#14141f] lua_ls, stylua#[fg=#6c7689,b
g=#2e323c]#[fg=#14141f,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg=#4caf50,bg=#14141f] TS#[fg=#6c7689,bg=#2e323c]#[fg=#51a0cf,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg=#00bcd4,bg=#14141f]lua#[fg=#6c7689,bg=#2e323c]#[fg=#00bcd4,bg=#14141f]#[fg=#6c7689,bg=#
2e323c]#[fg=#14141f,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg=#14141f,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg=#f5f6fa,bg=#14141f] 46:15#[fg=#6c7689,bg=#2e323c]#[fg=#f5f6fa,bg=#14141f] 29%#[fg=#6c7689,bg=#2e323c]#[fg=#78dce8,bg=#14141f] ▃▃#[fg=#6c7689,bg
=#2e323c]#[fg=#4caf50,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg=#2e323c,bg=#4caf50] #[fg=#6c7689,bg=#2e323c]'], 'job_state': 'run as PID 68109', 'bad_colors': 14, 'job_errors': [], 'tpipeline_size': 255, 'version_info': '{ api_compatible = 0, api_leve
l = 11, api_prerelease = false, major = 0, minor = 9, patch = 5, prerelease = false }', 'tmux': 'tmux 3.4', 'left': ['#[fg=#6c7689,bg=#2e323c]#[fg=#2e323c,bg=#4caf50] #[fg=#6c7689,bg=#2e323c]#[fg=#4caf50,bg=#14141f] #[fg=#6c7689,bg=#2e323c]#[fg
=#f5f6fa,bg=#14141f]'], 'plugin_version': '1.0', 'native_highlights': [{'group': 'Stl2e323c_4CAF50__', 'start': 0}, {'group': 'StatusLine', 'start': 1}, {'group': 'Stl4CAF50_14141f__', 'start': 1}, {'group': 'StatusLine', 'start': 3}, {'group': 'Stlf5f6fa
_14141f__', 'start': 3}, {'group': 'StatusLine', 'start': 31}, {'group': 'Stlf5f6fa_14141f__', 'start': 31}, {'group': 'StatusLine', 'start': 60}, {'group': 'Stl14141f_14141f__', 'start': 60}, {'group': 'StatusLine', 'start': 62}, {'group': 'Stlf5f6fa_141
41f__', 'start': 62}, {'group': 'StatusLine', 'start': 62}, {'group': 'Stlf5f6fa_14141f__', 'start': 62}, {'group': 'StatusLine', 'start': 81}, {'group': 'Stl14141f_14141f__', 'start': 81}, {'group': 'StatusLine', 'start': 83}, {'group': 'Stl4CAF50_14141f
__', 'start': 83}, {'group': 'StatusLine', 'start': 89}, {'group': 'Stl51a0cf_14141f__', 'start': 89}, {'group': 'StatusLine', 'start': 94}, {'group': 'Stl00BCD4_14141f__', 'start': 94}, {'group': 'StatusLine', 'start': 97}, {'group': 'Stl00BCD4_14141f__'
, 'start': 97}, {'group': 'StatusLine', 'start': 97}, {'group': 'Stl14141f_14141f__', 'start': 97}, {'group': 'StatusLine', 'start': 99}, {'group': 'Stl14141f_14141f__', 'start': 99}, {'group': 'StatusLine', 'start': 101}, {'group': 'Stlf5f6fa_14141f__',
'start': 101}, {'group': 'StatusLine', 'start': 107}, {'group': 'Stlf5f6fa_14141f__', 'start': 107}, {'group': 'StatusLine', 'start': 111}, {'group': 'Stl78dce8_14141f__', 'start': 111}, {'group': 'StatusLine', 'start': 118}, {'group': 'Stl4CAF50_14141f__
', 'start': 118}, {'group': 'StatusLine', 'start': 120}, {'group': 'Stl2e323c_4CAF50__', 'start': 120}, {'group': 'StatusLine', 'start': 121}], 'os': 'MacOS', 'stl': '%{%v:lua.require''heirline''.eval_statusline()%}'}
Using this to create a basic heirline statusline config to use with Lazy...
local M = {}
function M.opts()
local lib = require("heirline-components.all")
return {
opts = {
disable_winbar_cb = function(args) -- We do this to avoid showing it on the greeter.
local is_disabled = not require("heirline-components.buffer").is_valid(args.buf)
or lib.condition.buffer_matches({
buftype = { "terminal", "prompt", "nofile", "help", "quickfix" },
filetype = { "NvimTree", "neo%-tree", "dashboard", "Outline", "aerial" },
}, args.buf)
return is_disabled
end,
},
tabline = { -- UI upper bar
lib.component.tabline_conditional_padding(),
lib.component.tabline_buffers(),
lib.component.fill({ hl = { bg = "tabline_bg" } }),
lib.component.tabline_tabpages(),
},
winbar = { -- UI breadcrumbs bar
init = function(self)
self.bufnr = vim.api.nvim_get_current_buf()
end,
fallthrough = false,
-- Winbar for terminal, neotree, and aerial.
{
condition = function()
return not lib.condition.is_active()
end,
{
lib.component.neotree(),
lib.component.compiler_play(),
lib.component.fill(),
lib.component.compiler_build_type(),
lib.component.compiler_redo(),
lib.component.aerial(),
},
},
-- Regular winbar
{
lib.component.neotree(),
lib.component.compiler_play(),
lib.component.fill(),
lib.component.breadcrumbs(),
lib.component.fill(),
lib.component.compiler_redo(),
lib.component.aerial(),
},
},
statuscolumn = { -- UI left column
init = function(self)
self.bufnr = vim.api.nvim_get_current_buf()
end,
lib.component.signcolumn(),
lib.component.numbercolumn(),
lib.component.foldcolumn(),
} or nil,
statusline = { -- UI statusbar
hl = { fg = "fg", bg = "bg" },
lib.component.mode(),
lib.component.git_branch(),
lib.component.git_diff(),
lib.component.diagnostics(),
lib.component.fill(),
lib.component.cmd_info(),
lib.component.fill(),
lib.component.lsp(),
lib.component.compiler_state(),
lib.component.virtual_env(),
lib.component.treesitter(),
lib.component.file_info(),
lib.component.nav(),
lib.component.mode({ surround = { separator = "right" } }),
},
}
end
function M.config(_, opts)
local heirline = require("heirline")
local heirline_components = require("heirline-components.all")
-- Setup
heirline_components.init.subscribe_to_events()
heirline.load_colors(heirline_components.hl.get_colors())
heirline.setup(opts)
end
return M
Yeah, right now the vim->tmux bridge does not implement translation of click events.
The tmux mouse support is also not really the greatest (read MOUSE SUPPORT in man tmux(1)), meaning this one is a tough one to implement. It requires the translation from tmux mouse_x, mouse_y location back to the statusline components and on top of that some architectural changes to communicate back to vim (previously every feature only required unidirectional communication).
It's not a lot of work, but still the work needs to be done. For me personally the feature is not really of importance as I have never used the mouse in vim, but I would be willing to merge a PR.