Auto auto-complete in TextMate - textmate

I've recently switched to TextMate from Coda after getting annoyed by the long delays and general slowness of the app. There are a few annoyances in TM but it's mainly because I'm used to one over the other. One aspect that is driving me nuts however is the lack of automatic auto-complete.
For example, in a CSS document in Coda I could begin typing fo and Coda would pop up a list of font-style, font-weight etc. Selecting one of these would then show available properties, bold, light etc, again selectable. In TextMate I've begun using the Bundle auto-completition shortcuts but they're pretty useless as you have to type practically the whole thing for shorter snippets.
Is there any way of making TextMate replicate Coda's behaviour of automatically suggesting as you type? If not, are there any other editors that do (BBEdit?)? Thanks.

Pressing escape autocompletes for you. At least nowadays.
Maybe it's not as seamless as one would like, but it works.
TextMate has a simple yet effective completion function on ⎋ (escape).
It will complete the current word based on matches in the current
document. If there are multiple matches, you can cycle through these
by pressing ⎋ continuously. It is also possible to cycle backwards
using ⇧⎋.
Source

Install the TextMate bundle "GetBundles" first
I believe these two terminal commands will do it:
cd ~/Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
Then, in TextMate, press Ctrl+Cmd+T (this should be a very familiar shortcut) to bring up the window of bundles that are valid in your current scope. Type 'get bundles' or 'getbundles' and press enter when you are on the right bundle. This opens a window to search a bunch of repos for bundles. In the upper right is a search box. Enter 'CSS'. There are 5-6 CSS bundles available, I would try them out and see if one fits your needs.
TextMate doesn't have that kind of that kind of code parsing built in to the core but I know of at least one bundle (the PHP bundle, now included with TM) that does it.

You might try Espresso (http://macrabbit.com/espresso/): its auto-complete is similar.

Textmate also has tab triggers, which can be very useful and are as close as it gets to auto-complete on TextMate.
For example, if you type in "head" and then press tab, this will show up automagically:
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Page Title</title>
Textmate already has this built in for a few HTML tags, but only a very small number. So, you'll probably want to get a bundle that will expand tab triggers to cover all kinds of tags.
If you do everything that Brandon and matkins have already told you to do and search for the "HTML+" bundle (which can also be found on GitHub), this will allow tab triggers for almost all possible HTML elements and attributes.
Then, for example, you can type "p" and then the tab button and this will show up automagically:
<p></p>
with the curser in between the two tags.
You may be able to find similar bundles for CSS and other things – I haven't looked yet.
Again, this is as close to tag autocompleting that Textmate can get, as far as I have found.

Related

Automatically fetch links with Sublime Text?

This is kind of a random question, but in Textmate, there was a really nice feature. You could highlight a URL, press a keyboard shortcut, and it would automatically create for you.
I just searched tirelessly for about a half hour trying to find a similar package that would do it, but I can't seem to think of what search term to even look for. Anyone know off the top of their head a package that does this? I really loved that feature; it would hit the other website, grab the title attribute, and drop it in for you.
Any advice would be much appreciated!
I don't think you can do that easily with standard sublime abilities. But I've found a package that is inspired by Textmate and it's called HyperlinkHelper.
Simply install via PackageControl, restart sublime and you are ready to go. The default keyboard shortcut for generating a hyperlink out of the current selection is STRG+ALT+L. Tested it in sublime 2 and works perfectly.

Lost syntax highlighting in Textmate

Using Textmate, I have somehow managed to turn off syntax highlighting for php files. After much trial and error, I have worked out that this happened when I accidentally hit SHIFT-CTRL-OPTION-D (I'm on a Mac, btw). I've looked everywhere and tried many key combinations, but I cannot figure out how to re-enable the nice syntax highlighting. Please help me, Textmate gurus, you're my only hope!
The key sequence SHIFT-CTRL-OPTION-D corresponds to an option in the language menu down at the bottom left of the Textmate window. The language menu tells Textmate what language to consider the file so it can determine the proper syntax highlighting. The key sequence I hit caused Textmate to highlight my text as though it were a diff window. Switched it back to PHP and it works great now.
I don't have enough rep to add a comment, so I'll expand on the accepted answer here.
SHIFT+CONTROL+OPTION+<LETTER> will display a menu showing all grammars beginning with <LETTER>. So if you want PHP back, just hit SHIFT+CONTRL+OPTION+P, and then a list of languages beginning with 'P' will pop up. You can choose one from the list by pressing the corresponding number (on my computer, it's 2).

Textmate Tab browsing

Something that I have always wanted in TextMate was a different way to open files.
For instance, when I open a file in TextMate, I would love the active tab to default in position 1. Then when I open another tab, that tab should take over position 1, and the rest will shuffle down the list.
Are there any plugins for TextMate that provide this type of functionality?
I don't believe such a plugin exists.
There are two plugins providing supercharged alternatives to the project drawer:
MissingDrawer
ProjectPlus
They don't provide the feature you want but you could try to get in touch with their authors to see if they can add it or point you in the right direction.
The ProjectPlus project has been pretty much dead for years (there are unanswered pull requests from january/february 2011) but there seems to be some action on MissingDrawer.
If you know Objective C you may be able to hack something from their sources.
Whatever the outcome it may work for the "click on a file in the drawer" way of opening a file but not for other ways.
Did you look at TextMate's .plist? I've heard there are some hidden gems there.

Beginner's TextMate Question

So I'm coming from the world of Visual Studio wherein which I have "intellisense" and certain keyboard shortcuts (thanks also in large part to ReSharper). I am transitioning to the Mac and have a copy of TextMate.
How do you get it to automatically place a closing HTML tag when you create a new one? Is this a "bundle" and if so how do I get it to work.
Sorry, beginner's question
Assuming you are in HTML mode... (look at the status bar at the bottom)...
Type a word then press ctrl <
That will use the word to create open and close tags for the word (e.g. table)
table^<
<table></table>
You can use the "Tab trigger" snippets from the HTML bundle (installed by default). For example, if you want a body tag, you can type:
body[TAB]
and TextMate will insert the full opening and closing tag.
For more on the various HTML bundle capabilities (because there are several) see http://manual.macromates.com/en/bundles#html

How can you go forward/backward at the file level with Xcode 3.2?

Xcode 3.2 has implemented cursor-level history for the "Go Forward", "Go Backward" commands. Previously these worked at the file level, so you could navigate back and forth through recent files you've been editing. Now they navigate at a more fine-grained level, through the places within files where you have been editing.
The downside to this is if you navigate backwards through the files and make a minor edit, all of your forward history is wiped out, whereas in the past it used to be easy to return to the file you were working on. It also means issuing a lot more commands if you just want to move through files, since you have to skip through all the edit points within each file.
I can't find anything in the release notes or documentation about this new behavior, so does anyone know if it's possible to get the old 'go back/forward by file' commands in 3.2? If not, does anyone have any tips on other ways of easily navigating recent files in Xcode?
Hold down the option key while you click the forward/backward arrows at the top of the code view, this will use the Xcode 3.0 behavior and go back a file at a time.
I had the same question as well and and Rob's answer on holding Option while clicking the forward/backward arrows works well.
I needed a keyboard shortcut though and I've found that Shift-Option-Cmd-left/right works.
From the comments on this blog entry:
Hold down the Option key to get the old file-based Go Forward/Go Back behavior. We rarely change established behavior like this when adding new options, but in this case, the majority of users considered file-level navigation Broken and location-based navigation Correct, based on their experience in browsers and other IDEs. We chose to give what more people considered the “obvious” behavior the pride of place on the keyboard shortcut, but the old way is still there.
-- Chris Espinosa
But like you guys have said, after every keyboard edit, the forward file history is lost. This is incredibly frustrating to me, as this is a feature I have heavily relied on for years, which is now broken. Is there still no fix?
There are Next File and Previous File commands, however their history is also wiped out after an edit. That seems like a bug to me.
This is plain stupid! What's the reason for suddenly change this ? Shift-Option-Cmd-left/right... great, more stupid shortcuts from Apple. I guess I soon have to use Shift-Option-Cmd-Left-Alt-Enter-N for something I use all the time. Can't they just implement a recent file list on ctrl-tab or something, like the Cmd-tab and the app switcher. Why would I want to grab for the mouse when I'm coding ? Still I have to use it lots in Xcode.
Sorry for my rant :)

Resources