feat: support enable for which-key

This commit is contained in:
gaesa 2024-06-09 21:16:24 +08:00
parent 189cb81db3
commit ebd57cea44
No known key found for this signature in database
3 changed files with 9 additions and 3 deletions

View file

@ -185,6 +185,7 @@ open_origin = "hovered"
open_offset = [ 0, 1, 50, 7 ]
[which]
enable = true
sort_by = "none"
sort_sensitive = false
sort_reverse = false

View file

@ -6,6 +6,7 @@ use crate::MERGED_YAZI;
#[derive(Debug, Deserialize, Serialize, Validate)]
pub struct Which {
pub enable: bool,
// Sorting
pub sort_by: SortBy,
pub sort_sensitive: bool,

View file

@ -1,6 +1,6 @@
use std::{collections::HashSet, str::FromStr};
use yazi_config::{keymap::{Control, Key}, KEYMAP};
use yazi_config::{keymap::{Control, Key}, KEYMAP, WHICH};
use yazi_shared::{event::Cmd, render, Layer};
use crate::which::{Which, WhichSorter};
@ -43,6 +43,10 @@ impl Which {
}
pub fn show_with(&mut self, key: &Key, layer: Layer) {
if !WHICH.enable {
return;
}
let mut seen = HashSet::new();
self.layer = layer;