tags:

views:

23

answers:

1

Can TextMate be changed to "shift text to right" by highlighting text and pressing Tab?

Right now it actually replace the whole selected text with a tab character but I almost never want to do something like that. I think some other editors like Notepad++ will indent to the next level.

+1  A: 

Cmd + ] will shift text to the right.

If you really want to use Tab for that, then make a new command in the bundle editor and paste this in:

#!/usr/bin/env ruby
$: << ENV['TM_SUPPORT_PATH'] + '/lib'
require 'escape'
def esc(str)
  e_sn(str).gsub(/\}/, '\\}') # escaping inside a placeholder
end

s = STDIN.read
if s.empty? then
  print "\t"
else
  print "\t#{e_sn s}"
end

Then set the key equivalent to Tab.

rossmcf
While this does work, I've just realised that it pretty much disables tab triggers, which are one of the main reasons I use TextMate, so be warned!
rossmcf