Hi,
I'm new to TextMate and have been struggling with a few things. I'm having
trouble finding answers on Google etc. and was hoping someone in the forum
could help.
1. How to insert a new line above the caret position and move to the start
of the new line (in the correct indentation level). Something like Shift-O
in vim.
2. How to move to the start of the text on a line. So something like Ctrl-A
then Ctrl-LeftArrow
3. I also have a question regarding TextMate's auto-indentation model. Say I
have the following ruby snippet:
def foo
puts 'hello world'
<caret>
end
Note the caret is not indented correctly. If I press enter the next line
also starts against the margin. Is there a way to have TextMate always put
the caret in the correct indentation position when starting a new line?
Correct being whatever TextMate thinks is the correct position.
Regards,
Liehann
Hey all,
I've been doing some php code lately and got a bit tired of writing
getters/setters. I didn't find a command to generate them for me, so
I whipped one up.
I'm putting it here in case someone finds it useful.
The idea is to highlight the lines in your class file where you
define the class's instance vars. You then just have to fire this
command and it'll create generic getters/setters for the vars found
in the selection (can do multiple per line). If no lines are select,
it will try to create getters/setters for the vars in the current line.
It might be handier if it dumped the code into the clipboard, or
something, but it will just drop the code right below the current
selection.
If that sounds handy, you can create a command like so:
==================
Save: NOTHING
Input: SELECTED TEXT or LINE
Output: INSERT AS TEXT
Scope Selector: source.php
Command(s):
-----------------
#!/usr/bin/env python
import os,re,sys
template = """
public function get:CALL:() {
\treturn $this->:VAR:;
}
public function set:CALL:($:VAR:) {
\t$this->:VAR: = $:VAR:;
}
"""
regex = re.compile(r'\$(\w+)')
try:
text = os.environ['TM_SELECTED_TEXT']
except KeyError:
text = os.environ['TM_CURRENT_LINE']
for line in text.split('\n'):
for var in regex.findall(line):
code = template.replace(':VAR:', var)
code = code.replace(':CALL:', var[0].upper() + var[1:])
sys.stdout.write(code)
=====================
Bind to your favorite key combo and voila.
-steve
Every so often I'll open a file in TextMate and the window is all
garbled, like this:
http://microseeds.com/reference/textmate_garbled.jpg
Now this doesn't happen very often, and it's not a show stopper since
scrolling or resizing the window fixes the problem.
Has anyone else seen this?
- Dave
Hi all... there's something that's been bugging me for a while. I've
been wondering if it's possible to add a symbol to the Symbol PopUp
in a Plain Text file?
I know that I can use bookmarks, but I much prefer the Symbol PopUp
for file section navigation.
Thanks
Mike
Hi,
short question:
Like TeXSLMate Palette I would like to create a menu item (with short-
cut) in TM's 'Window' menu for my tmPlugin. How can I do this?
Many thanks in advance!
Hans
I have a problem using the svn bundle with password protected
repositories and the problem is that the bundle can't find ssh-askpass,
which is to be expected since there's no ssh-askpass anywhere in my
system :).
I've search around but all I found is some references to a python
ssh-askpass script.
Any ideas how I can get this thing to work?
Thanks,
V.-
--
http://www.braveworld.net/riva
Hi,
I use tm_dialog dozens of times to simplify matters, and to save time ;)
But sometimes I would need a bit more (like the accessory views ;) ):
I wonder if it would be possible to write a nib which contains a
button, e.g. 'Browse', and if I press this button it opens an other
nib (or in that case a file select dialog). The returned value from
the called nib (file select) will set a value in the first nib?
An other approach:
Press a button in tm_dialog. In tm_dialog there is a buttonListener.
If that button is set to invoke a shell script then do it. This shell
script (an other tm_dialog or what ever) could write something to a
file and its content could update my actual tm_dialog.
Would this be too complicated or even impossible to implement?
Up to now I did such things like
PLIST1 = "..."
PLIST2 = "..."
pressedButton = Browse
while pressedButton == Browse
pressedButton = $DIALOG -p PLIST1 a_nib
if pressedButton == Browse
PLIST2 = $DIALOG -p PLIST2 a_other_nib
PLIST1 = modify with values of PLIST2
end while
Application examples could be:
- a Browse button to open a separate File Select Dialog
- a Edit button to edit preferences for the tm_dialog
- a Install button to install stuff which is missing without leaving
tm_dialog
- a Refresh button to refresh values in the tm_dialog
Or is there an other way to do something like that?
Do I carry things too far? ;)
Cheers,
Hans
God Day all,
What advice do people have for marking up a language grammar containing
statements with a variable (and potentially lengthy) list of parameters,
which are themselves morphologically complex?
I saw here <http://macromates.com/blog/2005/language-grammars/>, the idea
of using $self to re-parse the detected fragment using the whole language
grammar
{ name = "markup.bold.html";
begin = "<b>"; end = "</b>";
patterns = ( // really means ³contains²
{ include = "$self"; }
);
}
And also the idea of using a repository of named rules to direct the second
level of parsing. Are there bundles that use that and upon which which I
could base my work ?
The statements I want to match are of the form
latentVar BY var var var var...;
This should be parsed into <variable.latent> <keyword.BY> <variable.dv>...
The tricky bit is that each variable has its own syntax and can appear n one
of three forms
name // <variable.name>
name@n // <variable.name><keyword.at> <numeric.value>
name*n // <variable.name><keyword.start> <numeric.value>
So that each variable gets matched like this:
\s+(\w+)(((a)|\*)([-\.\d]+))?\s+
A test case might be
e1 BY item1@1 item2 item3*0.51;
It is obviously pretty redundant and unmaintainable to make a big list like
that in a single rule, and ultimately not possible as the variable list
might exceed the rule's length.
Suggestions gratefully received.
Tim
hi TextMate'rs,
i have the key binding blues. i'm an old vi guy and i still cannot
deal with the mouse when writing. so, i want to be able to use
TextMate *without* using the mouse. moreover, i want to be able to
use all the keys on the *home row* of my query keyboard (e.g., a-s-d-
f-g-h-j-k-l-;).
my question is how do i ensure that my keybindings override
everything? for example, TextMate uses ^h in lots of different
bundles and i have to hand-edit a dozen different bundles to change
^h to something else. (i thought control- functions were reserved for
user stuff?).
right now, i'm using KeyBindings.dict in ~/Library/Application
Support/TextMate, like so:
{
/* vi-like navigation */
"^f" = "pageDown:";
"^b" = "pageUp:";
"^w" = "moveWordRight:";
"^h" = "moveLeft:";
"^j" = "moveDown:";
"^k" = "moveUp:";
"^l" = "moveRight:";
"^e" = "scrollLineDown:";
"^y" = "scrollLineUp:";
}
also, is there anyplace that has the definitive documentation for
what the keybindings are? (TextMate's 'Show Keyboard Shortcuts' isn't
showing my changes). i'm mostly interested in text navigation and
basic word processing functions. i can't believe that i'm nostalgic
for WordPerfect circa 1990 when everything clearly defined via
function keys and you could by a reference card for it :).
neverthelesss, TextMate has more promise than anything i've seen in
years.
finally, are there example key binding configurations for TextMate
that are emacs-like or bash-like or vi-like?
thanks in advance,
-darren
On 8/4/07, at 12:00 PM, textmate-request(a)lists.macromates.com said:
>>> In your case, you have the build dir in the .xconfig file?
>>> Ideally we would extend our code to also look there.
>> OTOH, would that make a good fall back when we can't find the
>> executable even in $PROJECT_DIR/build ?
>
>Probably not ideal [to get the Executable Path via an AppleScript],
>since it would start up Xcode (if not already running), and would
>require Xcode to have the current project loaded. Personally I do
>not have Xcode running most of the time.
Ok. Then would configuration based environmental variables be useful for the Xcode bundle? You tell the XCode project you're building Debug configuration (and/or X target) and TM will use Debug environmental variables instead of Release ones... or environmental variables specific to that target.
(This would also solve my problem in a round-about way: I could specify a TM_BUILD_DIRECTORY_DEBUG and TM_BUILD_DIRECTORY_RELEASE and, since I specified that I'm building Debug, TM would use TM_BUILD_DIRECTORY_DEBUG to find and launch the app)
Later,
_Ryan Wilcox
--
Wilcox Development Solutions: <http://www.wilcoxd.com>
Toolsmiths for the Internet Age PGP: 0x2F4E9C31