Skip to content

Commit

Permalink
feat(keybindings): add binding for opening config (#3352)
Browse files Browse the repository at this point in the history
* feat(keybindings): add binding for opening config

* Fix condition: IsMac -> isMac

* Add CHANGES entry

Co-authored-by: Bryan Phelps <[email protected]>
  • Loading branch information
LiHRaM and bryphe authored Apr 2, 2021
1 parent b12edb3 commit 381ac17
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- #3284 - Definition: Add 'editor.action.revealDefinitionAside' command (fixes #3261)
- #2881 - Extensions: Initial rename support
- #3348 - Code Actions: Implement extension host protocol for quick fix / code actions
- #3352 - Keybindings: Add default keybinding for open configuration (related #1423, thanks @LiHRaM !)

### Bug Fixes

Expand Down
14 changes: 14 additions & 0 deletions src/Feature/Configuration/Feature_Configuration.re
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,22 @@ module Commands = {
);
};

module Keybindings = {
open Feature_Input.Schema;

let command = Commands.openConfigurationFile.id;

let openConfigOnMac =
bind(~key="<D-,>", ~condition="isMac" |> WhenExpr.parse, ~command);

let openConfigOnOther =
bind(~key="<C-,>", ~condition="!isMac" |> WhenExpr.parse, ~command);
};

// CONTRIBUTIONS

module Contributions = {
let commands = Commands.[openConfigurationFile, reload];

let keybindings = Keybindings.[openConfigOnMac, openConfigOnOther];
};
5 changes: 4 additions & 1 deletion src/Feature/Configuration/Feature_Configuration.rei
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ module GlobalConfiguration = GlobalConfiguration;

// CONTRIBUTIONS

module Contributions: {let commands: list(Oni_Core.Command.t(msg));};
module Contributions: {
let commands: list(Oni_Core.Command.t(msg));
let keybindings: list(Feature_Input.Schema.keybinding);
};

module Testing: {let transform: ConfigurationTransformer.t => msg;};
1 change: 1 addition & 0 deletions src/Model/State.re
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let defaultKeyBindings =
]
@ Feature_SideBar.Contributions.keybindings
@ Feature_Clipboard.Contributions.keybindings
@ Feature_Configuration.Contributions.keybindings
@ Feature_Input.Schema.[
bind(
~key="<C-TAB>",
Expand Down

0 comments on commit 381ac17

Please sign in to comment.