Skip to content

Commit 19177ec

Browse files
author
Stephan Dilly
committed
simplify key bindings further
1 parent 5445594 commit 19177ec

File tree

7 files changed

+14
-41
lines changed

7 files changed

+14
-41
lines changed

assets/vim_style_key_config.ron

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
exit: ( code: Char('c'), modifiers: ( bits: 2,),),
2323
exit_popup: ( code: Esc, modifiers: ( bits: 0,),),
2424

25-
close_msg: ( code: Enter, modifiers: ( bits: 0,),),
2625
open_commit: ( code: Char('c'), modifiers: ( bits: 0,),),
2726
open_commit_editor: ( code: Char('E'), modifiers: ( bits: 0,),),
2827
open_help: ( code: F(1), modifiers: ( bits: 0,),),
@@ -43,7 +42,6 @@
4342

4443
edit_file: ( code: Char('I'), modifiers: ( bits: 0,),),
4544

46-
status_toggle_item: ( code: Enter, modifiers: ( bits: 0,),),
4745
status_stage_all: ( code: Char('a'), modifiers: ( bits: 0,),),
4846

4947
status_reset_item: ( code: Char('U'), modifiers: ( bits: 0,),),
@@ -53,12 +51,10 @@
5351
stashing_toggle_untracked: ( code: Char('u'), modifiers: ( bits: 0,),),
5452
stashing_toggle_index: ( code: Char('m'), modifiers: ( bits: 0,),),
5553

56-
stash_apply: ( code: Enter, modifiers: ( bits: 0,),),
5754
stash_open: ( code: Char('l'), modifiers: ( bits: 0,),),
5855
stash_drop: ( code: Char('D'), modifiers: ( bits: 0,),),
5956

6057
cmd_bar_toggle: ( code: Char('.'), modifiers: ( bits: 0,),),
61-
log_commit_details: ( code: Enter, modifiers: ( bits: 0,),),
6258
log_tag_commit: ( code: Char('t'), modifiers: ( bits: 0,),),
6359
commit_amend: ( code: Char('A'), modifiers: ( bits: 0,),),
6460
copy: ( code: Char('y'), modifiers: ( bits: 0,),),

src/components/changes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl Component for ChangesComponent {
267267
.borrow_mut()
268268
.push_back(InternalEvent::OpenCommit);
269269
Ok(true)
270-
} else if e == self.key_config.status_toggle_item {
270+
} else if e == self.key_config.enter {
271271
try_or_popup!(
272272
self,
273273
"staging error:",

src/components/msg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl Component for MsgComponent {
7373
fn event(&mut self, ev: Event) -> Result<bool> {
7474
if self.visible {
7575
if let Event::Key(e) = ev {
76-
if e == self.key_config.close_msg {
76+
if e == self.key_config.enter {
7777
self.hide();
7878
}
7979
}

src/keys.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub struct KeyConfig {
3232
pub focus_below: KeyEvent,
3333
pub exit: KeyEvent,
3434
pub exit_popup: KeyEvent,
35-
pub close_msg: KeyEvent,
3635
pub open_commit: KeyEvent,
3736
pub open_commit_editor: KeyEvent,
3837
pub open_help: KeyEvent,
@@ -49,17 +48,14 @@ pub struct KeyConfig {
4948
pub enter: KeyEvent,
5049
pub edit_file: KeyEvent,
5150
pub status_stage_all: KeyEvent,
52-
pub status_toggle_item: KeyEvent,
5351
pub status_reset_item: KeyEvent,
5452
pub status_ignore_file: KeyEvent,
5553
pub stashing_save: KeyEvent,
5654
pub stashing_toggle_untracked: KeyEvent,
5755
pub stashing_toggle_index: KeyEvent,
58-
pub stash_apply: KeyEvent,
5956
pub stash_open: KeyEvent,
6057
pub stash_drop: KeyEvent,
6158
pub cmd_bar_toggle: KeyEvent,
62-
pub log_commit_details: KeyEvent,
6359
pub log_tag_commit: KeyEvent,
6460
pub commit_amend: KeyEvent,
6561
pub copy: KeyEvent,
@@ -84,7 +80,6 @@ impl Default for KeyConfig {
8480
focus_below: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::empty()},
8581
exit: KeyEvent { code: KeyCode::Char('c'), modifiers: KeyModifiers::CONTROL},
8682
exit_popup: KeyEvent { code: KeyCode::Esc, modifiers: KeyModifiers::empty()},
87-
close_msg: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
8883
open_commit: KeyEvent { code: KeyCode::Char('c'), modifiers: KeyModifiers::empty()},
8984
open_commit_editor: KeyEvent { code: KeyCode::Char('e'), modifiers:KeyModifiers::CONTROL},
9085
open_help: KeyEvent { code: KeyCode::Char('h'), modifiers: KeyModifiers::empty()},
@@ -100,18 +95,15 @@ impl Default for KeyConfig {
10095
shift_down: KeyEvent { code: KeyCode::Down, modifiers: KeyModifiers::SHIFT},
10196
enter: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
10297
edit_file: KeyEvent { code: KeyCode::Char('e'), modifiers: KeyModifiers::empty()},
103-
status_toggle_item: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
10498
status_stage_all: KeyEvent { code: KeyCode::Char('a'), modifiers: KeyModifiers::empty()},
10599
status_reset_item: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
106100
status_ignore_file: KeyEvent { code: KeyCode::Char('i'), modifiers: KeyModifiers::empty()},
107101
stashing_save: KeyEvent { code: KeyCode::Char('s'), modifiers: KeyModifiers::empty()},
108102
stashing_toggle_untracked: KeyEvent { code: KeyCode::Char('u'), modifiers: KeyModifiers::empty()},
109103
stashing_toggle_index: KeyEvent { code: KeyCode::Char('i'), modifiers: KeyModifiers::empty()},
110-
stash_apply: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
111104
stash_open: KeyEvent { code: KeyCode::Right, modifiers: KeyModifiers::empty()},
112105
stash_drop: KeyEvent { code: KeyCode::Char('D'), modifiers: KeyModifiers::SHIFT},
113106
cmd_bar_toggle: KeyEvent { code: KeyCode::Char('.'), modifiers: KeyModifiers::empty()},
114-
log_commit_details: KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::empty()},
115107
log_tag_commit: KeyEvent { code: KeyCode::Char('t'), modifiers: KeyModifiers::empty()},
116108
commit_amend: KeyEvent { code: KeyCode::Char('a'), modifiers: KeyModifiers::CONTROL},
117109
copy: KeyEvent { code: KeyCode::Char('y'), modifiers: KeyModifiers::empty()},

src/strings.rs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,7 @@ pub mod commands {
253253
key_config: &SharedKeyConfig,
254254
) -> CommandText {
255255
CommandText::new(
256-
format!(
257-
"Add hunk [{}]",
258-
get_hint(key_config.status_toggle_item),
259-
),
256+
format!("Add hunk [{}]", get_hint(key_config.enter),),
260257
"adds selected hunk to stage",
261258
CMD_GROUP_DIFF,
262259
)
@@ -277,10 +274,7 @@ pub mod commands {
277274
key_config: &SharedKeyConfig,
278275
) -> CommandText {
279276
CommandText::new(
280-
format!(
281-
"Remove hunk [{}]",
282-
get_hint(key_config.close_msg),
283-
),
277+
format!("Remove hunk [{}]", get_hint(key_config.enter),),
284278
"removes selected hunk from stage",
285279
CMD_GROUP_DIFF,
286280
)
@@ -294,7 +288,7 @@ pub mod commands {
294288
}
295289
pub fn close_msg(key_config: &SharedKeyConfig) -> CommandText {
296290
CommandText::new(
297-
format!("Close [{}]", get_hint(key_config.close_msg),),
291+
format!("Close [{}]", get_hint(key_config.enter),),
298292
"close msg popup (e.g msg)",
299293
CMD_GROUP_GENERAL,
300294
)
@@ -379,10 +373,7 @@ pub mod commands {
379373
}
380374
pub fn stage_item(key_config: &SharedKeyConfig) -> CommandText {
381375
CommandText::new(
382-
format!(
383-
"Stage Item [{}]",
384-
get_hint(key_config.stash_apply),
385-
),
376+
format!("Stage Item [{}]", get_hint(key_config.enter),),
386377
"stage currently selected file or entire path",
387378
CMD_GROUP_CHANGES,
388379
)
@@ -399,10 +390,7 @@ pub mod commands {
399390
}
400391
pub fn unstage_item(key_config: &SharedKeyConfig) -> CommandText {
401392
CommandText::new(
402-
format!(
403-
"Unstage Item [{}]",
404-
get_hint(key_config.stash_apply),
405-
),
393+
format!("Unstage Item [{}]", get_hint(key_config.enter),),
406394
"unstage currently selected file or entire path",
407395
CMD_GROUP_CHANGES,
408396
)
@@ -467,7 +455,7 @@ pub mod commands {
467455
key_config: &SharedKeyConfig,
468456
) -> CommandText {
469457
CommandText::new(
470-
format!("Confirm [{}]", get_hint(key_config.close_msg),),
458+
format!("Confirm [{}]", get_hint(key_config.enter),),
471459
"resets the file in question",
472460
CMD_GROUP_GENERAL,
473461
)
@@ -509,7 +497,7 @@ pub mod commands {
509497
key_config: &SharedKeyConfig,
510498
) -> CommandText {
511499
CommandText::new(
512-
format!("Stash [{}]", get_hint(key_config.close_msg),),
500+
format!("Stash [{}]", get_hint(key_config.enter),),
513501
"save files to stash",
514502
CMD_GROUP_STASHING,
515503
)
@@ -518,7 +506,7 @@ pub mod commands {
518506
key_config: &SharedKeyConfig,
519507
) -> CommandText {
520508
CommandText::new(
521-
format!("Apply [{}]", get_hint(key_config.stash_apply),),
509+
format!("Apply [{}]", get_hint(key_config.enter),),
522510
"apply selected stash",
523511
CMD_GROUP_STASHES,
524512
)
@@ -545,10 +533,7 @@ pub mod commands {
545533
key_config: &SharedKeyConfig,
546534
) -> CommandText {
547535
CommandText::new(
548-
format!(
549-
"Details [{}]",
550-
get_hint(key_config.log_commit_details),
551-
),
536+
format!("Details [{}]", get_hint(key_config.enter),),
552537
"open details of selected commit",
553538
CMD_GROUP_LOG,
554539
)
@@ -575,7 +560,7 @@ pub mod commands {
575560
key_config: &SharedKeyConfig,
576561
) -> CommandText {
577562
CommandText::new(
578-
format!("Tag [{}]", get_hint(key_config.close_msg),),
563+
format!("Tag [{}]", get_hint(key_config.enter),),
579564
"tag commit",
580565
CMD_GROUP_LOG,
581566
)

src/tabs/revlog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl Component for Revlog {
200200
self.update()?;
201201
return Ok(true);
202202
} else if let Event::Key(k) = ev {
203-
if k == self.key_config.log_commit_details {
203+
if k == self.key_config.enter {
204204
self.commit_details.toggle_visible()?;
205205
self.update()?;
206206
return Ok(true);

src/tabs/stashlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl Component for StashList {
149149
}
150150

151151
if let Event::Key(k) = ev {
152-
if k == self.key_config.stash_apply {
152+
if k == self.key_config.enter {
153153
self.apply_stash()
154154
} else if k == self.key_config.stash_drop {
155155
self.drop_stash()

0 commit comments

Comments
 (0)