-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Please provide CodeMirror Help via keymap, e.g. Ctrl+F1 #2294
Comments
The vim keybindings don't use a normal keymap, and the emacs ones bind most of the keys directly to functions, so those won't show much useful information this way. The Sublime Text binding demo already does a more structured form of this, and uses it as the example text (http://codemirror.net/4/demo/sublime.html). As it is, I don't think this code is very useful, but a properly wrapped addon that provides this service in a well-formatted way, and starts with the active keymap, rather than just displaying the default keymap, might be nice to have. Still, people will want to style the display style to fit their project, so I'm not sure the CodeMirror distribution is the right place for this. |
Thanks for taking a look and for the great feedback! I hadn't seen http://codemirror.net/4/demo/sublime.html but it looks fairly similar in terms of presenting the help (and has great bindings I was missing so far). I'll see if doing an addon seems feasible for me. Does one particular help key binding seem doable, considering the different models of vim, emacs, sublime? |
I think it'd be best to implement it as a command (http://codemirror.net/4/doc/manual.html#commands), and let people bind their own key. |
@marijnh Thanks for your guidance. I have implemented a prototype in https://github.com/anaran/scratchpadjs/blob/master/codemirror_addon_help_help.js which I have tested in a local CodeMirror npm install by placing it under Would codemirror/addon/help/help.js be a good place for it? Perhaps you could point out any blatant flaws before I add this to my fork for a pull request. Thanks! |
@marijnh I now have a demo online to look at: http://anaran.github.io/CodeMirror/demo/help.html Depending on your feedback I can create a pull request of a squashed merged from my gh-pages to a delivery branch in my repo. Still missing are:
|
I'll add a code snippets I wrote and tested with Google Chrome and Mozilla Firefox to demo what I mean.
Here it is:
https://gist.github.com/anaran/9198993
With CodeMirror providing various keymaps (default, emacs, vi) and only partial support for their key bindings (due to browser limitations ^W implementation) I have often felt the need to quickly see what key bindings are available right now.
The code snippets, when run, sets up keydown event listener for Ctrl+F1 which will bring up a text area showing a somehat pretty JSON representation of the current default and fallthrough key maps as well as the current CodeMirror defaults.
Did I overlook and existing feature doing something like this?
If not, what do others think about a feature like this, inspired by emacs C-h b (describe-bindings)?
The text was updated successfully, but these errors were encountered: