Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

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.