workspace: Add NewFileSplit action with direction (#39726)
Add new `workspace::NewFileSplit` action which expects a
`SplitDirection` argument, allowing users to programmatically control
the direction of the split in keymaps, for example:
```json
{
"context": "Editor",
"bindings": {
"ctrl-s ctrl-h": ["workspace::NewFileSplit", "left"],
"ctrl-s ctrl-j": ["workspace::NewFileSplit", "down"],
"ctrl-s ctrl-k": ["workspace::NewFileSplit", "up"],
"ctrl-s ctrl-l": ["workspace::NewFileSplit", "right"]
}
}
```
Release Notes:
- Added `workspace::NewFileSplit` action, which can be used to
programmatically split the editor in the provided direction.
Co-authored-by: Rian Drake <rian.drake@rocketwerkz.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
This commit is contained in:
co-authored by
Rian Drake
dino
parent
67b9d480b4
commit
8bef4800f0
@@ -302,6 +302,12 @@ pub struct MoveItemToPaneInDirection {
|
||||
pub clone: bool,
|
||||
}
|
||||
|
||||
/// Creates a new file in a split of the desired direction.
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
|
||||
#[action(namespace = workspace)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct NewFileSplit(pub SplitDirection);
|
||||
|
||||
fn default_right() -> SplitDirection {
|
||||
SplitDirection::Right
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user