2

I've read fn + option + delete will delete the word in front of cursor. This works for me in any of the editors i use, or any other text fields (chrome, textedit etc). However in terminal, the key combination just outputs a single (. I have no problem deleting a word behind the cursor with Option + delete.

I have seen I can map a key combination to an action in terminal preferences, but I haven't been able to find much documentation on the these actions.

The desired effect can be achieved by pressing alt + d, but i would like to use the fn + option + delete key combination. A possible sub-question would be how do I map fn + option + delete to alt + d in the terminal preferences?

4
  • 2
    It depends on the shell you use. In bash and other readline-aware programs for example you can use Alt-d. Commented Aug 8, 2019 at 11:57
  • i realised after writing the question that this is an option. I have edited the question to reflect this
    – outlau
    Commented Aug 8, 2019 at 12:03
  • @ArkadiuszDrabczyk It's also the VISUAL setting (emacs mode vs. vi mode)
    – Philippos
    Commented Aug 8, 2019 at 12:21
  • You can map option-forward delete to \033d which should simulate alt+d. Have to copy paste it in.
    – 1110101001
    Commented May 21, 2023 at 3:00

1 Answer 1

0

This might not be what you're looking for as it will affect the whole line, but these are pretty handy.

To delete everything on a line before or after your cursor:

ctrl + w delete everything before the cursor
ctrl + k delete everything after the cursor

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .