4 ms·
I too use tabstop=2 But `cat` uglifies it, so I added this to ~/.bashrc: alias tab='sed "s/\t/ /g" ' You needn't say "cat myfile | tab"; you can just us
by 10ren 17y ago
I too use tabstop=2
But `cat` uglifies it, so I added this to ~/.bashrc:
alias tab='sed "s/\t/ /g" '
You needn't say "cat myfile | tab"; you can just use it exactly like cat: "tab myfile" (I'm not saying that you'd not instantly realize that - but that I didn't).
- xiaomai 17y agounless you prefer tabs, you can add: set expandtab to your .vimrc and then vim will magically insert spaces (according to your tabstop/shiftwidth) instead of real tabs. :retab will turn all tabs into spaces for a file that already has tabs in it.
- 10ren 17y agothanks! "Vim contains every features you could possibly imagine, and then some. Even when taking this law into account" - 10ren's Law
- barrkel 17y agoI generally use something like: expand -t "$tabWidth" "${files[@]}" | nl -b a | fold -s -w 108 | $PAGER when I want to view files that use tabs; this is the final one-liner in a script I call 'view'. It gives me tabs expanded to width I specify (defaults 4), numbered lines, and long lines wrapped at word breaks but such that they don't break line numbering.
- blasdel 17y agoYou needn't ever say "cat myfile | ..." period! The shell has stdin redirection built in via '<'
- TomasSedovic 17y agoWhat happened to TIMTOWTDI? :-)
- lallysingh 17y agoWhat's TIMTOW? And why would you want a turbo diesel, fuel injected version of it?
- steveklabnik 17y ago"There's More Than One Way To Do It" is a Perl philosophy.
- jrockway 17y agoUnless you want to read your pipeline from left to right, like everything else you read.
- blasdel 17y agoWhat if you want the subject on the right, like all non-pipeline commands you read? foo myfile bar < myfile (bar | baz) < myfile
- throw_away 17y agoyou can also say $ < file executable