MattesGroeger / vim-bookmarks

Vim bookmark plugin
http://www.vim.org/scripts/script.php?script_id=4893
MIT License
962 stars 98 forks source link

Bookmarks signs hidden when navigating away from window #118

Open nkgm opened 7 years ago

nkgm commented 7 years ago

Is there a way for them to remain visible?

nkgm commented 7 years ago

If this is by design, then maybe have an option to keep them visible?

MattesGroeger commented 7 years ago

This must be a regression as this was not happening in my original implementation. I'm assuming this happened accidentially as a result of another PR (but maybe there was a reason for that?). To verify my assumption you should find the commit that changed this behaviour using git bisect. Let me know if you need help there.

Also added #120 and #121 which I noticed today during testing. Would be great if you could have a look at these as well. Thanks so much!

MattesGroeger commented 7 years ago

If we get the current version polished we can make a new release 👍 – has been a long time since the last release 😉

nkgm commented 7 years ago

Reproduced first in b19ea0a.

The pending CtrlP PR should take care of https://github.com/MattesGroeger/vim-bookmarks/issues/120 so, together with this, would be enough to cut a new release. https://github.com/MattesGroeger/vim-bookmarks/issues/121 should take a bit longer and would (most likely) come with breaking changes so we're looking at 2.x?

MattesGroeger commented 7 years ago

Great find! Any idea already what in the commit changed the behaviour of the gutter icon?

I'm fine with moving the breaking changes to a future 2.x release. 👍

nkgm commented 7 years ago

It's due to the way autosave is implemented. On BufEnter, as part of the autosave/reload dance, bm_sign#del is called for all files clearing all bookmarks, and then bm_sign#add_at is called for the current file only. The said commit merely fixed a buggy if condition (acting as the trigger) as far as I can tell (https://github.com/MattesGroeger/vim-bookmarks/commit/b19ea0a5b84dc52b9e38982a57194d6c38cf724a#diff-da99742eccd8b8573e3f3be5ca8303b0R32), so the bug was probably introduced earlier. I'll study the autosave code a bit more see if it can be improved.

lcrockett commented 3 years ago

Great and useful plugin, however this bug degrades the usability of vim-bookmarks significantly as you'll have no quick and clear indication of bookmarks in view. This implies you'll have to resort to active bookmark scanning (using telescope-vim-bookmarks.nvim for instance) instead of passive scanning because of sign(s) popping up.

I've tried negating this as much as possible using the configuration (Lua neovim based) below and using BookmarkClearAll + BookmarkLoad 0 upon every BufEnter,BufWinEnter etc. event. This however brings up loading issues with each BookmarkLoad trigger coming up with the error Failed to load/parse file. This is only resolved by switching the active window with another one, and then going back to the original window, negating the effects of the workaround.

Is there any testing we can do to help get this bug fixed ?

vim.g.bookmark_center = 1
vim.g.bookmark_display_annotation = 1
vim.g.bookmark_no_default_key_mappings = 1
vim.g.bookmark_show_toggle_warning = 0
vim.g.bookmark_show_warning = 0

Cheers !

MattesGroeger commented 3 years ago

Hi @lcrockett,

thanks for your comment and support!

I haven't had the chance to investigate the findings from the above comments. If you'd like to help, could you please verify if b19ea0a indeed introduced the issue or if the bug was already present before? Once we know what exactly causes the issue the fix is hopefully easy 🤞

Update: I just tried for myself and indeed this bug is not present with the previous commit 72b3ce8 ... I'll quickly investigate what change exactly causes the glitch

MattesGroeger commented 3 years ago

Ok, I hope I found the issue. The fix is up in this PR https://github.com/MattesGroeger/vim-bookmarks/pull/169. Please help me testing it 👍

lcrockett commented 3 years ago

Thank you for the quick fix. Unfortunately this did not change said behaviour. I changed a few autocmd directives in the same changed file of PR #169 (namely BufNew,BufEnter,BufHidden,FocusGained + BufLeave,FocusLost). However that did not fully resolve the issue either.

If you'd like to chase a different approach or need testing for a different fix, let me know. Cheers