Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds configurable keymaps for navigation movements #77

Merged
merged 19 commits into from
Oct 9, 2023
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
46105ca
Adds configurable keymaps for navigation movements
LukeHalasy Sep 29, 2023
9e209fe
Changes navigation keymaps to a hashmap instead of a struct. Custom d…
LukeHalasy Oct 2, 2023
736bc67
Changes configurable keymaps to take a list of chars instead of a sin…
LukeHalasy Oct 2, 2023
34d68ee
allows specifying both chars and KeyCode enum strings within the keycode
LukeHalasy Oct 4, 2023
d35b6a8
don't panic (todo!) when no match occurs with a specified navigation
LukeHalasy Oct 4, 2023
f0ad446
Correct defaults for KeyMaps
LukeHalasy Oct 5, 2023
8e467b2
adds context comment surrounding why we must detect characters before
LukeHalasy Oct 5, 2023
19e9967
fix lint issues
LukeHalasy Oct 5, 2023
69183f2
add moveup and movedown as configurable keycommand options for the
LukeHalasy Oct 5, 2023
24c4524
updates README documentation config test
LukeHalasy Oct 5, 2023
16a04c0
merge in recent changes
LukeHalasy Oct 5, 2023
7af7fad
fix linting issues
LukeHalasy Oct 5, 2023
73abe8a
delete commented out block
LukeHalasy Oct 5, 2023
4ee9411
Adds expecting block to the KeyMaps deserializer
LukeHalasy Oct 5, 2023
0dcdef3
add strum crate
LukeHalasy Oct 8, 2023
a8f279c
Match configurable GotoTop and GotoBottom actions in the branch list
LukeHalasy Oct 8, 2023
ad6e296
Use default keymappings for an action if a user didn't add a mapping for
LukeHalasy Oct 8, 2023
9f74a7f
Adds a unit-test to ensure that every Action has a default keybinding
LukeHalasy Oct 8, 2023
c2663d2
fix clippy warnings
LukeHalasy Oct 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl<'de> Deserialize<'de> for Keymaps {
where
A: serde::de::MapAccess<'de>,
{
let mut navigation = HashMap::new();
let mut navigation = Self::Value::default().navigation;

while let Some((section, section_values)) =
map.next_entry::<String, HashMap<String, Vec<String>>>()?
Expand All @@ -171,6 +171,9 @@ impl<'de> Deserialize<'de> for Keymaps {
de::value::StringDeserializer::new(action),
)?;

// over-write default key-map to action
navigation.retain(|_, value| value != &ac);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a less jank way to do this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, only happens once anyway!


for key in keys {
// cross-term can't, with Serde, directly deserialize '<CHARACTER_VALUE>' into a KeyCode
if key.len() == 1 {
Expand Down