🆒 keybindings show a custom webpage

https://img.skitch.com/20111114-tdp1sty3pi9ftr3uk3wj26d9e1.png
This commit is contained in:
Chris Wanstrath
2011-11-13 21:02:57 -08:00
parent 3d043d329a
commit 06d7b59e51
2 changed files with 18 additions and 9 deletions

View File

@@ -1,2 +1,2 @@
showkeybindings:
'cmd-shift-k': (showkeybindings) => showkeybindings.toggle()
'cmd-shift-k': -> window.open 'atom://keybindings'

View File

@@ -2,16 +2,25 @@ _ = require 'underscore'
$ = require 'jquery'
fs = require 'fs'
Extension = require 'extension'
Modal = require 'modal'
Browser = require 'browser'
module.exports =
class Showkeybindings extends Extension
class Showkeybindings extends Browser
window.resourceTypes.push this
constructor: ->
atom.keybinder.load require.resolve "showkeybindings/key-bindings.coffee"
atom.on 'project:open', @startup
@running = true
startup: (@project) =>
open: (url) ->
return if not url
if url is 'atom://keybindings'
@url = url
@show()
true
innerHTML: ->
html = '<h1>Keybindings</h1>'
for name, bindings of atom.keybinder.keymaps
html += "<h3>#{name}</h3>"
@@ -21,7 +30,7 @@ class Showkeybindings extends Extension
<li>#{atom.keybinder.bindingFromAscii(binding)} - #{method}</li>
"""
html += "</ul>"
@pane = new Modal html
html
toggle: ->
@pane?.toggle()
show: ->
super @innerHTML()