@@ -88,43 +88,44 @@ use std::collections::HashMap;
90// #[cfg(feature = "term")]
90// #[cfg(feature = "term")]
91−pub use crossterm::event::{KeyCode, KeyEvent as Key, KeyModifiers as Modifiers};
91+pub use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
93−pub type Keymap = HashMap<Key, Command>;
93+pub type Keymap = HashMap<KeyEvent, Command>;
94pub type Keymaps = HashMap<Mode, Keymap>;
94pub type Keymaps = HashMap<Mode, Keymap>;
96macro_rules! key {
97macro_rules! key {
97− ($ch:expr) => {
98+ ($($ch:tt)*) => {
99− code: KeyCode::Char($ch),
100+ code: KeyCode::Char($($ch)*),
100− modifiers: Modifiers::NONE,
101+ modifiers: KeyModifiers::NONE,
105macro_rules! shift {
106macro_rules! shift {
106− ($ch:expr) => {
107+ ($($ch:tt)*) => {
107− Key {
108+ KeyEvent {
108− code: KeyCode::Char($ch),
109+ code: KeyCode::Char($($ch)*),
109− modifiers: Modifiers::SHIFT,
110+ modifiers: KeyModifiers::SHIFT,
114macro_rules! ctrl {
115macro_rules! ctrl {
115− ($ch:expr) => {
116+ ($($ch:tt)*) => {
116− Key {
117+ KeyEvent {
117− code: KeyCode::Char($ch),
118+ code: KeyCode::Char($($ch)*),
118− modifiers: Modifiers::CONTROL,
119+ modifiers: KeyModifiers::CONTROL,
123macro_rules! alt {
124macro_rules! alt {
124− ($ch:expr) => {
125+ ($($ch:tt)*) => {
125− Key {
126+ KeyEvent {
126− code: KeyCode::Char($ch),
127+ code: KeyCode::Char($($ch)*),
127− modifiers: Modifiers::ALT,
128+ modifiers: KeyModifiers::ALT,
@@ -228,26 +229,26 @@ pub fn default() -> Keymaps {
229 // C / altC = copy (repeat) selections on prev/next lines
230 // C / altC = copy (repeat) selections on prev/next lines
231− Key {
232+ KeyEvent {
232 code: KeyCode::Esc,
233 code: KeyCode::Esc,
233− modifiers: Modifiers::NONE
234+ modifiers: KeyModifiers::NONE
234 } => commands::normal_mode,
235 } => commands::normal_mode,
235− Key {
236+ KeyEvent {
236 code: KeyCode::PageUp,
237 code: KeyCode::PageUp,
237− modifiers: Modifiers::NONE
238+ modifiers: KeyModifiers::NONE
238 } => commands::page_up,
239 } => commands::page_up,
239− Key {
240+ KeyEvent {
240 code: KeyCode::PageDown,
241 code: KeyCode::PageDown,
241− modifiers: Modifiers::NONE
242+ modifiers: KeyModifiers::NONE
242 } => commands::page_down,
243 } => commands::page_down,
243 ctrl!('u') => commands::half_page_up,
244 ctrl!('u') => commands::half_page_up,
244 ctrl!('d') => commands::half_page_down,
245 ctrl!('d') => commands::half_page_down,
246 ctrl!('p') => commands::file_picker,
247 ctrl!('p') => commands::file_picker,
247 ctrl!('b') => commands::buffer_picker,
248 ctrl!('b') => commands::buffer_picker,
248− Key {
249+ KeyEvent {
249 code: KeyCode::Tab,
250 code: KeyCode::Tab,
250− modifiers: Modifiers::NONE
251+ modifiers: KeyModifiers::NONE
251 } => commands::next_view,
252 } => commands::next_view,
253 // move under <space>c
254 // move under <space>c
@@ -280,9 +281,9 @@ pub fn default() -> Keymaps {
280 shift!('T') => commands::extend_till_prev_char,
281 shift!('T') => commands::extend_till_prev_char,
281 shift!('F') => commands::extend_prev_char,
282 shift!('F') => commands::extend_prev_char,
283− Key {
284+ KeyEvent {
284 code: KeyCode::Esc,
285 code: KeyCode::Esc,
285− modifiers: Modifiers::NONE
286+ modifiers: KeyModifiers::NONE
286 } => commands::exit_select_mode as Command,
287 } => commands::exit_select_mode as Command,
288 .into_iter(),
289 .into_iter(),
@@ -294,25 +295,25 @@ pub fn default() -> Keymaps {
294 Mode::Normal => normal,
295 Mode::Normal => normal,
295 Mode::Select => select,
296 Mode::Select => select,
296 Mode::Insert => hashmap!(
297 Mode::Insert => hashmap!(
297− Key {
298+ KeyEvent {
298 code: KeyCode::Esc,
299 code: KeyCode::Esc,
299− modifiers: Modifiers::NONE
300+ modifiers: KeyModifiers::NONE
300 } => commands::normal_mode as Command,
301 } => commands::normal_mode as Command,
301− Key {
302+ KeyEvent {
302 code: KeyCode::Backspace,
303 code: KeyCode::Backspace,
303− modifiers: Modifiers::NONE
304+ modifiers: KeyModifiers::NONE
304 } => commands::insert::delete_char_backward,
305 } => commands::insert::delete_char_backward,
305− Key {
306+ KeyEvent {
306 code: KeyCode::Delete,
307 code: KeyCode::Delete,
307− modifiers: Modifiers::NONE
308+ modifiers: KeyModifiers::NONE
308 } => commands::insert::delete_char_forward,
309 } => commands::insert::delete_char_forward,
309− Key {
310+ KeyEvent {
310 code: KeyCode::Enter,
311 code: KeyCode::Enter,
311− modifiers: Modifiers::NONE
312+ modifiers: KeyModifiers::NONE
312 } => commands::insert::insert_newline,
313 } => commands::insert::insert_newline,
313− Key {
314+ KeyEvent {
314 code: KeyCode::Tab,
315 code: KeyCode::Tab,
315− modifiers: Modifiers::NONE
316+ modifiers: KeyModifiers::NONE
316 } => commands::insert::insert_tab,
317 } => commands::insert::insert_tab,
318 ctrl!('x') => commands::completion,
319 ctrl!('x') => commands::completion,