diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index c93079efa..750a1468f 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -68,6 +68,8 @@ 'cmd-=': 'window:increase-font-size' 'cmd-+': 'window:increase-font-size' 'cmd--': 'window:decrease-font-size' + 'cmd-_': 'window:decrease-font-size' + 'cmd-0': 'window:reset-font-size' 'cmd-k up': 'pane:split-up' # Atom Specific 'cmd-k down': 'pane:split-down' # Atom Specific @@ -122,7 +124,6 @@ 'alt-cmd-z': 'editor:checkout-head-revision' 'cmd-<': 'editor:scroll-to-cursor' 'alt-cmd-ctrl-f': 'editor:fold-selection' - 'cmd-=': 'editor:auto-indent' # Sublime Parity 'cmd-enter': 'editor:newline-below' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 9c78e3622..ca306414e 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -40,6 +40,8 @@ 'ctrl-=': 'window:increase-font-size' 'ctrl-+': 'window:increase-font-size' 'ctrl--': 'window:decrease-font-size' + 'ctrl-_': 'window:decrease-font-size' + 'ctrl-0': 'window:reset-font-size' 'ctrl-k up': 'pane:split-up' # Atom Specific 'ctrl-k down': 'pane:split-down' # Atom Specific @@ -69,7 +71,6 @@ 'alt-ctrl-z': 'editor:checkout-head-revision' 'ctrl-<': 'editor:scroll-to-cursor' 'alt-ctrl-f': 'editor:fold-selection' - 'ctrl-=': 'editor:auto-indent' # Sublime Parity 'ctrl-enter': 'editor:newline-below' diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 9f8afa408..02ef6d6d8 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -63,6 +63,19 @@ describe "Config", -> atom.config.toggle('foo.a') expect(atom.config.get('foo.a')).toBe false + describe ".restoreDefault(keyPath)", -> + it "sets the value of the key path to its default", -> + atom.config.setDefaults('a', b: 3) + atom.config.set('a.b', 4) + expect(atom.config.get('a.b')).toBe 4 + atom.config.restoreDefault('a.b') + expect(atom.config.get('a.b')).toBe 3 + + atom.config.set('a.c', 5) + expect(atom.config.get('a.c')).toBe 5 + atom.config.restoreDefault('a.c') + expect(atom.config.get('a.c')).toBeUndefined() + describe ".pushAtKeyPath(keyPath, value)", -> it "pushes the given value to the array at the key path and updates observers", -> atom.config.set("foo.bar.baz", ["a"]) diff --git a/src/config.coffee b/src/config.coffee index 7896fa795..775d051ee 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -150,6 +150,14 @@ class Config toggle: (keyPath) -> @set(keyPath, !@get(keyPath)) + # Public: Restore the key path to its default value. + # + # keyPath - The {String} name of the key. + # + # Returns the new value. + restoreDefault: (keyPath) -> + @set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath)) + # Public: Push the value to the array at the key path. # # keyPath - The {String} key path. diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 9b66cae78..acf631a81 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -117,6 +117,7 @@ class WorkspaceView extends View @command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', path.join(atom.project.getPath(), 'spec')) @command 'window:increase-font-size', => @increaseFontSize() @command 'window:decrease-font-size', => @decreaseFontSize() + @command 'window:reset-font-size', => @model.resetFontSize() @command 'window:focus-next-pane', => @focusNextPane() @command 'window:focus-previous-pane', => @focusPreviousPane() diff --git a/src/workspace.coffee b/src/workspace.coffee index c123131e7..945ee9b6c 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -167,6 +167,9 @@ class Workspace extends Model fontSize = atom.config.get("editor.fontSize") atom.config.set("editor.fontSize", fontSize - 1) if fontSize > 1 + resetFontSize: -> + atom.config.restoreDefault("editor.fontSize") + # Removes the item's uri from the list of potential items to reopen. itemOpened: (item) -> if uri = item.getUri?()