fpv 0.1.12

A minimal, keyboard-first TUI file previewer with syntax highlighting
Documentation
1
2
3
4
5
6
7
8
9
use crate::config::keymap::Action;
use crossterm::event::KeyEvent;
use std::collections::HashMap;

pub fn map_key_to_action(key: KeyEvent, bindings: &HashMap<Action, KeyEvent>) -> Option<Action> {
    bindings
        .iter()
        .find_map(|(action, mapped)| if *mapped == key { Some(*action) } else { None })
}