- Create a new Command in some Bundle.
- Set Save to Nothing.
- Set Command(s) to the content of one of the Gist above.
- Set Input to: "Selected Text or Nothing".
- Set Output to Replace Selected Text.
- Set Activation to Key Equivalent and any keyboard shortcut you'd like to use (ie. ^I).
- Don't set a Scope Selector.
- It's done!
Created
June 17, 2010 11:50
-
-
Save romac/442009 to your computer and use it in GitHub Desktop.
Two Commands for TextMate which allows you to increment any digits/numbers in the selected text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$text = $_ENV[ 'TM_SELECTED_TEXT' ]; | |
print preg_replace_callback( | |
'/(\d)/', | |
function( $matches ) | |
{ | |
return $matches[ 0 ] + 1; | |
}, | |
$text | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$text = $_ENV[ 'TM_SELECTED_TEXT' ]; | |
print preg_replace_callback( | |
'/(\d+)/', | |
function( $matches ) | |
{ | |
return $matches[ 0 ] + 1; | |
}, | |
$text | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing to find this relevant 12 years later! Thanks!
For TextMate 2 I did mostly the same thing, but to get it to work with multiple selection I had to make some changes.
Firstly go to menu, Bundles, Edit Bundles, then navigate to where you want this to live (I used Text -> Menu Actions). Use Cmd-N and select Command. Paste in this snippit and make change thins to be like my screenshot: