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

Rationale: Marking #19

Closed
Ambrevar opened this issue Nov 7, 2017 · 11 comments
Closed

Rationale: Marking #19

Ambrevar opened this issue Nov 7, 2017 · 11 comments
Labels

Comments

@Ambrevar
Copy link
Collaborator

Ambrevar commented Nov 7, 2017

The rationale has now some idea about marking.

It's not clear yet if we should ignore u or U to unmark, since most modes supporting marking do not support "undoing actions".

It's not clear either whether the marking bindings should be togglers and whether they should work on regions. I like the idea of regions though.

@Somelauw
Copy link

Somelauw commented Nov 7, 2017

One solution is that in normal mode:

  • m toggles mark
  • u undoes

And in visual mode

  • m marks
  • u unmarks

@jojojames
Copy link
Collaborator

It'll probably be good to include the current rationale in this thread as the readme will probably evolve indepedent of this thread.

I think 'u' for unmarking fits pretty well. I'm not sure there's a mode where you have both an unmark and an undo action.

@jojojames
Copy link
Collaborator

    (define-key map (kbd "* *") 'ibuffer-unmark-all)
    (define-key map (kbd "* c") 'ibuffer-change-marks)
    (define-key map (kbd "U") 'ibuffer-unmark-all-marks)
    (define-key map (kbd "* M") 'ibuffer-mark-by-mode)
    (define-key map (kbd "* m") 'ibuffer-mark-modified-buffers)
    (define-key map (kbd "* u") 'ibuffer-mark-unsaved-buffers)
    (define-key map (kbd "* s") 'ibuffer-mark-special-buffers)
    (define-key map (kbd "* r") 'ibuffer-mark-read-only-buffers)
    (define-key map (kbd "* /") 'ibuffer-mark-dired-buffers)
    (define-key map (kbd "* e") 'ibuffer-mark-dissociated-buffers)
    (define-key map (kbd "* h") 'ibuffer-mark-help-buffers)
    (define-key map (kbd "* z") 'ibuffer-mark-compressed-file-buffers)
    (define-key map "**" 'dired-mark-executables)
    (define-key map "*/" 'dired-mark-directories)
    (define-key map "*@" 'dired-mark-symlinks)
    (define-key map "*%" 'dired-mark-files-regexp)
    (define-key map "*c" 'dired-change-marks)
    (define-key map "*s" 'dired-mark-subdir-files)
    (define-key map "*m" 'dired-mark)
    (define-key map "*u" 'dired-unmark)
    (define-key map "*?" 'dired-unmark-all-files)
    (define-key map "*!" 'dired-unmark-all-marks)
    (define-key map "U" 'dired-unmark-all-marks)
    (define-key map "*\177" 'dired-unmark-backward)
    (define-key map "*\C-n" 'dired-next-marked-file)
    (define-key map "*\C-p" 'dired-prev-marked-file)
    (define-key map "*t" 'dired-toggle-marks)

Some of the keymap from dired and ibuffer around marking.

@Ambrevar
Copy link
Collaborator Author

Ambrevar commented Nov 8, 2017

Current rationale

~m~ defaults to ~evil-set-marker~ which might not be very useful in special
modes.  This is somewhat debatable though.

Suggested mark bindings:

- ~m~: Mark or toggle mark, depending on what the mode offers.

- =~=: Toggle all mark.  This mirrors the "invert-char" Vim command bound to =~=
by default.

- ~M~: Remove all marks.

- ~%~: Mark regexp.

- ~x~: Execute action on marks.  This mirrors Dired's binding of ~x~.

While ~m~ won't be available for setting marks (in the Vim sense), ~'~ can still
be used as it can jump to other buffers.

Optionally:

- ~*~: Mark all, because ~*~ is traditionally a wild card.

- ~#~: Remove mark.  This is useful when we want to unmark a region having both
marked and unmarked entries.  But ~M~ could also be made to remove all marks on
region, making this binding useless.

@Ambrevar
Copy link
Collaborator Author

Ambrevar commented Nov 8, 2017

@Somelauw: I like your suggestion. Rationale: toggle is more often needed than one-way commands.
If we need to be in visual mode to run the one-way command, that's more keys to press (for the visual selection) but that's less needed.

It also means that the mark commands should be "mark and forward-line" readlly, so that we can press, say, 17 m to toggle-mark the next 17 entries. Otherwise there would be no way to toggle-mark an area.

@Ambrevar
Copy link
Collaborator Author

Ambrevar commented Nov 8, 2017

With that in mind, it means that many bindings are overlapping. Which is fine, but we don't want to consume too many keys either, lest we will conflict with more modes.

Suggestion:

  • m: toggle-mark or mark on region.
  • u: unmark current or region
  • ~: toggle all in buffer or region
  • %: mark regexp (on region?)
  • *: mark prefix (mirrors Dired and Ibuffer)
  • x: execute action on mark (mirrors Dired)

Then # is free and so is U, probably.
Comments?

Next question: I think we should leave x to the modes. If * is taken for "mark prefix", what about using # for "execute action on mark"?

@Ambrevar
Copy link
Collaborator Author

Ambrevar commented Nov 8, 2017

Bonus of the former: this frees back M which is arguably useful for motion.

@jojojames
Copy link
Collaborator

jojojames commented Nov 8, 2017

'#' being free is important as it's a useful 'movement' key (then again * would be taken which is also a useful key to move around in (that's regrettable..)).

I wonder a little if we should move these common mark actions to a prefix instead (m for example).

mm: mark
mu: unmark
m*: mark all
mx: mark execute

That frees up '#', '*', 'u', etc at the cost of becoming slightly 'prefix heavy'.

Thoughts? @Somelauw @Ambrevar I'm okay with your suggestion by the way. Food for thought is my comment.

@Ambrevar
Copy link
Collaborator Author

Ambrevar commented Nov 8, 2017

@Somelauw was against this for evil-org-agenda: his point was they are high frequency bindings, and as such they should be as short as possible (i.e. only one character).

A middle ground could also be possible:

  • m to toggle mark.
  • prefix + u/*/x for the rest.

I have no clue what key would be a great prefix. Maybe m should be the prefix and "toggle mark" should be bound to something else.

@jojojames
Copy link
Collaborator

Lets go with your initial suggestion then, losing * isn't that bad.

Reposting it for clarity.

Suggestion:

m: toggle-mark or mark on region.
u: unmark current or region
~: toggle all in buffer or region
%: mark regexp (on region?)
*: mark prefix (mirrors Dired and Ibuffer)
x: execute action on mark (mirrors Dired)

Then # is free and so is U, probably.
Comments?

Next question: I think we should leave x to the modes. If * is taken for "mark prefix", what about using # for "execute action on mark"?

@Ambrevar Ambrevar added the MELPA label Nov 9, 2017
@jojojames jojojames mentioned this issue Nov 14, 2017
@Ambrevar
Copy link
Collaborator Author

See #96.

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

No branches or pull requests

3 participants