Textmate 2 Tips

  • Archive
  • RSS
  • Submit a post

Strip trailing whitespace on Save with …callbacks!

Open the bundle editor (⌃⌥⌘B) and open “Text” → “Menu Actions” → “Converting / Stripping” → “Remove Trailing Spaces in Document / Selection”.

Then in the drawer put callback.document.export in Semantic Class and Document / Replace Document as Input / Output.

Hooray! From now on each time you’ll save a document all trailing space will be stripped!

Bundle Editor

    • #trailing whitespace
    • #textmate2
    • #callbacks
    • #stripping
    • #submission
  • 10 years ago
  • 18
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Create a new file in a project folder

One of the big changes in TM2 is that you can no longer create new files from the Project Drawer's right click menu. This was a handy feature that I honestly miss.

Fortunately, there is a work around though it’s somewhat less intuitive.

  1. Create a new file/tab by hitting ⌥⌘N or choosing File > New Tab from the menu.
  2. Select the folder that you want to save the file in from the File Browser/Project Drawer:

    Selecting a folder in the file drawer

    Here I have the stylesheets folder selected.

  3. Save the new tab (“untitled” in the screenshot above) by hitting ⌘S or choosing File > Save from the menu.
  4. The file dialog will come up with the folder you chose in step 2 selected.

    There's your folder

    The save dialog with your folder selected.

  5. Give your new file a name and hit Enter or click Save and the file will be right where you want it!

    A new file created in a folder of your choosing

    There it is.

It’s worth pointing out that steps 1 and 2 can be done in any order.

  • 11 years ago
  • 12
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Launch files from the File Browser with a single click

Open files with a single click

Want to be able to open files in the File Browser with a single click like you used to in TextMate 1? Click the file’s icon! A lot of people are asking about this one.

    • #File browser
  • 11 years ago
  • 8
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

8956 Released

Development continues. This release allows you to disable the functionality that hides the tab bar when only one file is open. Disabling that auto hide makes Textmate 2’s functionality like that of Textmate 1.

2011-12-18

  • Introduced callback.application.did-activate and callback.application.did-deactivate as two new semantic classes. A command with this class will be executed when the application gain/lose focus. The scope selector is matched against the “current scope” of the visible document (in each window). This allows creating a command with “Save” set to “Modified Documents” and thereby recreating TextMate 1.x’s ability to save modified documents on lost focus.
  • The approach in 2.0 also allows to run some code, for example reloading the currently open browsers, and it can be scoped e.g. to text.html to only have the “save on lost focus” enabled when editing HTML files - alternatively one can introduce a custom scope like attr.save-on-deactivate and set that for specific projects via a scopeAttributes setting in .tm_properties.
  • Tab bar can be made always visible: defaults write com.macromates.TextMate.preview disableTabBarCollapsing -bool YES.
  • Fix issue with indented soft wrap having the prefix string wider than the wrap column.
  • Fix issue with selection sent to commands needing entire document (e.g. ⌘R for Ruby, Python, etc.).
  • Fix issue with ⌃⇥ not always working to move focus to file browser.
  • Remove folding patterns from grammar template.
  • 11 years ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

TextMate Blog » Multiple Carets

In this article will discuss:

  • Using multiple carets with the mouse
  • Changes to column selection
  • Using multiple carets with Find
  • Using multiple carets with Copy and Paste
  • 11 years ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

⌘X in the File Browser

Allan pointed out to us yesterday that In addition to ⌘C one can also use ⌘X and ⌘V to move/copy files around (⌘X doesn’t “cut” before ⌘V is used).

    • #File Browser
  • 11 years ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Language codes

Thanks to llamageddon for this list of language codes used for spellingLanguage in tm_properties

    • #Language
    • #.tm_properties
  • 11 years ago
  • 8
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Replicating Edit Each Line In Selection

Here’s a great tip from eirkeirkeirk :

 I noticed the ⌘⌥A command was gone from TM2. But I figured out a way to replicate it.

- Select all the lines you want to edit

- Turn it into a column selection (tap ⌥)

- Then ⌘→ to move all the carets to the end of each line

This is actually better than the previous incarnation because:

- You can actually see the carets, where as before you were typing blindly

- Each caret acts smarter. So you can do things like  ⌥← to move back one word in each line.

He’s also provided a quick video showing it in action: http://dl.dropbox.com/u/364257/editall.mov

    • #Multiple Carets
    • #Multi select
  • 11 years ago
  • 3
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

An excellent example of a .tm_properties file

A big thanks to hmans for sharing his .tm_properties file. Particularly useful are his instructions on how to hide specific directories (in this case: log, vendor and tmp) from the “Find File” dialog, but not from the project browser.

    • #.tm_properties
    • #Settings
    • #Preferences
  • 11 years ago
  • 17
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

8949 Released

I was delighted to see a significant update to the alpha released earlier today, with some much anticipated features/settings added. The big items here are the ability to disable text aliasing, the ability to put the file-browser on the right side of the window, and the option for HTML output to have its own window. See below for the complete release notes:

2011–12–16

  • HTML output can open in its own window: defaults write com.macromates.TextMate.preview htmlOutputPlacement window.
  • Anti-alias can be disabled: defaults write com.macromates.TextMate.preview disableAntiAlias -bool YES.
  • File browser can be placed on the right side: defaults write com.macromates.TextMate.preview fileBrowserPlacement right.
  • With multiple carets, ⌘-clicking one of them removes it (i.e. it’s a toggle).
  • Carriage returns (<CR>) on the general clipboard are converted to regular newlines when pasting.
  • Rename help book to “TextMate 2” which fixes issues where Help → TextMate Help showed TextMate 1.5’s help book.
  • TextMate 1.x and 2.0 can now both run at the same time.
  • Setting TM_HG and TM_GIT in Preferences is no longer eclipsed by the default properties (which set them to point at /opt/local/bin).
  • Fix potential crash when deleting bundles on disk (rm -rf).
    • #Update
    • #Features
    • #File browser
    • #Anti-aliasing
    • #HTML Output
  • 11 years ago
  • 12
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Page 1 of 3
← Newer • Older →

Logo

Textmate 2: The missing manual. Help us out by submitting any tips or tricks you come across!

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Submit a post
  • Mobile

Brought to you by Ned Schwarz..

Effector Theme — Tumblr themes by Pixel Union