Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a word in iTerm in mac os

Tags:

shell

macos

iterm

I am using iTerm as a terminal in my mac. I am not able to delete a word in command line for ex in command cd /path/to/dir, i want to delete just path word , then how can i do that in iTerm.

basically what is the shortcut to delete a word in iTerm.

I looked at https://apple.stackexchange.com/questions/154292/iterm-going-one-word-backwards-and-forwards and fn+option+delete is just deleting a single character, not the whole word.

like image 937
Rohit Avatar asked Mar 11 '17 13:03

Rohit


People also ask

How do I delete a word in Mac terminal?

Control + W Using this keyboard combination will delete the word immediately before, or to the left of, the cursor.

How do you select text in iTerm?

To select text without using the mouse, press cmd-f to open the find field. Enter the beginning of the text you wish to copy and the find feature will select it in your window. Then press tab and the end of the selection will advance by a word. To move the beginning of the selection to the left, press shift-tab.

How do I edit iTerm2?

Customize with iTerm2Go to iTerm2 preferences with ⌘ + , then go into profiles > Text. Then, if you don't like the default color, and prefer something similar to the above, you can update the color scheme. There's the Solarized Dark theme which is popular, but I went Tango Dark.


3 Answers

Go to your iTerm preferences select "profiles" then "key" and change your presets in "Natural Text Editing"

iTerm Preferences

It should work immediately after.

It works with iTerm version 3.3.12

Edit:

In version 3.4, there's a slight UI change. So you need to go specifically to your iTerm preferences select Profiles > Keys > Key Mappings > Presets > Nature Text Editing

enter image description here

like image 97
KillianGDK Avatar answered Oct 28 '22 07:10

KillianGDK


This helped me.

Delete a word - Send Hex Codes - 0x1b 0x08 or 0x17

Delete a line - Send Hex Codes - 0x15

iTerm2 delete a word shortcut

like image 49
Vignesh Raja Avatar answered Oct 28 '22 09:10

Vignesh Raja


ctrl + w in iTerm,

BTW, in text editors
alt + delete to delete whole previous word
fn + delete to delete next word

like image 22
Kiryl Plyashkevich Avatar answered Oct 28 '22 09:10

Kiryl Plyashkevich