LintaoAmons / bookmarks.nvim

Persistent bookmarks: powerful but simple (one shortcut to add, rename, and remove bookmark)
https://lintao-index.pages.dev/docs/Vim/Neovim/my-plugins-docs/bookmarks.nvim/
MIT License
173 stars 7 forks source link

Calibrate the bookmarks #31

Closed shanlihou closed 2 months ago

shanlihou commented 2 months ago

use command “BookmarksCalibration” to calibrate the bookmarks use config.show_calibrate_result to enable the the result show of the calibrate. The condition of calibration is that could find the content and the line is unique.

LintaoAmons commented 2 months ago

I think other than a new command which need user trigger by themselves, a better way is

  1. Users go into a window
  2. Trigger calibration automatically if they turned it on
  3. Calibration
    1. get the active bookmarks inside the window'a buffer
    2. backup current json
    3. Update location
shanlihou commented 2 months ago

The idea of 'triggering calibration when opening windows' is excellent. However, there is a situation that hasn't been covered: when a user first opens an overview window and then intends to navigate to a specific bookmark. If the calibration process hasn't been triggered or completed, they might not land in the correct position.

Therefore, I suggest retaining the existing command and adding a new trigger function that activates when a window is opened. This would ensure that the calibration is performed in time for the user's navigation needs.

LintaoAmons commented 2 months ago

Currently, there are too many places in the codebase where we register autocommands. I've noticed that when I enter a buffer or window, the sign does not appear. I'm uncertain if this issue is caused by duplicate autocommands being triggered for the same events. We could create a new cmd.lua file to register a single autocommand for an event, which would handle all the necessary actions for bookmarks.

shanlihou commented 2 months ago

Do you mean unified bufEnter and another event?

LintaoAmons commented 2 months ago

为什么这个东西只merge了一个commit 进去,而不是把整个pr history merge进去

LintaoAmons commented 2 months ago

哦, 看 commit 历史看叉了