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

Pressing `G` (shift-G) on a fold just created by `za` with a following `<C-o>` seems to expand the fold. #121

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

Neovim version (nvim -v | head -n1)

NVIM v0.9.0-dev-bad218c

Operating system/version

macOS 13.3 (22E252)

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.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = -1
vim.o.foldenable = true

local ufo = require('ufo')

vim.opt.foldenable = true
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
require('ufo').setup {}

nvim --clean +'so mini.lua'

  1. za on any folenable line
  2. G(shift g) to the end of buffer
  3. <C-o> to go back, now the fold is expanded ...

Expected behavior

The fold is intact after step 3.

Actual behavior

<C-o> seems to expand the fold.

Thanks for this great plugin!

kevinhwang91 commented 1 year ago

h 'foldopen' vim.o.foldopen = 'block,hor,quickfix,search,tag,undo'

nyngwang commented 1 year ago

My bad, thanks for the hint!