Skip to content

Instantly share code, notes, and snippets.

@Raymo111
Created August 29, 2021 04:28
Show Gist options
  • Save Raymo111/298886228d8c6b5737ffc9053586f4ca to your computer and use it in GitHub Desktop.
Save Raymo111/298886228d8c6b5737ffc9053586f4ca to your computer and use it in GitHub Desktop.

Konsole delete word

By Raymond Li (Raymo111) 29 August 2021

To map shortcuts like Ctrl+Bksp/Del to delete words backwards and forwards in Konsole:

  1. Go to Settings > Edit Current Profile... > Keyboard > Edit...`
  2. Edit (or add) the following key combos if they don't already exist:
Key Combination Output (Explanation)
Backspace-Ctrl \x7f Backspace without Ctrl should just delete the character before the cursor
Backspace+Ctrl \E\b Backspace with Ctrl should delete the word before the cursor. ^H should be encoded as \x08 (ascii control character code in hex) but Konsole converts that to \b, it's code for backspace.
Del \E[3~ Self-explanatory
Del+AnyModifier \E[3;*~ Came with Konsole, we don't touch it
Del+Ctrl \Ed Escape is \E in console, and Escape+D in bash deletes the word after the cursor

Save and exit. 🎉 now your delete word keyboard shortcuts work.

@spaceCabbage
Copy link

omg thank youuuuu, ive been trying to get this working for months and this is the only solution that actually works

@Raymo111
Copy link
Author

Thanks for sharing! For those who are looking to move the cursor forward and backward by a word, you can use the below.

Key Combination Output (Explanation)
Left+Ctrl \Eb Move cursor backward one word
Right+Ctrl \Ef Move cursor forward one word

Very nice, thank you!

omg thank youuuuu, ive been trying to get this working for months and this is the only solution that actually works

Happy to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment