What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

TextMate Blog

TextMate and OS X


Working With History in BashJune 28

Yesterday we talked about favorite bash features (on the ##textmate IRC channel). I figured it was worth posting mine to this blog, they mostly revolve around history, hence the title.

Setup

My shell history collects a lot of complex command invocations which take time to figure out. To ensure that I have access to them at a later time, I have the following 3 lines in my bash init:

export HISTCONTROL=erasedups export HISTSIZE=10000 shopt -s histappend

The first one will remove duplicates from the history (when a new item is added). For example if you switch between running make and ./a.out in a shell, you may later find that the last 100 or so history items is a mix of these two commands. Not very useful.

The second one increase the history size. With duplicates erased, the history already holds a lot more actual information, but I still like to increase the default size of only 1,000 items.

The third line ensures that when you exit a shell, the history from that session is appended to ~/.bash_history. Without this, you might very well lose the history of entire sessions (rather weird that this is not enabled by default).

History Searching

Now that I have my history preserved nicely in ~/.bash_history there are a few ways to search it.

Using Grep

The most crude is grep. You can do:

history|grep iptables

For me (on this particular Linux server) I get:

4599 i
TextMate (Ruby) TricksApril 28

John Muchow of Mac Developer Tips recently posted a screencast showing a neat way to debug your Ruby code.

Speaking of the Ruby bundle, Ciarán Walsh has a post about the design philosophy behind the mnemonics of the Ruby bundle and a few highlights.

And while there seems to be a preference for writing TextMate commands in Ruby, anything that you can run from a terminal (shell) can be used. A step-by-step tutorial about how to write TextMate commands in PHP is available at Ciarán’s blog. I pushed him to write this one, as I believe there are a lot of people who work with PHP in TextMate that never got around to writing custom commands in the false belief that they would have to learn elisp or some similarly obscure language :)

ExpanDrive — Seamless sftp mountsMarch 4

Not so long ago Jonathan Ragan-Kelley mentioned ExpanDrive on the mailing list and I assume it is the same Jonathan R. quoted on their page as saying:

I’ve never seen TextMate work well on a network drive. With ExpanDrive, it’s a dream. And the drives stay mounted perfectly when I move my laptop between home and work.

John Gruber just posted a review about ExpanDrive in which he writes:

My first impression after reading ExpanDrive’s promotional description last week was that it sounded too good to be true. One week later, I’m pretty sure it actually is that good.

If it wasn’t clear from the above, ExpanDrive lets you mount remote sftp drives and it actually works! I.e. no long delays or dropped connection in the middle of a save. Their introductory price is $29.

Changes — FileMerge ReplacementFebruary 29

Changes Application Icon

Ian Baird recently released Changes which is an application to show differences between two folders and merge these intelligently.

I know this is not an uncommon task among many TextMate users, as I have received quite a lot of requests for building such functionality — Changes of course has TextMate integration, so this application will hopefully satisfy a lot of you.

Version 1.0 of Changes is available for $39.95 (free trial) but if you use TEXTMATE0308 as coupon code you can get it for $29.95 (offer lasts throughout March 2008).

Git BundleFebruary 20

You may have read that a lot of prominent people have recently moved to Git and are loving it. I too am one of those who fancy this new kid on the block but never got very far with the bundle I started for it.

Fortunately Tim Harper recently picked up on my initial efforts and has done a great job at not only making this bundle functional but also downright impressive :)

The much improved Git bundle can be found at Gitorious and discussion about it can be directed to its Google Group.

For those too lazy to click the link above, here are the short install instructions:

mkdir -p /Library/Application\ Support/TextMate/Bundles cd !$ git clone git://gitorious.org/git-tmbundle/mainline.git Git.tmbundle osascript -e 'tell app "TextMate" to reload bundles'

After having installed it you can press ⌃⌘T in TextMate and enter git to find the “Administration → Update Git Bundle” action. Use this to update the bundle (it will automatically reload after having performed the update).