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

make Control-w and alt-backspace behave more like bash #632

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion src/edit_mode/emacs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ pub fn default_emacs_keybindings() -> Keybindings {
KC::Char('y'),
edit_bind(EC::PasteCutBufferBefore),
);
kb.add_binding(KM::CONTROL, KC::Char('w'), edit_bind(EC::CutWordLeft));
kb.add_binding(KM::CONTROL, KC::Char('w'), edit_bind(EC::CutBigWordLeft));
kb.add_binding(
KM::CONTROL | KM::ALT,
KC::Char('h'),
edit_bind(EC::CutWordLeft),
);
kb.add_binding(KM::CONTROL, KC::Char('k'), edit_bind(EC::CutToEnd));
kb.add_binding(KM::CONTROL, KC::Char('u'), edit_bind(EC::CutFromStart));
// Edits
Expand Down
1 change: 0 additions & 1 deletion src/edit_mode/keybindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,4 @@ pub fn add_common_edit_bindings(kb: &mut Keybindings) {
kb.add_binding(KM::CONTROL, KC::Delete, edit_bind(EC::DeleteWord));
// Base commands should not affect cut buffer
kb.add_binding(KM::CONTROL, KC::Char('h'), edit_bind(EC::Backspace));
kb.add_binding(KM::CONTROL, KC::Char('w'), edit_bind(EC::BackspaceWord));
}
5 changes: 5 additions & 0 deletions src/edit_mode/vi/vi_keybindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ pub fn default_vi_normal_keybindings() -> Keybindings {
/// Default Vi insert keybindings
pub fn default_vi_insert_keybindings() -> Keybindings {
let mut kb = Keybindings::new();
use EditCommand as EC;
use KeyCode as KC;
use KeyModifiers as KM;

add_common_control_bindings(&mut kb);
add_common_navigation_bindings(&mut kb);
add_common_edit_bindings(&mut kb);

kb.add_binding(KM::CONTROL, KC::Char('w'), edit_bind(EC::BackspaceWord));

kb
}