1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Add default shortcuts: Shift+BackSpace to delete previous char, Ctrl+Left/Right for word movements (#790)

* Support Shift+BackSpace by default to delete previous char

* Support Ctrl+Arrow for word movements
This commit is contained in:
Maxim Baz 2018-06-13 14:15:31 +02:00 committed by Dave Davenport
parent bdb6abef4a
commit ff9b0f5ccd
6 changed files with 50 additions and 50 deletions

View file

@ -160,41 +160,41 @@ Type `Shift-/Left/Right` to switch between active modi.
## Key bindings ## Key bindings
| Key | Action | | Key | Action |
|:----------------------------|:-------------------------------------------------------------------| |:-------------------------------------|:-------------------------------------------------------------------|
|`Ctrl-v, Insert` | Paste from clipboard | |`Ctrl-v, Insert` | Paste from clipboard |
|`Ctrl-Shift-v, Shift-Insert` | Paste primary selection | |`Ctrl-Shift-v, Shift-Insert` | Paste primary selection |
|`Ctrl-w` | Clear the line | |`Ctrl-w` | Clear the line |
|`Ctrl-u` | Delete till the start of line | |`Ctrl-u` | Delete till the start of line |
|`Ctrl-a` | Move to beginning of line | |`Ctrl-a` | Move to beginning of line |
|`Ctrl-e` | Move to end of line | |`Ctrl-e` | Move to end of line |
|`Ctrl-f, Right` | Move forward one character | |`Ctrl-f, Right` | Move forward one character |
|`Alt-f` | Move forward one word | |`Alt-f, Ctrl-Right` | Move forward one word |
|`Ctrl-b, Left` | Move back one character | |`Ctrl-b, Left` | Move back one character |
|`Alt-b` | Move back one word | |`Alt-b, Ctrl-Left` | Move back one word |
|`Ctrl-d, Delete` | Delete character | |`Ctrl-d, Delete` | Delete character |
|`Ctrl-Alt-d` | Delete word | |`Ctrl-Alt-d` | Delete word |
|`Ctrl-h, Backspace` | Backspace (delete previous character) | |`Ctrl-h, Backspace, Shift-Backspace` | Backspace (delete previous character) |
|`Ctrl-Alt-h` | Delete previous word | |`Ctrl-Alt-h` | Delete previous word |
|`Ctrl-j,Ctrl-m,Enter` | Accept entry | |`Ctrl-j,Ctrl-m,Enter` | Accept entry |
|`Ctrl-n,Down` | Select next entry | |`Ctrl-n,Down` | Select next entry |
|`Ctrl-p,Up` | Select previous entry | |`Ctrl-p,Up` | Select previous entry |
|`Page Up` | Go to the previous page | |`Page Up` | Go to the previous page |
|`Page Down` | Go to the next page | |`Page Down` | Go to the next page |
|`Ctrl-Page Up` | Go to the previous column | |`Ctrl-Page Up` | Go to the previous column |
|`Ctrl-Page Down` | Go to the next column | |`Ctrl-Page Down` | Go to the next column |
|`Ctrl-Enter` | Use entered text as a command (in `ssh/run modi`) | |`Ctrl-Enter` | Use entered text as a command (in `ssh/run modi`) |
|`Shift-Enter` | Launch the application in a terminal (in run mode) | |`Shift-Enter` | Launch the application in a terminal (in run mode) |
|`Shift-Enter` | Return the selected entry and move to the next item while keeping Rofi open. (in dmenu) | |`Shift-Enter` | Return the selected entry and move to the next item while keeping Rofi open. (in dmenu) |
|`Shift-Right` | Switch to the next modi. The list can be customized with the -modi option. | |`Shift-Right` | Switch to the next modi. The list can be customized with the -modi option. |
|`Shift-Left` | Switch to the previous modi. The list can be customized with the -modi option. | |`Shift-Left` | Switch to the previous modi. The list can be customized with the -modi option. |
|`Ctrl-Tab` | Switch to the next modi. The list can be customized with the -modi option. | |`Ctrl-Tab` | Switch to the next modi. The list can be customized with the -modi option. |
|`Ctrl-Shift-Tab` | Switch to the previous modi. The list can be customized with the -modi option. | |`Ctrl-Shift-Tab` | Switch to the previous modi. The list can be customized with the -modi option. |
|`Ctrl-space` | Set selected item as input text. | |`Ctrl-space` | Set selected item as input text. |
|`Shift-Del` | Delete entry from history. | |`Shift-Del` | Delete entry from history. |
|`grave` | Toggle case sensitivity. | |`grave` | Toggle case sensitivity. |
|`Alt-grave` | Toggle levenshtein sort. | |`Alt-grave` | Toggle levenshtein sort. |
|`Alt-Shift-S` | Take a screenshot and store it in the Pictures directory. | |`Alt-Shift-S` | Take a screenshot and store it in the Pictures directory. |
For the full list of key bindings, see: `rofi -show keys` or `rofi -help`. For the full list of key bindings, see: `rofi -show keys` or `rofi -help`.

View file

@ -1278,13 +1278,13 @@ Transparency can be used within \fBrofi\fR, for example if the selected backgrou
\fBCtrl\-f, Right\fR: Forward one character \fBCtrl\-f, Right\fR: Forward one character
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBAlt\-f\fR: Forward one word \fBAlt\-f, Ctrl\-Right\fR: Forward one word
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBCtrl\-b, Left\fR: Back one character \fBCtrl\-b, Left\fR: Back one character
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBAlt\-b\fR: Back one word \fBAlt\-b, Ctrl\-Left\fR: Back one word
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBCtrl\-d, Delete\fR: Delete character \fBCtrl\-d, Delete\fR: Delete character
@ -1293,7 +1293,7 @@ Transparency can be used within \fBrofi\fR, for example if the selected backgrou
\fBCtrl\-Alt\-d\fR: Delete word \fBCtrl\-Alt\-d\fR: Delete word
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBCtrl\-h, Backspace\fR: Backspace (delete previous character) \fBCtrl\-h, Backspace, Shift\-Backspace\fR: Backspace (delete previous character)
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBCtrl\-Alt\-h\fR: Delete previous word \fBCtrl\-Alt\-h\fR: Delete previous word

View file

@ -766,12 +766,12 @@ of the window will be visible through it.
* `Ctrl-a`: Beginning of line * `Ctrl-a`: Beginning of line
* `Ctrl-e`: End of line * `Ctrl-e`: End of line
* `Ctrl-f, Right`: Forward one character * `Ctrl-f, Right`: Forward one character
* `Alt-f`: Forward one word * `Alt-f, Ctrl-Right`: Forward one word
* `Ctrl-b, Left`: Back one character * `Ctrl-b, Left`: Back one character
* `Alt-b`: Back one word * `Alt-b, Ctrl-Left`: Back one word
* `Ctrl-d, Delete`: Delete character * `Ctrl-d, Delete`: Delete character
* `Ctrl-Alt-d`: Delete word * `Ctrl-Alt-d`: Delete word
* `Ctrl-h, Backspace`: Backspace (delete previous character) * `Ctrl-h, Backspace, Shift-Backspace`: Backspace (delete previous character)
* `Ctrl-Alt-h`: Delete previous word * `Ctrl-Alt-h`: Delete previous word
* `Ctrl-j,Ctrl-m,Enter`: Accept entry * `Ctrl-j,Ctrl-m,Enter`: Accept entry
* `Ctrl-n,Down`: Select next entry * `Ctrl-n,Down`: Select next entry

View file

@ -127,9 +127,9 @@ rofi.kb-move-front: Control+a
! "End of line" Set from: File ! "End of line" Set from: File
rofi.kb-move-end: Control+e rofi.kb-move-end: Control+e
! "Move back one word" Set from: File ! "Move back one word" Set from: File
rofi.kb-move-word-back: Alt+b rofi.kb-move-word-back: Alt+b,Ctrl+Left
! "Move forward one word" Set from: File ! "Move forward one word" Set from: File
rofi.kb-move-word-forward: Alt+f rofi.kb-move-word-forward: Alt+f,Ctrl+Right
! "Move back one char" Set from: File ! "Move back one char" Set from: File
rofi.kb-move-char-back: Left,Control+b rofi.kb-move-char-back: Left,Control+b
! "Move forward one char" Set from: File ! "Move forward one char" Set from: File
@ -141,7 +141,7 @@ rofi.kb-remove-word-forward: Control+Alt+d
! "Delete next char" Set from: File ! "Delete next char" Set from: File
rofi.kb-remove-char-forward: Delete,Control+d rofi.kb-remove-char-forward: Delete,Control+d
! "Delete previous char" Set from: File ! "Delete previous char" Set from: File
rofi.kb-remove-char-back: BackSpace,Control+h rofi.kb-remove-char-back: BackSpace,Shift+BackSpace,Control+h
! "Delete till the end of line" Set from: File ! "Delete till the end of line" Set from: File
rofi.kb-remove-to-eol: Control+k rofi.kb-remove-to-eol: Control+k
! "Delete till the start of line" Set from: File ! "Delete till the start of line" Set from: File

View file

@ -50,14 +50,14 @@ ActionBindingEntry rofi_bindings[] =
{ .id = CLEAR_LINE, .name = "kb-clear-line", .binding = "Control+w", .comment = "Clear input line" }, { .id = CLEAR_LINE, .name = "kb-clear-line", .binding = "Control+w", .comment = "Clear input line" },
{ .id = MOVE_FRONT, .name = "kb-move-front", .binding = "Control+a", .comment = "Beginning of line" }, { .id = MOVE_FRONT, .name = "kb-move-front", .binding = "Control+a", .comment = "Beginning of line" },
{ .id = MOVE_END, .name = "kb-move-end", .binding = "Control+e", .comment = "End of line" }, { .id = MOVE_END, .name = "kb-move-end", .binding = "Control+e", .comment = "End of line" },
{ .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .binding = "Alt+b", .comment = "Move back one word" }, { .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .binding = "Alt+b,Control+Left", .comment = "Move back one word" },
{ .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .binding = "Alt+f", .comment = "Move forward one word" }, { .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .binding = "Alt+f,Control+Right", .comment = "Move forward one word" },
{ .id = MOVE_CHAR_BACK, .name = "kb-move-char-back", .binding = "Left,Control+b", .comment = "Move back one char" }, { .id = MOVE_CHAR_BACK, .name = "kb-move-char-back", .binding = "Left,Control+b", .comment = "Move back one char" },
{ .id = MOVE_CHAR_FORWARD, .name = "kb-move-char-forward", .binding = "Right,Control+f", .comment = "Move forward one char" }, { .id = MOVE_CHAR_FORWARD, .name = "kb-move-char-forward", .binding = "Right,Control+f", .comment = "Move forward one char" },
{ .id = REMOVE_WORD_BACK, .name = "kb-remove-word-back", .binding = "Control+Alt+h,Control+BackSpace", .comment = "Delete previous word" }, { .id = REMOVE_WORD_BACK, .name = "kb-remove-word-back", .binding = "Control+Alt+h,Control+BackSpace", .comment = "Delete previous word" },
{ .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .binding = "Control+Alt+d", .comment = "Delete next word" }, { .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .binding = "Control+Alt+d", .comment = "Delete next word" },
{ .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .binding = "Delete,Control+d", .comment = "Delete next char" }, { .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .binding = "Delete,Control+d", .comment = "Delete next char" },
{ .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .binding = "BackSpace,Control+h", .comment = "Delete previous char" }, { .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .binding = "BackSpace,Shift+BackSpace,Control+h", .comment = "Delete previous char" },
{ .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .binding = "Control+k", .comment = "Delete till the end of line" }, { .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .binding = "Control+k", .comment = "Delete till the end of line" },
{ .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .binding = "Control+u", .comment = "Delete till the start of line" }, { .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .binding = "Control+u", .comment = "Delete till the start of line" },
{ .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .binding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" }, { .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .binding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" },

View file

@ -778,15 +778,15 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action )
case REMOVE_CHAR_FORWARD: case REMOVE_CHAR_FORWARD:
textbox_cursor_del ( tb ); textbox_cursor_del ( tb );
return 1; return 1;
// Alt-B // Alt-B, Ctrl-Left
case MOVE_WORD_BACK: case MOVE_WORD_BACK:
textbox_cursor_dec_word ( tb ); textbox_cursor_dec_word ( tb );
return 2; return 2;
// Alt-F // Alt-F, Ctrl-Right
case MOVE_WORD_FORWARD: case MOVE_WORD_FORWARD:
textbox_cursor_inc_word ( tb ); textbox_cursor_inc_word ( tb );
return 2; return 2;
// BackSpace, Ctrl-h // BackSpace, Shift-BackSpace, Ctrl-h
case REMOVE_CHAR_BACK: case REMOVE_CHAR_BACK:
textbox_cursor_bkspc ( tb ); textbox_cursor_bkspc ( tb );
return 1; return 1;