Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Modify cursor movement keys in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Modify cursor movement keys in Terminal
Authored by: nedaf7 on Aug 24, '06 10:28:30AM

Anybody know of a way to delete an entire word in terminal, so we can map option-backspace to it? That would be incredibly useful, especially when you are working with directories. Imagine you typed in "cd /Library/WebServer/Documents/", but then realized you want to go to "/Library/WebServer/". Now you have to delete "Documents/" letter by letter, but if we bind option-backspace to delete words, it would only take one keystroke.



[ Reply to This | # ]
Modify cursor movement keys in Terminal
Authored by: ctierney on Aug 24, '06 11:20:36AM

Control-W should delete the word to the left of the cursor.



[ Reply to This | # ]
Modify cursor movement keys in Terminal
Authored by: bomolub on Aug 24, '06 11:43:54AM

In my Terminal Inspector, I checked "Use option key as meta key". Then I edited the key mapping for the del key to \004 (type control-d). I added a new key mapping for del using a key modifier of option and set this to \033d (type escape d).

Now the del key deletes forward by character, option-del deletes forward by word. Also backspace (or delete key) deletes backward by character and option-backspace deletes backward by word.



[ Reply to This | # ]
Modify cursor movement keys in Terminal
Authored by: davconvent on Sep 29, '06 02:14:22AM

Can you tell me how you modified the option-backspace mapping? backspace doesn't show up in the list of modifiable keys in the small window for adding/editing a key mapping (OS X 10.4.7).



[ Reply to This | # ]
Modify cursor movement keys in Terminal
Authored by: i5ao on Aug 24, '06 02:50:18PM

ctrl-w deletes one word to the right of the cursor (forward delete word)
esc-del deletes one word to the left of the cursor (backward delete word)

OMM anyway. I use tcsh with the following bindings in my ~/.tcshrc file (from a previous hint on this site, a long time ago IIRC). see also ''man tsch''

# keys
bindkey "^I" complete-word-fwd
bindkey -k down history-search-forward
bindkey -k up history-search-backward
bindkey ^w delete-word
bindkey "^[[3~" delete-char # fix fwd delete



[ Reply to This | # ]
Modify cursor movement keys in Terminal
Authored by: sjk on Aug 24, '06 05:02:43PM
[this is followup to iSao's comment, if you're seeing it non-threaded]

Setting the wordchars variable influences word-oriented tcsh editor commands. I use:

set wordchars = '*?[]~='

And magic-space can be a handy function, meant to be bound to the space character:

bindkey ' ' magic-space


[ Reply to This | # ]