Comments (25)
I am pasting a part of my comment in that old issue thread here ( #42 (comment) ) which I think is interesting to pursue. It would be nice to sort the keys first by keymap and then alphabetically. If not that, at least use different faces for keys from different keymaps.
(3) key or description grouping prefixes and commands separately
I like the next grouping better, by keymap. That way related commands are listed together.
(4) key or description grouping by keymap (major then minors)
In general, I liked the idea to be able to group by prefix maps. A very good example would be to list the rectangle and register block in different groups when user hits C-x r. In guide-key, it set different faces for different gropus but did not arrange them (that would be great too).
from emacs-which-key.
I just looked into it and it seems guide key relied on a user specified regexp to highlight groups of keys. That's certainly possible but not quite the same thing as finding their respective keymaps and organizing them that way
from emacs-which-key.
I would definitely love the ability to organize by the map the keybinding came from (with or without colors). That means that the keys are sorted by topic, which can be really helpful.
from emacs-which-key.
@PythonNut As far as I know it's tricky to determine for a given key which keymap it comes from, but I had a thought about a way to easily do this. Are you familiar with helm-descbinds
? because it would be easy to use the same order that that tool prints in, which is the order produced by describe-buffer-bindings
. I'd be happy to add that as an option.
from emacs-which-key.
@justbur I don't use helm-descbinds
. I normally just do M-x describe-bindings
+ isearch. That said, the ordering sounds perfect. In fact, I can't really tell how your implementation would deviate from the proposal.
from emacs-which-key.
Actually @PythonNut I think this is really simple. You should get the same
order by setting which-key-sort-order to nil. If you want to make changes
from there I can look into it.
On Wed, Sep 16, 2015 at 7:26 PM PythonNut [email protected] wrote:
@justbur https://github.com/justbur I don't use helm-descbinds. I
normally just do M-x describe-bindings + isearch. That said, the ordering
sounds perfect. In fact, I can't really tell how your implementation would
deviate from the proposal.β
Reply to this email directly or view it on GitHub
#44 (comment)
.
from emacs-which-key.
@justbur I just tried that and it looks great.
from emacs-which-key.
I like the recently added highlighting feature. This gets me similar to what guide-key
did; separation of rectangle and register/bookmark commands visually.
Will need to click on the above image to see it properly.
from emacs-which-key.
@kaushalmodi Great! I didn't add that feature initially, because I thought it might be too noisy, but I like your use of it
from emacs-which-key.
Something (I think) I'd like is the ability to move all the prefix bindings to the beginning or end of the list.
from emacs-which-key.
@hmelman It shouldn't be too hard to do this, but I'd like to know if/how you would like to sort within the prefix bindings and whether you'd like them to come first or last.
from emacs-which-key.
It's something I'd have to play with but my sense is that it should be another setting. So I could sort by key or description as now, but also have a setting to move prefixes to start or end of list. End is probably more useful to me (particularly in the C-x 8 case).
from emacs-which-key.
@hmelman If you know any elisp, all you need to do is write a comparison function that takes two cons cells (car is the string describing the key and cdr is a string for the command description) and reports if the first should come before the second. Here's one interpretation of your request
(defun prefix-last-then-by-keys (acons bcons)
(let ((apref? (which-key--group-p (cdr acons)))
(bpref? (which-key--group-p (cdr bcons))))
(if (not (eq apref? bpref?))
(and (not apref?) bpref?)
(which-key-key-order acons bcons))))
(setq which-key-sort-order 'prefix-last-then-by-keys)
which-key--group-p
is the function I use to identify prefixes in the code.
from emacs-which-key.
Yes, I think I like this as a sort order. Thanks.
from emacs-which-key.
@hmelman If you use it for a while and continue to like it, let me know and I can add it as a built-in option.
from emacs-which-key.
Yes, I definitely like this (prefix-last-then-by-keys).
from emacs-which-key.
@hmelman e9aa7c3 To use it, do
(setq which-key-sort-order 'which-key-prefix-then-key-order)
from emacs-which-key.
I'm new to emacs, and this is a helpful utility. however, i'd really like the ability to sort capital keys next to lowercase keys. I have similar commands bound to the same key, such as a -> goto-address-mode, A -> goto-address-prog-mode. however all capital keys are listed before any lowercase keys.
from emacs-which-key.
@Axionix It's not documented yet, but I recently added
(setq which-key-sort-order 'which-key-key-order-alpha)
from emacs-which-key.
@justbur thanks!
from emacs-which-key.
I think we have a good range of options, so I'll close this. I'm happy to consider others if someone wants to reopen.
from emacs-which-key.
Hi, does which-key have an option to sort in the order of definition? I have gone through the github page and couldn't find anything!
from emacs-which-key.
Hi, does which-key have an option to sort in the order of definition? I have gone through the github page and couldn't find anything!
@ChauhanT I usually use customize-group
for a package (in this case which-key
) to see all its options. Searching for "sort" in that customize buffer takes you right to which-key-sort-order
. Searching the source for all the defcustom
s is the equivalent.
from emacs-which-key.
Thanks @hmelman, I am indeed new and didn't how I could use customize-group
this way! I see now there is no way to sort according to the order of definition.
from emacs-which-key.
I see now there is no way to sort according to the order of definition.
You can set which-key-sort-order
to which-key-description-order
which I think will do what you want.
from emacs-which-key.
Related Issues (20)
- Please add a screenshot with command docstrings shown to the README HOT 2
- Question about which-key-persistent-popup HOT 2
- which-key-show-transient-maps clobbers itself HOT 3
- yasnippet bindings have no label HOT 1
- custom string replacement: ambiguous example in README HOT 6
- which-key-mode appears in which-key-faces customize group HOT 1
- Composition not being used in which-key buffer HOT 2
- BUG: conflict between which-key-window and avy-goto-char-2. HOT 2
- which-key menu misalignment with ellipsis char HOT 1
- Setting which-key-show-operator-state-maps to true "breaks" outer and inner evil maps HOT 1
- which-key crashes when trying to display term-raw-map HOT 1
- How to switch among different pages of keys conveniently in which-key mode? HOT 1
- which-key canβt show keys: There is not enough space based on your settings and frame size HOT 2
- Customize which-key-C-h-dispatch prompt HOT 1
- Make "<prefix> C-h" display which key and prompt for command at the same time HOT 3
- The texts for the same key in different keymaps are overridden each other HOT 2
- Question about `which-key-undo` HOT 1
- which-key is good enough to be built-into Emacs HOT 1
- Question about full description popups HOT 3
- Automatic expansion of unnamed prefixes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-which-key.