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

Reorganize cider keys in handy prefix keymaps #692

Closed
vspinu opened this issue Aug 3, 2014 · 10 comments
Closed

Reorganize cider keys in handy prefix keymaps #692

vspinu opened this issue Aug 3, 2014 · 10 comments

Comments

@vspinu
Copy link
Contributor

vspinu commented Aug 3, 2014

Hi,

I must admit that my only real issue with cider is its somewhat ad-hoc key bindings. My brain cries each time I press C-c M-n instead of C-c C-n and the other way around. My personal opinion is that C-c M- style shortcuts are confusing and are difficult to type and remember.

This is a proposal for a bunch of keymaps with examples of already existing and potential new functionality. Besides the obvious consistency and simplification of the key memorization, it would allow users and auxiliary packages to add keys without risking to interfere too much with the core binding. Taking into account the ever expanding clojure/cider functionality, prefix keymaps is the only viable strategy in the long run.

The maps should preferably be left-handed so that you can keep your right pinkie on control while pressing the full combo. The core maps are cider-doc-map, cider-dev-map, cider-extra-map, cider-nsconbuf-map and cider-inspector-map.

  • C-c C-d cider-doc-map is already there

  • C-c C-t for cider-dev-map (or cider-trace-map). Inspired by ESS.

    • Test and profiling
      r . cider-test-run-tests
      R . cider-test-rerun-tests
      P . cider-test-show-report
    • Breakpoints
      b . Set breakpoint
      B . Set conditional BP
      k . Kill BP
      K . Kill all BPs
      o . Toggle BP state
      l . Set logger BP
      n . Goto next BP
      p . Goto previous BP
    • Debugging
      ` . Show traceback
      ~ . Show callstack
      e . Toggle error action
      d . Flag for debugging
      t . cider-toggle-trace
      u . Unflag for debugging
      w . Watch window
    • Interactive Debugging (also available without prefix during debugging)
      M-C . Continue
      M-C-C . Continue multi
      M-N . Next step
      M-C-N . Next step multi
      M-U . Up frame
      M-Q . Quit debugging
  • C-c C-e for cider-extra-map. All the handy miscellaneous command are defined. These are the ESS extra commands at this time:

    d ess-dump-object-into-edit-buffer
    e ess-execute
    i ess-install-library
    l ess-load-library
    s ess-set-style
    t ess-build-tags-for-directory
    w ess-execute-screen-options
    / ess-set-working-directory

  • C-c C-s cider-nsconbuf-map namespace, connection and buffer managers:

    n cider-eval-ns-form
    r cider-repl-set-ns
    i cider-inspect
    c cider-change-connection
    C cider-display-current-connection-info

    C-s r cider-switch-to-repl-buffer
    C-s n cider-switch-to-nrepl-connection-buffer
    C-s e cider-switch-to-error-buffer
    C-s i cider-switch-to-inspector-buffer

    o cider-find-and-clear-repl-buffer
    g cider-refresh
    q cider-quit

  • C-c i cider inspector keymap

    o cider-inspect-object
    n cider-inspect-namespace
    c cider-inspect-class-hierarchy

  • C-c C-a cider-analyze keymap. In a long term a map for analytic functionality. Either code analysis or actual data analysis.

@bbatsov
Copy link
Member

bbatsov commented Aug 3, 2014

I must admit that my only real issue with cider is its somewhat ad-hoc key bindings. My brain cries each time I press C-c M-n instead of C-c C-n and the other way around. My personal opinion is that C-c M- style shortcuts are confusing and are difficult to type and remember.

The general idea is that we use C-c C-something for operations that are very common and C-c M-something for operations that are less common. While meta keybindings are generally a bit harder to press they seem better to me that C-c C-x C-y.

I've been thinking of extracting lots of related commands in separate keymaps, but I'd still like to have most common ops quickly accessible. Apart from the doc keymap which more or less exists right now I was thinking of having test related and pretty-printing commands separated from the rest.

The keybindings are definitely a moving target right now, hopefully we'll settle on something sane by 1.0.

@vspinu
Copy link
Contributor Author

vspinu commented Aug 4, 2014

The general idea is that we use C-c C-something for operations that are very common and C-c M-something for operations that are less common.

"Common" is subjective. I personally don't use a lot of shortcuts in cider map but tend to use things that are not there. Like toggle-cider-pp and cider-restart.

All I ask is to try to be forward looking and reserve the handy C-c keys on the left side for key-maps: C-c C-d, C-c C-s, C-c C-e, C-c C-t, C-c C-a.

The most essential is the development map; cider-tracing provides only one command and it already has no other choice than to bind it to the awful C-c M-t . Just imagine dozens of development commands as in my example above. Where do you plan to fit all those?

The handy C-c C-t is already taken for a marginally useful command, which easelly could be living on C-c C-t C-t. A combo which is almost as fast as C-c C-t itself.

@pgroce
Copy link

pgroce commented Aug 5, 2014

A consideration: Keybindings defined by a major mode are automatically included in the ouptut of describe-mode. Keybindings in keymaps do not have this feature. This makes discovery of keybindings in the "usual Emacs way" more challenging.

This is an issue now, of course, but if CIDER doubles down on keymaps it will become a good deal worse. The obvious fix is to manually document the keymaps in the mode docstring.

@Malabarba
Copy link
Member

I'd like to add a few thoughts on keymaps.

  • This left-handed-please thing is subjective. The right control key is the size of a pea on many laptops. I, for one, only ever use caps lock when hitting control, so alternating between C-c and the right hand is easier for me than C-c C-d.
  • The only thing that's kind of true for anyone using qwerty, is that hitting C-c C-t feels like reaching for the top shelf. It's difficult for me regardless of which control key I use, but even that is subjective.
  • I agree we need better keymap organization in general, but a couple of things should stay (or move to) shallow keybinds. C-c C-d C-d, for instance, I use much more than C-c C-n, I think it deserves a two-key combo.
  • I've had no problem with the Meta commands. They feel a bit odd, but it makes sense. I only use C-c M-j once per session, so it makes sense in my head that it should get this odd keybind. Still, I do see your point that this is relative, and I maybe some of the meta need to move to controls.

@bbatsov
Copy link
Member

bbatsov commented Mar 19, 2015

This left-handed-please thing is subjective. The right control key is the size of a pea on many laptops. I, for one, only ever use caps lock when hitting control, so alternating between C-c and the right hand is easier for me than C-c C-d.

Yeah, I agree that this is pretty subjective.

I agree we need better keymap organization in general, but a couple of things should stay (or move to) shallow keybinds. C-c C-d C-d, for instance, I use much more than C-c C-n, I think it deserves a two-key combo.

C-c C-d d was originally C-c C-d, but with all the documentation commands we opted to change this. Aligning this with SLIME was an extra bonus. Finding the balance between consistency and usability is pretty hard...

I've had no problem with the Meta commands. They feel a bit odd, but it makes sense. I only use C-c M-j once per session, so it makes sense in my head that it should get this odd keybind. Still, I do see your point that this is relative, and I maybe some of the meta need to move to controls.

Some of the comments here are a bit outdated. I don't have any issues with meta keybindings, but don't mind reducing their number if we can do this in a sensible manner.

@vspinu
Copy link
Contributor Author

vspinu commented Mar 19, 2015

This left-handed-please thing is subjective. The right control key is the size of a pea on many laptops. I, for one, only ever use caps lock when hitting control, so alternating between C-c and the right hand is easier for me than C-c C-d.

Well, you just complained that you have to find one (right) conrol key, but with combos like C-c C-n you have to find two control keys. Same for C-c M-n keys. There is nothing subjective about that, it's uniformly more efficient to have one-sided-one-modifier combos.

Right or left, doesn't matter to me personally, as long as there are good mnemonics for them. The problem is that all of them have to start with C-c, as to emacs conventions for major modes. Thus, if you restrict yourself to one-sided-one-modifier combos you land automatically on the left side. So, nothing subjective about left side either.

@Malabarba
Copy link
Member

Well, you just complained that you have to find one (right) conrol key, but with combos like C-c C-n you have to find two control keys.

No, I use the left control for both C-c and C-n. IMO C-c is a breeze to hit with just left hand, because the distance between c and Capslock (or LCtrl) is exactly the distance between my left pinky and index fingers.

But this is getting terribly technical. I agree mnemonic is more important.

@bbatsov
Copy link
Member

bbatsov commented Mar 19, 2015

Well, you just complained that you have to find one (right) conrol key, but with combos like C-c C-n you have to find two control keys. Same for C-c M-n keys. There is nothing subjective about that, it's uniformly more efficient to have one-sided-one-modifier combos.

I'm a touch typist and I alternate between the two control keys without even thinking about it. I feel that distributing the typing between both hands is generally the best thing you can do.

@vspinu
Copy link
Contributor Author

vspinu commented Mar 19, 2015

I'm a touch typist

I am also a touch typist and C-c C-e feels twice as fast than C-c C-n , as only the right hand noticeably moves from the home row.

distributing the typing between both hands is generally the best thing you can do.

Agree but not within a single combo sequence. Would be nice to have right-hand alternative to C-c,prefix even if it goes against emacs conventions.

@bbatsov
Copy link
Member

bbatsov commented Feb 3, 2016

I'm closing this due to lack of activity. I agree we can do better, but there are no concrete action steps here.

@bbatsov bbatsov closed this as completed Feb 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants