tabs

TextMate - converting tabs to spaces (or not)

I finally dug into a problem with TextMate that has been driving me crazy. I always have the TextMate "soft tabs" feature enabled, and want two spaces wherever there was a tab. However, it turns out TextMate doesn't really do what I expect here. Instead of automatically converting tabs to spaces, you have to take an extra step to make this work.

Assume you've just opened an existing document. To convert the tabs in the document to spaces (soft tabs):

How to convert vi/vim tabs to spaces

vim tabs/spaces FAQ: How do I convert vi/vim tabs to spaces?

You can convert tabs to spaces in vim using the usual vim search and replace command. Specifically, this vim "tabs to spaces" command is all you need:

:1,$s/\t/  /g

In short, this command can be read like this:

vi/vim search and replace: how to replace all tabs with spaces

vi/vim question: How do I convert all occurrences of ABC to XYZ in a file using the vi/vim editor?

Answer: This is actually easy to do with the vi or vim editor. Just go into "last line mode" by typing the ":" character, then enter a command like this to replace all occurrences of the string ABC with the string XYZ:

AppleScript Safari URL tip: How to open multiple URLs in Safari tabs

Well, I set out to write a simple tip on how to activate a Mac application using AppleScript, and I ended up writing a program to open a list of URLs in separate tabs in Safari using AppleScript. (Yeesh, I really took a detour. Oh, well.)

Without any further ado, here's the source code for this AppleScript program: