feat: default explorer to compact directory tree
This commit is contained in:
+13
-3
@@ -19,6 +19,8 @@ pub struct Config {
|
||||
pub bindings: Vec<Binding>,
|
||||
pub leader: String,
|
||||
pub file_explorer_side: String,
|
||||
pub file_picker_view: String,
|
||||
pub file_explorer_view: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@@ -28,6 +30,8 @@ impl Default for Config {
|
||||
bindings: Vec::new(),
|
||||
leader: "space".into(),
|
||||
file_explorer_side: "right".into(),
|
||||
file_picker_view: "list".into(),
|
||||
file_explorer_view: "tree".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +48,8 @@ pub fn load_config(path: &Path) -> Result<Config, String> {
|
||||
bindings,
|
||||
leader,
|
||||
file_explorer_side,
|
||||
file_picker_view,
|
||||
file_explorer_view,
|
||||
..
|
||||
} => {
|
||||
let mut config = Config::default();
|
||||
@@ -57,6 +63,8 @@ pub fn load_config(path: &Path) -> Result<Config, String> {
|
||||
config.bindings = bindings;
|
||||
config.leader = leader;
|
||||
config.file_explorer_side = file_explorer_side;
|
||||
config.file_picker_view = file_picker_view;
|
||||
config.file_explorer_view = file_explorer_view;
|
||||
Ok(config)
|
||||
}
|
||||
Response::Error {
|
||||
@@ -203,6 +211,8 @@ enum Response {
|
||||
bindings: Vec<Binding>,
|
||||
leader: String,
|
||||
file_explorer_side: String,
|
||||
file_picker_view: String,
|
||||
file_explorer_view: String,
|
||||
},
|
||||
#[serde(rename = "result")]
|
||||
Result {
|
||||
@@ -598,9 +608,9 @@ end
|
||||
assert!(load_config(&path).unwrap_err().contains(error), "{value}");
|
||||
}
|
||||
for frame in [
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"file_explorer_side":"right"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":null,"file_explorer_side":"right"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":7,"file_explorer_side":"right"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":null,"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":7,"file_explorer_side":"right","file_picker_view":"list","file_explorer_view":"tree"}"#,
|
||||
] {
|
||||
assert!(serde_json::from_str::<Response>(frame).is_err(), "{frame}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user