diff options
-rw-r--r-- | src/commands/show_workers.rs | 2 | ||||
-rw-r--r-- | src/config/keymap/default_keymap.rs | 100 | ||||
-rw-r--r-- | src/config/keymap/keymapping.rs | 5 | ||||
-rw-r--r-- | src/ui/widgets/tui_file_preview.rs | 2 |
4 files changed, 10 insertions, 99 deletions
diff --git a/src/commands/show_workers.rs b/src/commands/show_workers.rs index 3250f5b..82c3aa2 100644 --- a/src/commands/show_workers.rs +++ b/src/commands/show_workers.rs @@ -11,7 +11,7 @@ use crate::util::input; pub fn show_workers( context: &mut AppContext, backend: &mut TuiBackend, - keymap_t: &AppKeyMapping, + _keymap_t: &AppKeyMapping, ) -> JoshutoResult<()> { context.flush_event(); diff --git a/src/config/keymap/default_keymap.rs b/src/config/keymap/default_keymap.rs index a8ede07..281e42d 100644 --- a/src/config/keymap/default_keymap.rs +++ b/src/config/keymap/default_keymap.rs @@ -1,97 +1,5 @@ -pub const DEFAULT_KEYMAP: &str = " -mapcommand = [ - { keys = [ \"T\" ], command = \"new_tab\" }, - { keys = [ \"ctrl+t\" ], command = \"new_tab\" }, - { keys = [ \"W\" ], command = \"close_tab\" }, - { keys = [ \"ctrl+w\" ], command = \"close_tab\" }, - { keys = [ \"q\" ], command = \"close_tab\" }, - { keys = [ \"Q\" ], command = \"quit_to_cwd\" }, +#[cfg(not(target_os = "windows"))] +pub const DEFAULT_KEYMAP: &str = include_str!("../../../config/keymap.toml"); - { keys = [ \"R\" ], command = \"reload_dirlist\" }, - { keys = [ \"z\", \"h\" ], command = \"toggle_hidden\" }, - { keys = [ \"\t\" ], command = \"tab_switch 1\" }, - { keys = [ \"backtab\" ], command = \"tab_switch -1\" }, - - { keys = [ \"alt+1\" ], command = \"tab_switch_index 1\" }, - { keys = [ \"alt+2\" ], command = \"tab_switch_index 2\" }, - { keys = [ \"alt+3\" ], command = \"tab_switch_index 3\" }, - { keys = [ \"alt+4\" ], command = \"tab_switch_index 4\" }, - { keys = [ \"alt+5\" ], command = \"tab_switch_index 5\" }, - - # arrow keys - { keys = [ \"arrow_up\" ], command = \"cursor_move_up\" }, - { keys = [ \"arrow_down\" ], command = \"cursor_move_down\" }, - { keys = [ \"arrow_left\" ], command = \"cd ..\" }, - { keys = [ \"arrow_right\" ], command = \"open\" }, - { keys = [ \"\n\" ], command = \"open\" }, - { keys = [ \"end\" ], command = \"cursor_move_end\" }, - { keys = [ \"home\" ], command = \"cursor_move_home\" }, - { keys = [ \"page_up\" ], command = \"cursor_move_page_up\" }, - { keys = [ \"page_down\" ], command = \"cursor_move_page_down\" }, - - # vim-like keybindings - { keys = [ \"j\" ], command = \"cursor_move_down\" }, - { keys = [ \"k\" ], command = \"cursor_move_up\" }, - { keys = [ \"h\" ], command = \"cd ..\" }, - { keys = [ \"l\" ], command = \"open\" }, - { keys = [ \"g\", \"g\" ], command = \"cursor_move_home\" }, - { keys = [ \"G\" ], command = \"cursor_move_end\" }, - { keys = [ \"r\" ], command = \"open_with\" }, - - { keys = [ \"[\" ], command = \"parent_cursor_move_up\" }, - { keys = [ \"]\" ], command = \"parent_cursor_move_down\" }, - - { keys = [ \"c\", \"d\" ], command = \":cd \" }, - { keys = [ \"d\", \"d\" ], command = \"cut_files\" }, - { keys = [ \"y\", \"y\" ], command = \"copy_files\" }, - { keys = [ \"p\", \"p\" ], command = \"paste_files\" }, - { keys = [ \"p\", \"o\" ], command = \"paste_files --overwrite=true\" }, - - { keys = [ \"y\", \"n\" ], command = \"copy_filename\" }, - { keys = [ \"y\", \".\" ], command = \"copy_filename_without_extension\" }, - { keys = [ \"y\", \"p\" ], command = \"copy_filepath\" }, - { keys = [ \"y\", \"d\" ], command = \"copy_dirpath\" }, - - { keys = [ \"delete\" ], command = \"delete_files\" }, - { keys = [ \"d\", \"D\" ], command = \"delete_files\" }, - - { keys = [ \"a\" ], command = \"rename_append\" }, - { keys = [ \"A\" ], command = \"rename_prepend\" }, - - { keys = [ \"f\", \"t\" ], command = \":touch \" }, - - { keys = [ \" \" ], command = \"select --toggle=true\" }, - { keys = [ \"t\" ], command = \"select --all=true --toggle=true\" }, - - { keys = [ \"w\" ], command = \"show_workers --exit-key=w\" }, - { keys = [ \"b\", \"b\" ], command = \"bulk_rename\" }, - { keys = [ \"=\" ], command = \"set_mode\" }, - - { keys = [ \":\" ], command = \":\" }, - { keys = [ \";\" ], command = \":\" }, - - { keys = [ \"'\" ], command = \":shell \" }, - { keys = [ \"m\", \"k\" ], command = \":mkdir \" }, - { keys = [ \"c\", \"w\" ], command = \":rename \" }, - - { keys = [ \"/\" ], command = \":search \" }, - { keys = [ \"\\\" ], command = \":search_glob \" }, - { keys = [ \"S\" ], command = \"search_fzf\" }, - - { keys = [ \"n\" ], command = \"search_next\" }, - { keys = [ \"N\" ], command = \"search_prev\" }, - - { keys = [ \"s\", \"r\" ], command = \"sort reverse\" }, - { keys = [ \"s\", \"l\" ], command = \"sort lexical\" }, - { keys = [ \"s\", \"m\" ], command = \"sort mtime\" }, - { keys = [ \"s\", \"n\" ], command = \"sort natural\" }, - { keys = [ \"s\", \"s\" ], command = \"sort size\" }, - { keys = [ \"s\", \"e\" ], command = \"sort ext\" }, - - { keys = [ \"g\", \"r\" ], command = \"cd /\" }, - { keys = [ \"g\", \"c\" ], command = \"cd ~/.config\" }, - { keys = [ \"g\", \"d\" ], command = \"cd ~/Downloads\" }, - { keys = [ \"g\", \"e\" ], command = \"cd /etc\" }, - { keys = [ \"g\", \"h\" ], command = \"cd ~/\" }, - { keys = [ \"?\" ], command = \"help\" } -]"; +#[cfg(target_os = "windows")] +pub const DEFAULT_KEYMAP: &str = include_str!("..\\..\\..\\config\\keymap.toml"); diff --git a/src/config/keymap/keymapping.rs b/src/config/keymap/keymapping.rs index 79fd684..23608f0 100644 --- a/src/config/keymap/keymapping.rs +++ b/src/config/keymap/keymapping.rs @@ -91,7 +91,10 @@ impl From<AppKeyMappingCrude> for AppKeyMapping { impl TomlConfigFile for AppKeyMapping { fn get_config(file_name: &str) -> Self { parse_to_config_file::<AppKeyMappingCrude, AppKeyMapping>(file_name) - .unwrap_or_else(Self::default) + .unwrap_or_else(|| { + eprintln!("Using default keymapping"); + Self::default() + }) } } diff --git a/src/ui/widgets/tui_file_preview.rs b/src/ui/widgets/tui_file_preview.rs index 75e378c..769b28f 100644 --- a/src/ui/widgets/tui_file_preview.rs +++ b/src/ui/widgets/tui_file_preview.rs @@ -1,6 +1,6 @@ use tui::buffer::Buffer; use tui::layout::Rect; -use tui::style::{Color, Modifier, Style}; +use tui::style::Style; use tui::widgets::Widget; use crate::fs::JoshutoDirEntry; |