federomero / pretty-json

Atom plugin. Format JSON documents.
MIT License
94 stars 23 forks source link

Feature Request: Pretty json keymap #63

Closed lengxf closed 7 years ago

lengxf commented 7 years ago

Can add a defualt keymap for pretty json ? thanks

lexicalunit commented 7 years ago

In general I'm against the idea of default keymaps being provided by packages because you have the danger of collisions when users have installed multiple packages.

For example, a possible keymap for Prettify might be shift-cmd-j, which isn't used by vanilla Atom. But it is used by the atom-script package that I happen to have installed.

I don't have alt+cmd+j mapped to anything on my machine (but you might). I can't know for sure what is mapped on any given user's machine. The best option IMHO is to provide commands for actions in a package so that users can easily map their favorite bindings to those commands using their personal keymap.cson file.

@lengxf If alt-cmd-j is an ok keymap for you, then do this:

  1. Open your keymap.cson file by going to Keymap... in your Atom menu.
  2. At the bottom of the file, add the following:
'atom-text-editor':
  'alt-cmd-j': 'pretty-json:prettify'

NOTE: If you already have an atom-text-editor key in that file, you should add the alt-cmd-j binding under that key, instead of adding a duplicate entry for it.

Please let me know if that makes sense and works for you. Thank you for the issue report and for using pretty-json :)

lengxf commented 7 years ago

thank you for your response , It works for you. Before this request, I have done, I try 'Pretty Json:Prettify' and 'pretty json:Prettify' and so on many times. so I make this request.