Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option global mark goto buffer instead of line and mark preview #1414

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dalanicolai
Copy link

@dalanicolai dalanicolai commented Feb 2, 2021

This is the updated version of PR #1413, please refer to its PR for motivation.

This PR is mainly created to start the discussion. It has been implemented as an option that is controlled by the variable evil-mark-goto-buffer-not-line.

If you agree it might be a nice feature/option, then I can merge/rewrite/refactor the extra functions below into the the original evil-goto-mark and evil-goto-mark-line functions.

So this PR offers an option that for global markers, and ONLY for global jumps (i.e. to different buffer) with the single quote ', the user can choose to not jump to the start of the marked line, but instead just jump to the buffer (i.e. just last cursor position).
Additionally it adds the option to, after initiating a goto, see the available marks after some delay in the evil-marks buffer. The behavior is equivalent to that of the 'which-key' package. (In this way buffers can be easily marked and listed while the switch is bound to a very convenient key-sequence).

Because of multiple requests to have some quick way to mark buffers for quickly
switching between multiple buffers, and also inspired by @yyoncho his
[evil-marker-plus](https://github.com/yyoncho/evil-markers-plus), I figured that
it is often preferred to just jump to the last buffer position instead of a
specific line number when jumping to a global mark (if one wants to jump to the
specific line then one could jump with backtick, optionally follow by a zero,
instead of jumping with quote.

A following commit implements listing the marks with some delay in *evil-marks*
buffer (similar to which-key package behavior)
This commit adds functionality to the previous commit (i.e.
mark-goto-buffer-not-line), and shows marks in the *evil-marks* window after a
delay (similiar to which-key). It is especially handy to remind of which mark is
associated with which buffer.
@dalanicolai
Copy link
Author

dalanicolai commented Feb 2, 2021

I have added a third commit with the refactored code. I have kept the three commits for clarity. The first commit only adds the option to (global) jump to the last position in buffer instead of the first character of the line.

The second commit adds the which-key kind of behavior and some unnecessary logic functions (the third commit is a refactors the code and removes those unnecessary functions).

The third commit contains the refactored code. I have added only one variable to enable/disable the jump to buffer instead of line AND the delay preview (equivalent to which-key) buffer simultaneously...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant