emulate textmate behavior