Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to indent repetitive lines of code so they are easy to look at and see small differences. As an example, this is hard to read:

address = "1800 Washington St."
name = "George McGoo"
user_type = "admin"

but this is easy to read:

address   = "1800 Washington St."  
name      = "George McGoo"  
user_type = "admin"

Is there a way to do this in Textmate without wearing out my space bar?

share|improve this question

I don't know anything about textmate, but you can solve the issue at hand with the command-line:

$ cat addresslist 
address = "1800 Washington St."
name = "George McGoo"
user_type = "admin"

address = "1800 Washington St."
name = "George McGoo"
user_type = "admin"

$ awk -F'=' '{a[NR]=$0;l=length($1);if(l>max){max=l};last=NR}END{for(i=1;i<=last;i++){if(a[i]~/=/){c=a[i];gsub(/^[^=]+*=/,"",c);b=a[i];gsub(/=.*$/,"",b);printf "%-*s = %s\n",max,b,c}else{print a[i]}}}' addresslist
address    =  "1800 Washington St."
name       =  "George McGoo"
user_type  =  "admin"

address    =  "1800 Washington St."
name       =  "George McGoo"
user_type  =  "admin"
share|improve this answer

You must log in to answer this question.

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