mirror of
https://github.com/atom/atom.git
synced 2026-02-10 14:45:11 -05:00
ctrl-? brings up keybindings for focused view.
it is very ugly.
This commit is contained in:
7
src/app/keymaps/atom.coffee
Normal file
7
src/app/keymaps/atom.coffee
Normal file
@@ -0,0 +1,7 @@
|
||||
window.keymap.bindKeys '*'
|
||||
'alt-meta-i': 'show-console'
|
||||
right: 'move-right'
|
||||
left: 'move-left'
|
||||
down: 'move-down'
|
||||
up: 'move-up'
|
||||
'ctrl-?': 'toggle-keybindings-view'
|
||||
@@ -1,17 +1,6 @@
|
||||
window.keymap.bindKeys '*'
|
||||
'meta-s': 'save'
|
||||
'meta-w': 'close'
|
||||
'alt-meta-i': 'show-console'
|
||||
'meta-+': 'increase-font-size'
|
||||
'meta--': 'decrease-font-size'
|
||||
|
||||
right: 'move-right'
|
||||
left: 'move-left'
|
||||
down: 'move-down'
|
||||
up: 'move-up'
|
||||
|
||||
window.keymap.bindKeys '.editor',
|
||||
'meta-s': 'save'
|
||||
'meta-w': 'close'
|
||||
'shift-right': 'select-right'
|
||||
'shift-left': 'select-left'
|
||||
'shift-up': 'select-up'
|
||||
@@ -38,3 +27,5 @@ window.keymap.bindKeys '.editor',
|
||||
'meta-]': 'indent-selected-rows'
|
||||
'meta-{': 'show-previous-buffer'
|
||||
'meta-}': 'show-next-buffer'
|
||||
'meta-+': 'increase-font-size'
|
||||
'meta--': 'decrease-font-size'
|
||||
|
||||
@@ -29,6 +29,7 @@ class RootView extends View
|
||||
extensions: null
|
||||
extensionStates: null
|
||||
fontSize: 18
|
||||
keybindingsView: null
|
||||
|
||||
initialize: (pathToOpen) ->
|
||||
@extensions = {}
|
||||
@@ -59,6 +60,7 @@ class RootView extends View
|
||||
|
||||
@on 'increase-font-size', => @setFontSize(@getFontSize() + 1)
|
||||
@on 'decrease-font-size', => @setFontSize(@getFontSize() - 1)
|
||||
@on 'toggle-keybindings-view', => @toggleKeybindingsView()
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
@focus() if onDom
|
||||
@@ -114,6 +116,22 @@ class RootView extends View
|
||||
if not previousActiveEditor or editor.buffer.path != previousActiveEditor.buffer.path
|
||||
@trigger 'active-editor-path-change', editor.buffer.path
|
||||
|
||||
toggleKeybindingsView: ->
|
||||
if @keybindingsView?
|
||||
@keybindingsView.remove()
|
||||
@keybindingsView = null
|
||||
else
|
||||
keybindings = @activeKeybindings()
|
||||
@keybindingsView = $$ ->
|
||||
@div class: 'keybindings-view', =>
|
||||
@ul =>
|
||||
for keystroke, command of keybindings
|
||||
@li =>
|
||||
@span class: 'keystroke', "#{keystroke}"
|
||||
@span "#{command}"
|
||||
|
||||
@append(@keybindingsView)
|
||||
|
||||
activeKeybindings: ->
|
||||
keymap.bindingsForElement(document.activeElement)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user