11
10
Let's say I wrote a long command in the Mac OSX terminal, i.e
say "Hello, how are you? I am good thank you. How is it going with you? Fine, thanks"
and now I want to change the word Hello
to Hi
.
To do that, right now I have to keep pressing (or hold down) the left keyboard key until the "cursor" gets to the end of the word Hello
, and then delete it. The usual 'holding down option' technique doesn't work as it does in most other OS X applications.
Is there a way to skip a word at a time instead (or any other shorter way of getting the cursor there)?
Ok, this doesn't really pertain to the question, but how do you put the words that look like keyboard keys in there? – Wuffers – 2010-04-17T22:46:55.083
1
@Mr. Man: Use
– Chris Johnsen – 2010-04-18T04:42:09.003<kbd>
elements. A subset of HTML is allowed in the markup here. The appearance is due to site-local styling of the tag (background, border-color, border-style, border-width, etc.). You can review the source markup of my post (“view source” on this page). See http://meta.stackexchange.com/questions/5527 even though the fancy style is disabled on MSO: http://meta.stackexchange.com/questions/1939/#235711
You can also use vi bindings by adding
– Will Munn – 2017-05-10T19:55:32.093set -o vi
in your .bashrc! https://www.gnu.org/software/bash/manual/html_node/Command-Line-Editing.htmlIs there a way to change the environment or shell so that I can do ctrl or fn + arrow keys to match my IDE? – codecowboy – 2011-05-06T12:44:26.790
@codecowboy: It is technically possible (depending on which exact behavior you want), but it would not be trivial. You can configure Terminal to send additional codes for Control-modified keys (but not fn; it usually just replaces one key with another instead of adding a modifier “bit”). Then you would have to extend a terminfo entry and set the TERM environment variable to the new entry to let programs (e.g. your shell) know about the extra codes. Finally, you might need to redefine the bindings in individual programs (e.g. your shell) to trigger some behavior based on your new keys. – Chris Johnsen – 2011-05-06T17:29:33.277
I'm not sure if this is obvious or not, it took me a minute to figure it out, but I'm on a MBP without a meta key and I'm using a default Terminal configuration. To move forward and backward on words I can press Esc and then F, or Esc and then B. Just wanted to mention that because the way it was explained above was making me try and press Esc + x and then f or b... – cwd – 2011-01-23T22:06:26.653
@cwd That's why the x is in italics, to indicate it's a placeholder for any key. Thats explained in the following sentence: C-
x
meansControl
+x
, so C-a isControl
+a
. It goes on to explain that you can getC
-*x*
by pressing "ESCx
(i.e.Escape
thenx
)." – Daniel Beck – 2011-06-12T09:37:29.260