kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.18k stars 38 forks source link

Previewing a fold by moving to it from below highlights the last line #110

Closed igorlfs closed 1 year ago

igorlfs commented 1 year ago

Neovim version (nvim -v | head -n1)

NVIM v0.8.2

Operating system/version

Arch Linux 6.1.8

How to reproduce the issue

cat mini.lua

-- Use Vim packages install the plugin, also work with some plugins manager such as packer.nvim
vim.o.packpath = '~/.local/share/nvim/site'
vim.cmd('packadd promise-async')
vim.cmd('packadd nvim-ufo')

-- Setting
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99

nvim --clean +'so mini.lua'

  1. Move to a line right below a fold.
  2. Move up to the line containing the fold.
  3. Trigger "require("ufo").peekFoldedLinesUnderCursor()" ...

Expected behavior

The last line in the preview should not be highlighted.

Actual behavior

https://user-images.githubusercontent.com/84649544/216379499-d8d985fa-2ec9-42f3-ba4f-2bbd4159e89d.mp4

rockyzhang24 commented 1 year ago

You must have a mapping like nnoremap k gk.

gk by default will move the cursor to the fold end. Not sure whether it is a bug but someone already reported it in Neovim (https://github.com/neovim/neovim/issues/15490)

igorlfs commented 1 year ago

You must have a mapping like nnoremap k gk.

Indeeed, I do!