From 42362e6ce96797f9f41ca447a5785304f4f6d764 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 25 Oct 2013 16:12:08 -0700 Subject: [PATCH 1/8] Load user-keymap.cson instead of keymaps dir --- src/keymap.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keymap.coffee b/src/keymap.coffee index 69525dfa7..94f84b9dc 100644 --- a/src/keymap.coffee +++ b/src/keymap.coffee @@ -37,7 +37,8 @@ class Keymap @emit('bundled-keymaps-loaded') loadUserKeymaps: -> - @loadDirectory(path.join(config.configDirPath, 'keymaps')) + userKeymapPath = path.join(config.configDirPath, 'keymap.cson') + @load(userKeymapPath) if fsUtils.exists(userKeymapPath) loadDirectory: (directoryPath) -> @load(filePath) for filePath in fsUtils.listSync(directoryPath, ['.cson', '.json']) From 97c183d6df510a2e48eeb6f6c3b56946fc58271f Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 25 Oct 2013 16:16:47 -0700 Subject: [PATCH 2/8] Update docs --- docs/customizing-atom.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/customizing-atom.md b/docs/customizing-atom.md index a2e7fecb8..823894324 100644 --- a/docs/customizing-atom.md +++ b/docs/customizing-atom.md @@ -40,10 +40,9 @@ the editor to insert a newline. But if the same keystroke occurs inside of a select list's mini-editor, it instead emits the `core:confirm` event based on the binding in the more-specific selector. -By default, any keymap files in your `~/.atom/keymaps` directory are loaded -in alphabetical order when Atom is started. They will always be loaded last, -giving you the chance to override bindings that are defined by Atom's core -keymaps or third-party packages. +By default, `~/.atom/keymap.cson` is loaded when Atom is started. It will always +be loaded last, giving you the chance to override bindings that are defined by +Atom's core keymaps or third-party packages. ## Advanced Configuration From 330bb1df4b24402823e47822e158515f11a3177b Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 25 Oct 2013 16:16:59 -0700 Subject: [PATCH 3/8] Add keymap.cson file to dot-atom --- dot-atom/keymap.cson | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 dot-atom/keymap.cson diff --git a/dot-atom/keymap.cson b/dot-atom/keymap.cson new file mode 100644 index 000000000..17115d01d --- /dev/null +++ b/dot-atom/keymap.cson @@ -0,0 +1,12 @@ +# User keymap +# +# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors +# to apply styles to elements, Atom keymaps use selectors to associate +# keystrokes with events in specific contexts. Here's a small example, excerpted +# from Atom's built-in keymaps: +# +#'.editor': +# 'enter': 'editor:newline' +# +#".select-list .editor.mini": +# 'enter': 'core:confirm' From 95107052d04b79d7e4f939c75f79aa786ff3873c Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 28 Oct 2013 09:18:29 -0700 Subject: [PATCH 4/8] User keymap can be cson or json --- src/keymap.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keymap.coffee b/src/keymap.coffee index 94f84b9dc..f93c04c4f 100644 --- a/src/keymap.coffee +++ b/src/keymap.coffee @@ -37,8 +37,8 @@ class Keymap @emit('bundled-keymaps-loaded') loadUserKeymaps: -> - userKeymapPath = path.join(config.configDirPath, 'keymap.cson') - @load(userKeymapPath) if fsUtils.exists(userKeymapPath) + userKeymapPath = CSON.resolve(path.join(config.configDirPath, 'keymap')) + @load(userKeymapPath) if userKeymapPath loadDirectory: (directoryPath) -> @load(filePath) for filePath in fsUtils.listSync(directoryPath, ['.cson', '.json']) From cde0fae1f334171f1743d74918d0bb406ee6aa2a Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 28 Oct 2013 09:19:23 -0700 Subject: [PATCH 5/8] Rename `Keymap::loadUserKeymaps` to `Keymap::loadUserKeymap` --- src/keymap.coffee | 2 +- src/window.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keymap.coffee b/src/keymap.coffee index f93c04c4f..d64b1f082 100644 --- a/src/keymap.coffee +++ b/src/keymap.coffee @@ -36,7 +36,7 @@ class Keymap @loadDirectory(config.bundledKeymapsDirPath) @emit('bundled-keymaps-loaded') - loadUserKeymaps: -> + loadUserKeymap: -> userKeymapPath = CSON.resolve(path.join(config.configDirPath, 'keymap')) @load(userKeymapPath) if userKeymapPath diff --git a/src/window.coffee b/src/window.coffee index 4282d2a0b..6f7ec2d0a 100644 --- a/src/window.coffee +++ b/src/window.coffee @@ -53,7 +53,7 @@ window.startEditorWindow = -> atom.packages.loadPackages() deserializeEditorWindow() atom.packages.activate() - atom.keymap.loadUserKeymaps() + atom.keymap.loadUserKeymap() atom.requireUserInitScript() atom.menu.update() $(window).on 'unload', -> From 7c70c43c1c06edc67e7e6073db0449fa80e8926d Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 28 Oct 2013 09:23:18 -0700 Subject: [PATCH 6/8] Update keymap documentation --- docs/customizing-atom.md | 5 +++-- dot-atom/keymap.cson | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/customizing-atom.md b/docs/customizing-atom.md index 823894324..302faa486 100644 --- a/docs/customizing-atom.md +++ b/docs/customizing-atom.md @@ -30,8 +30,9 @@ built-in keymaps: '.editor': 'enter': 'editor:newline' -".select-list .editor.mini": - 'enter': 'core:confirm' +'body': + 'ctrl-P': 'core:move-up' + 'ctrl-p': 'core:move-down' ``` This keymap defines the meaning of `enter` in two different contexts. In a diff --git a/dot-atom/keymap.cson b/dot-atom/keymap.cson index 17115d01d..872395168 100644 --- a/dot-atom/keymap.cson +++ b/dot-atom/keymap.cson @@ -5,8 +5,9 @@ # keystrokes with events in specific contexts. Here's a small example, excerpted # from Atom's built-in keymaps: # -#'.editor': -# 'enter': 'editor:newline' +# '.editor': +# 'enter': 'editor:newline' # -#".select-list .editor.mini": -# 'enter': 'core:confirm' +# 'body': +# 'ctrl-P': 'core:move-up' +# 'ctrl-p': 'core:move-down' From d5b960f32b237c935bf231fa60ff35e860a18357 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 28 Oct 2013 10:04:29 -0700 Subject: [PATCH 7/8] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96b6201dd..143db04dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Improved: Store user keymaps in `~/.atom/keymap.cson` + * Improved: Faster and better looking find and replace * Improved: Double-click selection behavior between word/non-word * Added: Solarized theme now bundled by default From 05c70aceec997846c22d9d47d7cb04eb22f99613 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 28 Oct 2013 15:01:43 -0700 Subject: [PATCH 8/8] Revert "Update changelog" This reverts commit d5b960f32b237c935bf231fa60ff35e860a18357. --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 143db04dc..96b6201dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,3 @@ -* Improved: Store user keymaps in `~/.atom/keymap.cson` - * Improved: Faster and better looking find and replace * Improved: Double-click selection behavior between word/non-word * Added: Solarized theme now bundled by default