I often need to enter text (consisting of repeated characters) like this:
------------------------------------ TODO ------------------------------------
In emacs, I can do a
C-u 60 - that's a Ctrl+U followed by a "60" followed by a "-", which makes entering a repeated sequence of characters easy.
Is there any way to do something like this in TextMate?
On 07/02/2009, at 11:24 AM, Debajit wrote:
I often need to enter text (consisting of repeated characters) like this:
TODO
In emacs, I can do a
C-u 60 - that's a Ctrl+U followed by a "60" followed by a "-", which makes entering a repeated sequence of characters easy.
Is there any way to do something like this in TextMate?
A simple solution is to create a new command
#!/usr/bin/env ruby -wKU linea = ENV['TM_CURRENT_LINE']
linea = linea.split(" ")
character = linea.pop number = linea.pop.to_i
print linea.join(" ") + " " number.times {print character} # end
with
Input: selected text or line Output: insert as snippet Activation, Key Equivalent: C-u
then to us the command type
10 *
and then C-u to have 10 * replaced by *********
It is possible to use stings of text, e.g., 5 +* prints +*+*+*+*+*+*
You have to leave an empty space before the numerical value and an empty space between the two arguments. (In the current form, all repeated empty spaces are collapsed to 1). An alternative is to use a macro to select the two arguments and then use the main idea of the script above.
All the best
Guido
-- Guido Governatori http://www.governatori.net/Textmate
On 07/02/2009, at 11:24 AM, Debajit wrote:
In emacs, I can do a
C-u 60 - that's a Ctrl+U followed by a "60" followed by a "-", which makes entering a repeated sequence of characters easy.
Is there any way to do something like this in TextMate?
You can identically duplicate this functionality across all (Cocoa) OS X apps. Enter the following in Terminal:
defaults write -g NSRepeatCountBinding -string "^u"
Now, by default this conflicts with TextMate's binding for uppercase... I don't know which will take priority. You can make the NSRepeatCountBinding string something different, or you can change TextMate's setting in Textmate.app/Contents/Resources/KeyBindings.dict