cmd-shift-k: super crappy 'show keybindings' extension

This commit is contained in:
Chris Wanstrath
2011-11-13 02:41:01 -08:00
parent 21651faf8d
commit fb2efcfa75
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1 @@
module.exports = require 'showkeybindings/showkeybindings'

View File

@@ -0,0 +1,2 @@
showkeybindings:
'cmd-shift-k': (showkeybindings) => showkeybindings.toggle()

View File

@@ -0,0 +1,27 @@
_ = require 'underscore'
$ = require 'jquery'
fs = require 'fs'
Extension = require 'extension'
Modal = require 'modal'
module.exports =
class Showkeybindings extends Extension
constructor: ->
atom.keybinder.load require.resolve "showkeybindings/key-bindings.coffee"
atom.on 'project:open', @startup
startup: (@project) =>
html = '<h1>Keybindings</h1>'
for name, bindings of atom.keybinder.keymaps
html += "<h3>#{name}</h3>"
html += "<ul>"
for binding, method of bindings
html += """
<li>#{atom.keybinder.bindingFromAscii(binding)} - #{method}</li>
"""
html += "</ul>"
@pane = new Modal html
toggle: ->
@pane?.toggle()