19

How can I let TextMate show line numbers when I'm coding C++?

Daniel Beck
  • 109,300
  • 14
  • 287
  • 334
Don Lun
  • 293
  • 1
  • 2
  • 5

3 Answers3

29

Press Cmd-Opt-L or select View » Gutter » Line Numbers.

I don't think it's possible to automatically enable display of line numbers dependent on your current language. But with the default keyboard shortcut this command is easy enough to reach.

Daniel Beck
  • 109,300
  • 14
  • 287
  • 334
  • 4
    While I certainly appreciate all the up votes for this answer, I'd like to use the popularity of this question to demonstrate [how convenient it is to find menu items and commands in pretty much any OS X application](http://i.stack.imgur.com/cQjeL.png). – Daniel Beck Sep 07 '12 at 20:01
3

View->Gutter->Line Numbers

Enjoy! Its a fun editor.

TestinginProd
  • 912
  • 5
  • 15
  • 25
0

For users stumbling on this question who want to actually insert numbers in front of each line, the following will help:

  1. Bundles > Text > Add Line Numbers to Selection
    • Applies "cat -n|expand -8" to selection/entire document
  2. Text -> Filter through command... allows more flexibility. e.g.:
    • perl -pe 's/^/sprintf("%2d ",$.)/e'

Thanks to @Hans and @Paul on the TM list

tim
  • 409
  • 3
  • 6