#keymaps #vim #codes #keychords

keymaps

A rust crate which provides a standardized encoding for key codes

11 releases (3 stable)

Uses new Rust 2024

new 1.1.1 Apr 27, 2025
1.0.0 Feb 1, 2025
0.3.1 Jan 31, 2025
0.2.1 Jan 31, 2025
0.0.0 Dec 23, 2023

#156 in Command-line interface

Download history 416/week @ 2025-01-26 220/week @ 2025-02-02 1/week @ 2025-02-09 4/week @ 2025-02-16 1/week @ 2025-02-23 2/week @ 2025-03-02

902 downloads per month

LGPL-3.0-or-later

83KB
2K SLoC

Keymaps

A rust crate which provides a standardized encoding for key codes

Quickstart

use keymaps::{
    key_repr::{Key, Keys},
    map_tree::Trie,
};

fn main() {
    let mut tree = MapTrie::<&str>::new();

    let keys: Vec<Key> = Key::parse_multiple("<C-c>ab").unwrap();
    tree.insert(&keys, "first").unwrap();

    let keys: Vec<Key> = Key::parse_multiple("<CA-B>ac").unwrap();
    tree.insert(&keys, "second").unwrap();

    let keys: Keys = ("<AMC-0>d").parse().unwrap();
    tree.insert(&keys, "third").unwrap();

    println!("Got value: '{}'", tree.get(&keys).unwrap().value().unwrap());

    println!("Tree is: \n{tree}");
}

Licence

This program is free software: you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Dependencies

~0.2–9MB
~106K SLoC