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

Add support for statuscolumn and foldcolumn in offscreen matches #313

Open
Subjective opened this issue Jul 29, 2023 · 0 comments
Open

Add support for statuscolumn and foldcolumn in offscreen matches #313

Subjective opened this issue Jul 29, 2023 · 0 comments

Comments

@Subjective
Copy link

Subjective commented Jul 29, 2023

Is your feature request related to a problem? Please describe.
This is a continuation of the issue brought up in #305 (comment). 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 Subjective changed the title Add support for statuscolumn and foldcolumn Add support for statuscolumn and foldcolumn in offscreen matches Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant