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

Covers statusline if using Neovim's `set cmdheight=0` option

Open mrjones2014 opened this issue 3 years ago • 5 comments
trafficstars

Explain the issue

Neovim supports set cmdheight=0, basically it only shows the command line when you're actively in command mode. When cmdheight=0, the thing that shows the matching context covers the statusline, instead of being one line above it, like I'd expect. Screenshot below:

image

Neovim version:

NVIM v0.8.0-dev-926-g779a25f04
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-779a25f_1/share/nvim"

Run :checkhealth for more info

Using Treesitter matching.

Minimal vimrc file

Note that this requires Neovim 0.7.0+. It should automatically bootstrap the plugins for you. Run with nvim -u init.lua

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
	require("packer").startup({
		{
			"wbthomason/packer.nvim",
			{
				"andymass/vim-matchup",
				setup = function()
					vim.g.matchup_matchparen_offscreen = { method = 'popup' }
				end
			},
		},
		config = {
			package_root = package_root,
			compile_path = install_path .. "/plugin/packer_compiled.lua",
			display = { non_interactive = true },
		},
	})
end
_G.load_config = function()
	vim.opt.cmdheight = 0
end
if vim.fn.isdirectory(install_path) == 0 then
	print("Installing plugins...")
	vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]])

Then edit, for example, a JSON file that takes up more than full height, and put your cursor on the first opening {.

mrjones2014 avatar Aug 30 '22 15:08 mrjones2014

It sounds like you prefer to use the popup window instead of the status line:

let g:matchup_matchparen_offscreen = {'method': 'popup'}

Does this resolve the issue?

andymass avatar Sep 01 '22 00:09 andymass

Sorry, I forgot to put this in the minimal config in the first comment -- I'm already using that. I'll edit the original comment to include that config.

mrjones2014 avatar Sep 01 '22 10:09 mrjones2014

I think it's an issue with computing where the popup appears when set cmdheight=0

mrjones2014 avatar Sep 01 '22 10:09 mrjones2014

very strange, I cannot reproduce it, but I do see a similar problem.

reported: offscreen match covers status line in normal mode, i.e., at bottom most line

observed: in normal mode, looks fine, but when entering command mode, since the status line moves up by one, offscreen match covers status line now (does not move out of the way).

so I can fix (observed) but I am not sure it will solve your issue

andymass avatar Sep 02 '22 00:09 andymass

In my environment, https://github.com/andymass/vim-matchup/issues/243#issuecomment-1233604415 works with cmdheight=0. Thank you.

Matts966 avatar Sep 02 '22 00:09 Matts966

Closing this as I can't reproduce it, the popup seems to work fine with cmdheight=0.

andymass avatar Apr 22 '23 19:04 andymass