Chris Mendez in For Developers, Tools for Software Engineers

My Favorite TextMate Commands

I've tried Sublime Text, Atom and Microsoft's Visual Studio Code but I still love TextMate 2. Considering that all of these editors pretty much offer the same (Syntax Highlighting, Support for Multiple Languages, and Auto Completion), the only thing that matters is that I've picked one and am sticking to it.

Why not a fully featured IDE?

Many people also ask me, have you tried IntelliJ IDEA, Android Studio, Webstorm, PyCharm, Eclipse, xCode, RubyMine, Aptana, and the answer is YES! I've tried them all and the reason why I still choose TextMate is because it's lightweight, macro customizable, and flexible enough for me to quickly work on Ruby on Rails, NodeJS, jQuery, Apache Config, PHP, and even Swift.

So without further adieu, here are some excellent tricks you can try within Textmate.


Find

Search for text within any project using shift + command + f. You can also add regular expressions to your search.


GO TO

Line

Move your cursor to the specified line number.

Command + L

Symbol

If you're working with Node, select "Jump To Symbol" and a window will appear with the names of the functions or methods available.

Shift + Command + T

File

If you want to navigate through your project files.

Command + T


Manipulating Text

Uppercase

Control + U

Lowercase

Control + Shift + U

Title case

Option + Control + U

Spaces to Tabs

Menu > Text > Convert > Spaces to Tabs

Tabs to Spaces

Menu > Text > Convert > Tabs to Spaces

Reverse Text

Control + T

Move Selected Text Line Up

Control + Command + up arrow

Move Selected Text Line Up

Control + Command + down arrow

Move Selected Text Right

Control + Command + right arrow

Move Selected Text Left

Control + Command + left arrow


TODO, FIX, MARK

If you press control + shift + T, Textmate will analyze your directory and search for anything commented as TODO, MARK, or FIX. This is really handy.


HTML

Create a new <p> tag

Control + Shift + <

Autocomplete a new <div> tag

div + tab

Comment out HTML

Options + Command + /


Shell Commands

Execute a Shell Command

You can execute a command from the text editor by pressing Control + R.

Give you a listing of the currently active processes, which is fed to head via a Unix pipe to trim the output to the top ten processes:

ps -acu [username] | head -n 11  

Execute a Ruby Command

Control + Shift + E

rand(100_000).to_s.reverse.gsub(/\d{3}/, '\0,').reverse  

Math Commands

If you ever want to add these up quickly, simply select Control + Shift + C.

6 cows  
2 sheep  
1 Perl programmer  
10 chickens  

And you will get this

= 19

Bundles

Bundles are great for extending Textmate to include new languages and frameworks. This command will install the Jade.tmbundle from Github to TextMate's specific folder.

git clone https://github.com/davidrios/jade-tmbundle.git cd ~/Library/Application\ Support/TextMate/Managed/Bundles/Jade.tmbundle  

Themes