From ef0e4c0863b2edc738f84970cb5293d679a32648 Mon Sep 17 00:00:00 2001 From: Pol Rivero <65060696+pol-rivero@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:23:28 +0100 Subject: [PATCH] Add Ctrl+Backspace keybind to delete word --- doc/terminator_config.5 | 9 ++++++++- doc/terminator_config.adoc | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/prefseditor.py | 1 + terminatorlib/terminal.py | 3 +++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 4af2ca9b..df3dfeaf 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -766,6 +766,13 @@ Reset the terminal state and clear the terminal window. Default value: \fBG\fP .RE .sp +\fBdelete_word\fP +.RS 4 +Delete the word before the cursor. +.br +Default value: \fBBackSpace\fP +.RE +.sp \fBzoom_in\fP .RS 4 Increase the font size by one unit. @@ -1356,4 +1363,4 @@ individual plugins for more information. .SH "SEE ALSO" .sp \fBterminator\fP(1), \c -.URL "https://configobj.readthedocs.io/" "" "" \ No newline at end of file +.URL "https://configobj.readthedocs.io/" "" "" diff --git a/doc/terminator_config.adoc b/doc/terminator_config.adoc index d0b89fe8..6ce84023 100644 --- a/doc/terminator_config.adoc +++ b/doc/terminator_config.adoc @@ -513,6 +513,10 @@ Default value: *R* Reset the terminal state and clear the terminal window. + Default value: *G* +*delete_word*:: +Delete the word before the cursor. + +Default value: *BackSpace* + *zoom_in*:: Increase the font size by one unit. + Default value: *plus* diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 008d1cfa..bea9c33f 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -179,6 +179,7 @@ 'full_screen' : 'F11', 'reset' : 'r', 'reset_clear' : 'g', + 'delete_word' : 'BackSpace', 'hide_window' : 'a', 'create_group' : '', 'group_all' : 'g', diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index db22f6a0..2d7e0e37 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -159,6 +159,7 @@ class PrefsEditor: 'full_screen' : _('Toggle fullscreen'), 'reset' : _('Reset the terminal'), 'reset_clear' : _('Reset and clear the terminal'), + 'delete_word' : _('Delete the word before the cursor'), 'hide_window' : _('Toggle window visibility'), 'create_group' : _('Create new group'), 'group_all' : _('Group all terminals'), diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 2aaf58d7..7f708227 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -2031,6 +2031,9 @@ def key_reset(self): def key_reset_clear(self): self.vte.reset (True, True) + def key_delete_word(self): + self.feed([27, 127]) + def key_create_group(self): self.titlebar.create_group()