junegunn / junegunn/vim-peekaboo

vim-peekaboo sets cmdheight to max, meaning I can only see 1 line of my window output

Open
#83 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
1.2k
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Originally raised at https://github.com/neoclide/coc.nvim/issues/4178#issuecomment-1243592457. I also saw https://github.com/junegunn/vim-peekaboo/issues/74, but I'm not 100% sure that's the same issue.

## Describe the bug

When I apply a macro, the cmdheight gets set to the max, so that I can only see one line of the output.

## Reproduce the bug

Plugins:
- [junegunn/vim-peekaboo](https://github.com/junegunn/vim-peekaboo)
- [neoclide/coc.nvim](https://github.com/neoclide/coc.nvim)

This reproduces for me on my laptop screen.

```shell
export tmp=$TMPDIR/nvim_4178
rm -rf "$tmp"
export XDG_DATA_HOME=$tmp/xdg_data_home
export XDG_CONFIG_HOME=$tmp/xdg_config_home
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "
set nocompatible
set runtimepath^=/path/to/coc.nvim
filetype plugin indent on
syntax on
set hidden

call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/vim-peekaboo'
call plug#end()
" >"$tmp/mini.vim"
curl -o "$tmp/CONTRIBUTING.md" https://raw.githubusercontent.com/Homebrew/brew/master/CONTRIBUTING.md
nvim -es -u "$tmp/mini.vim" -i NONE -c "PlugInstall" -c "qa"
nvim -u $tmp/mini.vim -c "CocInstall -sync coc-markdownlint|qa"
nvim -u "$tmp/mini.vim" "$tmp/CONTRIBUTING.md"
```

When you get the contributing.md open, press `w` till you get to the `/` of the `.github/` and then type:

- `"`
- `Esc`

And you should be left with 1 line at the top of the screen (and `set cmdheight?` should return something like `54`).

I mostly hit this while applying a macro that uses a register, but this seems like an easier reproduction.

I think the key is to open the window on a long line, so that the wrapping of the text changes when the peekaboo window opens/closes.

## Screenshots (optional)

image

>The reason is [vim-peekaboo](https://github.com/junegunn/vim-peekaboo) create bad winrestcmd at [junegunn/vim-peekaboo@cc4469c/autoload/peekaboo.vim#L61](https://github.com/junegunn/vim-peekaboo/blob/cc4469c204099c73dd7534531fa8ba271f704831/autoload/peekaboo.vim#L61), it doesn't consider float window which fired BufEnter before.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with autoload/peekaboo.vim around line 61, then reproduce with the coc.nvim and vim-peekaboo setup and the long wrapped line described in the issue. Check how the saved window state handles the float window and verify that applying the register macro no longer leaves cmdheight at its maximum or reduces the output to one line.

Written by the indexing model from the issue text.

Assessment

Tech stack
vim
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.