Load all keymaps found in ~/.atom/keymaps

This commit is contained in:
Kevin Sawicki
2013-01-13 14:56:25 -08:00
parent fc8fb73176
commit 0c42ab71d7
2 changed files with 8 additions and 1 deletions

View File

@@ -28,6 +28,12 @@ class Keymap
$(document).command 'open', => atom.open()
$(document).command 'open-unstable', => atom.openUnstable()
loadBundledKeymaps: ->
@loadDirectory(require.resolve('keymaps'))
loadUserKeymaps: ->
@loadDirectory(fs.join(config.configDirPath, 'keymaps'))
loadDirectory: (directoryPath) ->
@load(filePath) for filePath in fs.list(directoryPath)

View File

@@ -60,7 +60,8 @@ windowAdditions =
@keymap = new Keymap()
@keymap.bindDefaultKeys()
@keymap.loadDirectory(require.resolve('keymaps'))
@keymap.loadBundledKeymaps()
@keymap.loadUserKeymaps()
@_handleKeyEvent = (e) => @keymap.handleKeyEvent(e)
$(document).on 'keydown', @_handleKeyEvent