Requests

I thought it might be useful to have a page for people to request solutions to problems that aren't covered by the Suggestions categories. Probably want to keep requests general and avoid troubleshooting: "Why won't my command work?" seems more appropriate to the mailing list.


Seems this has developed into a lot of questions that are much better to ask at the mailing list or IRC channel (at least if they are asked in anticipation of answers :) ). A wiki is more suited for building a knowledge base than using it as a venue for questions. I think the original intent of this page was to request HowTo articles.


A HOWTO for setting default tab preferences for given file types. And how to set a tab preference to length = 1.

Allan provided the following (as requested) to set defaults as soft tabbed (spaces), length = 1, for all XML files. Close textmate, run the following in shell, then start back up. Modify to taste:

defaults write com.macromates.textmate OakTextViewScopedTabSize -dict-add 'text.xml' '{ tabSize = 1; }'


Q: I wrote my own bundle. It comes along with some new scopes. I would like to format some of these scopes and so I've added these formatting rules in 'Preferences - Fonts & Colors'. That all works fine, BUT: If I want to share my bundle with others I can easily do that by simply dragging and dropping the entire bundle into the Finder. The new scope formatting rules I've created in the preferences are of course not exported and I do not find an easy way to share them as well. Of course nobody wants to add 5 such rules after installing a bundle.

Question summary: how can I share Theme extensions or include some formatting rules in an exported bundle? (I've searched for a while but did not find anything useful besides creating my own theme... but... not everybody who wants to use my bundle would also like to use my entire theme, right? -- Florian Jug


Q: I would really like to have a specific Postgres bundle. Specifically it is just the language that is not really complete for postgres in the generic SQL bundle. Is there one available from somewhere? Thanks. --tim britt


Q: How can I instruct TextMate to use PHP 5, which is active on my machine, instead of PHP 4? I've found references to this in the PHP bundle help, but the things it suggested seem to be over my head. E.G.: "you can set the TM_PHP environment variable through TextMate → Preferences → Advanced → Shell Variables." I only know html, css, and a little php at this point. I'm willing to learn but I've reached dead ends in the TM documentation. How do I set the TM_PHP environment variable, exactly? And to what? Thanks. --Steven Rowat

A: It's fairly easy, but you might need to do some digging. Because I have MAMP installed on my machine, I know that php5 is located at /Applications/MAMP/bin/php5/bin/php. If your php5 did not come with MAMP, then you're going to need to figure out where it's installed.

Once you have the path, open up Textmate and go to Preferences > Advanced and click on the Shell Variables tab. If you don't see TM_PHP in the list, click on the + and then replace MY_VARIABLE with TM_PHP. Now paste the path to php5 where it says "some value" and close Preferences.

To be sure everything worked, open up a PHP file, Run it, and you should see something like "PhpMate r**** running PHP 5.*.* (cli)".

--Phil


Q: How can I highlight some code in the editor and have MATLAB (already running in the terminal) evaluate it? Perhaps even pass the result back to textmate for further operations? Thanks.


Q: So you're editing a document and you use a snippet expansion (say an if/else block). So you tab into the first editing stop, then you want to use another snippet that has a tab trigger... but that sends you to the next editing stop instead of activating the next snippet.

Example: <editing whatever.php>

"php+tab" gives you the php block.

"ifelse+tab" is no problem because there isn't an editing stop from the previous snippet. This gives you the if/else construct and sends you to the editing block in the condition.

"$_+tab" should give you the option to select from the many global arrays... but instead sends you to the first code editing stop.

Is there some other key combo that achieves the snippet trigger without moving focus to the next editing stop?

--Ty Wangsness


Q: Ok. I have about 1/1000 of the brain that most of you guys have using TM. However, I use this app daily and am crazy over it. I just need some help with setting up some functionality due to my non-programmer understanding. I've set up multiple snippets & macros, but really don't have a clue on how to do something that I would see as being 'basic.' Any help would be appreciated.

Here's what I'm trying to do. In my html doc, I'm trying to automate the creation of an unordered list. My idea is to have the default fields plugged in for the first line, and the have it create new lines conditionally with all of the required fields. Is there a way to do this? Here is my code presently:

<ul> <li id="${1:item ID}"><a href="${2:link_url}">${3:list item}</a></li> </ul> --Darren Huckey


Q: How could one go about running a shell command over all files a document includes? An example would be running pdf2ps over all figure files called in a .tex doc. I'm trying to write a very general command to strip a latex doc of any PDF requirements, some sites/journals prefer postscript. This includes disabling pdfsync, pdflatex, converting any PDF figures, etc. Does this seem useful to anyone else? --Jim

A: Have a look at the file TextMate/Support/bin/labelList.rb and the command "Enhanced Insert Label for..." which calls it. That command traverses the current file searching for \include and \input statements, and gets the corresponding references. Depending on what exactly you want to do, this might or might not be the answer, but it's a place to start. --Charilaos Skiadas?


Q: Is anyone actually using TextMate as a serious XCode replacement? XCode drives me nuts sometimes, but TextMate's lack of things like being able to jump to the definition of a symbol, or method auto-completion, send me running back to XCode every time.

Q: Am I missing some nifty macros or plugins that make TextMate a viable editor for Cocoa development?

A: I use it myself, and I know I am not alone. It doesn’t do code completion or has the same documentation integration. But it does however have very useful snippets (like m, log, dict, array to name a few), does buffer completion on ⎋ and can lookup documentation for a named class, struct, or type on ⌃H. Plus file navigation on ⌘T is near instant. The former things mentioned saves me from far more typing, than what code completion would have done in Xcode, so I am far more productive using TM as a full replacement — but if you’re not good at using snippets, buffer completion, and need to frequently look-up stuff in the documentation (or header files), then maybe it is not the case for you. I know there are also hardcore TextMate fans which use it for all but Cocoa development, because they need the documentation integration offered by Xcode. -- Allan Odgaard

A2: Adding to this: watch the latest screencast.


Q: Is there a quick way to remove all the bookmarks in a file? I find bookmarks very useful during a 'debugging session'. After the session, it would be nice to remove them to keep the file 'clean'. -- Thanks, Dennis

A: One could do e.g. ⌘A, ⌦, ⌘Z :) I have a bookmark submenu planned (under Navigation) though and “Remove All” is going to make it into that menu. -- Allan Odgaard


Q: I'm looking for a search and replace that prompts for each instance, much like either emacs or vi has, where you feed it two args (possibly regexps) and you can choose each time it gets a match on the find portion if you want to replace with the replace portion. --Thanks, Jon

A: ⌘G does “Find Next” where one can then use ⌘V (paste) to replace or ⌘G to skip to next — it’s not exactly the same, but an option.


Q: How do you make it so that when you create a new file, it automatically has HTML encoding (or any other for that matter) selected instead of plain text? -- Thanks for any help. This is driving me nuts! Damien

A: see this post in the mailing list


Q: How can I change HTML Tidy to show me warnings and errors but NOT reformat or touch my HTML? --Thanks!

A: Tidy won't do this, but you can use control+shift+v to run your HTML through the W3C validator, which should give you the information you want.

-- Chris M.

Q: I would really like to see a bundle item for word completions(word/function list kind of thing), one thing i feel is really needed


Q: How can I make the Insert Close Tag unindent to match opening element? This was the behavior until the latest update.


Q: "How can I make Ruby On Rails my default language when editing .rb files rather than the standard Ruby bundle?''


Q:How do I capture mouse clicks for bundles? I would like to mimic a control from HomeSite, where if you ctrl-shift double click on an open or close tag, it hilights that tag all the way through it's match.


Q: Is there a way to use textmate in a manor similar to how emacs can interact with a running lisp instance via SLIME? That is, does there already exist a script to allow the communication with an existing process providing real-time evaluation of arbitrary code-snippets in an active runtime instance? Is there a community desire for such a capability?


Q: ''Another Lisp-related question. I'm a Scheme programmer, and as far as I can tell, TextMate doesn't have a system that would allow Lisp-style indentation. Am I wrong, or is there enough plug-in support for a plug-in to be developed to do this? I will explain the indentation idioms to make myself clear:

Everything is written as a parenthesised list, where each term is a symbol or a nested list:

(term1 term2 ...)

The default indentation rule lines subsequent lines up to the right of the head of the last list opened:

(map string-append (list "a" "b" "c"))

(preformatted text doesn't seem to be working - look at the page source to see what I mean)

There are other rules, selected depending on the head of the last list opened. For example, the (define ...) form always indents two spaces (one soft tab):

(define variable value)

So basically the complications are:

  • The amount to indent varies depending on the contents of the last row.
  • Because Scheme and Lisp are macro-extendable, programmers should be able to choose which indentation rules to use in which cases (the indentation preferences in the DrScheme editor from PLT Scheme are a good example of this).''
-- Dave G

Q: 'Smarter-still' symbol-pair completion

It would be nice if the symbol-pair completion algorithm could detect if there was *already* a closing symbol, and not auto-insert the closing pair if so.

I don't know how often this would be used (mainly for editing already written code), but it would come up if you were changing, say, the beginning line of a Perl fragment in OTBS:

if (...) {

   print 'something';

}

If I type the entire first line again, it auto-inserts the closing '}', which I then have to get rid of.

This might go along with the previous sugestings about LISP and Emacs-style programming interfaces, as I'm sure something like this could be written as a small LISP/Scheme proram efficiently, and then just inserted as a subroutine of some sort into the TM engine.

-- Jim Witte

PS. Is there a global registration page on this wiki?


Q: Is there an easy way to restart a webserver with a simple shortcut?

I need to restart my Apache2 to make changes visible and would like to have a simple way to accomplish this. I don't know how to do this as 'root'. Any suggestions?

--Jens

A: try apachectl -graceful --boblet

Re: that does not solve the 'root'-user problem

Jens: "The 'root'-user problem" could be one of two things. The "normal" way to do this on a Mac is 'sudo apachectl graceful', which will prompt for an admin password and restart Apache.

If the root-user problem is that you want it to happen without user interaction, you can create a shell script that uses something like 'expect' (man expect) to enter the password, and use the shell script to restart httpd.

Note that this is considered BAD SECURITY MOJO, since your password will be in the shell script file. Alternately you could twiddle the ownership of Apache, but again, this seems like a BAD IDEA, that could be rendered nonfunctional by a system update. --Frank


Q: Can I use mate to edit root files from the command line? Currently, stuff like sudo nano /etc/shadow allows me to view and edit that file, while sudo mate /etc/shadow does not. It simply opens a blank document window in TextMate. Can it be done?

A: Try sudo /Applications/TextMate/Contents/MacOS/TextMate to run TextMate under root. The 'mate' command line utility only passes a file to the background TextMate application (as if you had run the Applescript "tell application 'TextMate' to open file x").

Again, BAD SECURITY MOJO!


Q: Is there a way to use TextMate for editing Subversion (svn) import/commit messages? If I set "editor-cmd=mate" in the subversion config file, TextMate correctly loads the temporary submit-message when doing a svn import/commit from command line, but svn returns directly with error "Log message unchanged or not specified". Subversion is not 'waiting' for TextMate to save or close the file.

--Armin Dressler

A: Try setting "editor-cmd=mate -w" (or you can set your environment EDITOR variable). This waits until the file is closed in TextMate. See also 'mate -help'.


Q: I really love autocomplete. "inline autocomplete".

Is there any way to make this possible in textmate?

ie. the completion shows up as you type and to finish the word, just press enter.

I have been using firebug much more lately and I am finding how fast and useful it is to have inline completion like this. Thanks

--Dave Gregory

Q: What about completion over multiple documents? It would really help if textmate would complete words I have already written in another open file.

--Wolfgang

Q: I want to configure Actionscript editing mode so that when I hit CMD/ the selected lines (or single line) are preceded by the single-line style comment (//), rather than wrapped in the multiline style comment (/* ..... */). I tried poking around a bit in the bundle editor but worry about breaking things..

--Zeke

Q: How do I set TextMate's path to SVN?


Q: How do I integrate TextMate with Safari 4 as an Input Manager as we could with older versions of Safari?