vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

Add support for statuscolumn and foldcolumn in offscreen matches

Open Subjective opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. This is a continuation of the issue brought up in https://github.com/andymass/vim-matchup/issues/305#issuecomment-1656033581. The problem has to do with the fact that the number column in the popup window is not formatted the same as in the user's statuscolumn, which may cause the line numbers in the popup to be misaligned. It also seems like the foldcolumn is not properly rendered.

Here's a minimal config to reproduce the issue. It sets a custom status column with right-aligned relative number/numbers and the sign-column on the right. More possible example configurations can be found in :help status-line.

repro.lua
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	{ "catppuccin/nvim", name = "catppuccin" },
	{
		"andymass/vim-matchup",
		init = function()
			vim.opt.relativenumber = true
			vim.opt.number = true
			vim.opt.signcolumn = "yes"
			vim.g.matchup_matchparen_offscreen = { method = "popup", fullwidth = 1, syntax_hl = 1 }
			vim.o.statuscolumn = "%=%{v:relnum?v:relnum:v:lnum}%s"
		end,
	},
	{
		"lewis6991/gitsigns.nvim",
		event = { "BufReadPre", "BufNewFile" },
		opts = {},
	},
}

require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("catppuccin")

Describe the solution you'd like It would be cool if the offscreen match popup window inherited the same properties of the statuscolumn if enabled, and to allow for an option to provide a custom string to be evaluated so that the user can choose to hide the foldcolumn and signcolumn in the offscreen matchpopup window if they wish.

Describe alternatives you've considered The only alternative I can think of right now is to not use a statuscolumn as this also affects the statusline mode for offscreen matches as well.

Screenshots

Custom status column with right-aligned relative number/numbers and sign-column on the right image

Comparison between foldcolumns Actual line: image

Matchparen popup: image

Subjective avatar Jul 29 '23 01:07 Subjective