2

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.]
4

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'.

2
  • What about the Cocoa Text System, couldn't that be used to provide a custom shortcut for an indent command? – Daniel Beck Aug 1 '14 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 '14 at 13:32

You must log in to answer this question.

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