Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Are there shortcut keys or another quick way to indent a text block at once in a normal text area on OS X?

So that I can easily turn:

[I want this to indent.
For formatting.
It's several lines.]

Into:

    [I want this to indent.
    For formatting.
    It's several lines.]
share|improve this question

1 Answer 1

up vote 3 down vote accepted

You want to edit text, and for that you need a text editor. There is (easy) native way in OS X to do these kind of text manipulations.

I personally use BBEdit/TextWrangler for these kind of codings. command]

You can also use Automator to create a Service and use sed/regex to do the 'hard' lifting: (and bind a keystroke to this Service)

automator

sed 's/\(^.*\)/\ \ \ \ \1/g':

sed can be used to edit lines of text. In this line sed globally substitutes a match of 'the beginning of a line and everything that comes after it' with '4 spaces and that match'.

share|improve this answer
    
What about the Cocoa Text System, couldn't that be used to provide a custom shortcut for an indent command? –  Daniel Beck Aug 1 at 13:25
    
Nice thought, it might be possible to do that, though I have no clue how ;) It is a clean way to do it though. –  CousinCocaine Aug 1 at 13:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.