The bundle craziness continued part 3

TM Bundle for Textattern part three

NOTICE: Not all of the information corresponds to the latest Bundle version, please refer to TXP bundle version 07

The updated version of the Textpattern Bundle is a little overdue, so this third article finally provides you with both a corrected download version of the Language Bundle and second an updated Theme.

There where various things, that kept me busy and certainly I do apologize for the fact that the latest Bundle version did not work as expected. See below.

Previous versions of the Bundle had some hiccups with plugin tags, and the new version resurrects that with a small compromize.

This article is written, so It suits the needs of beginners of TextMate based on a couple of practical step by step examples.

The new Bundle version now definitely works with your latest cutting-edge version of TextMate, so much, but use at your own risk.

As everybody knows, I am neither a programer neither versed in UNIX. So keep that in mind. I still keep getting a warning about zero-width match in Console output. I have no Idea right now, why that is, but it won't do any harm either. The folding start markers and folding stop markers now work correctly,although only on a selected amount of tags, where that makes sense.

I still keep enjoying TM very much and TXP as well, so this is basically why I decided to make this Bundle and I will base all my templating work completely on it except for layout work on CSS files which I will leave to TopStyle.

  1. Release Notes what's new
  2. Important keyboard shortcuts in TM
  3. A common Usage example for working with snippets.Dynamic variables in TM
  4. Commands and dynamic variables
  5. Terrific feature of multi stroke key Bindings
  6. More goodies to come
  7. Troubleshooting
  8. Download

Release Notes what's new

back to top

I didn't spent much time lately on testing. But some changes in TM's code base that deal with Language Grammers, caused the Bundle Editor to crash. That's now fixed, so this version will be compatible with all post r 948 version s of TM.

My apologies again

As mentioned previously, interference problems with plugin tags are solved, but with one small trade-off. Which one is that ?

Single plugin-tags can not have distinct scopes for attributes and values, but have a common attribute-with value scope instead.

Important keyboard shortcuts in TM

back to top

When I first switched over to OS-X, I found myself pretty alien to all the keyboard shortcuts that I came across. TextMate has helped me a lot to improve my typing skills. The good news about all this is, that most of the common keyboard shortcuts follow the same logic regardless wether you are in TextMate or any other application much more than it is the case under a windows environment. And I know, that I can be certain, that they do that very much in TM. Therefore, when you are new to TM of UNIX like environments, think carefully before assigning keyboard equivalents to your Bundle Items, once you start to extend or modify a Bundle.

It is still possible to have the same key board equivalents for different things assigned, once the scope gets refined. Also later versions of TM will provide a pop up menu to choose from, once the same equivalents are assigned to different things. However, you will do yourself a big favor, when you study the logic first, that lies behind the shortcuts. All that is available in the manual or in the macromates blog.

keyboard shortcut essentials

When authoring, there are certain must-know shortcuts, that are useful to not forget. Listed below. I still keep forgetting many shortcuts, but not these essential ones.I also found, that for those, that are harder to remember, that sometimes my fingers sometimes keep intuitively hitting the right ones, once I start typing, although I can not recall them just mentally.

There are also some very nice cheat-cheats around available in printable PDF format, to keep aside, while working.

Those might not be of your taste, since there are too many on one sheet or because some others are missing, or the grouping differs. Or you are just working with different Bundles that are not listed there. Below is a Summary of my essentials, except the very trivial ones that are common anyway.

Essential keyboard short-cuts
Call up Bundle EditorCtrl opt cmd B⌃ ⌥ ⌘ B
Call up TextMate Manualcmd ?⌘ ?
Find and Replacecmd F⌘ F
Wrap selection with tags, default to pctrl shift W⌃ ⇧ W
Wrap with current word/line/selectionctrl shift <⌃ ⇧ <
Return caret to newlinecmd return⌘ ↩
Wrap selection as linkctrl shift L⌃ ⇧ L
Validatectrl shift V⌃ ⇧ V
Get current scopectrl shift P⌃ ⇧ P
Helpctrl H⌃ H
call up prefscmd ,⌘ ,
Find in projectcmd shift F⌘ ⇧ F
Select current Linecmd shift L⌘ ⇧ L
Duplicate current Linecmd shift D⌘ ⇧ D
Delete current Linecmd shift K⌘ ⇧ K
Open in TM from other appctrl cmd E⌃ ⌘ E
Select current wordctrl W⌃ W
Select current Linectrl cmd L⌃ ⌘ L

A practical example for working with snippets. Dynamic variables in TextMate.

back to top

Textpattern now provides different ways to to fine tune Textile as well on a per article basis. However, what is missing from the provided controls is something that would provide you with a control to switch it on or off on a per selection basis. This is a common problem, when you prefer to author your web pages with an External Editor and need to switch Textile off, on a per article basis.

Normally Textile will leave your HTML alone even if you have Textile switched on.

There are however a couple of problems with this in at least three situations, when you do so.

I ran into this problem the previous time, I published an article, and I didn't find a solution to it, until I went gold-mining again on the Textpattern Forums.

  1. Textile will bork your validation with arbitrary break tag insertion
  2. When you switch Textile off, your TXP Image tags normally would need to be converted to XHTML which is awkward. You will get a fatal error on your install, if you don't do so.
  3. If you have code blocks in your article, that are wrapped with code or pre code, your code doesn't get displayed.

The solution to this is one of Marys plugins, upm_textile, that will allow you to switch textile on and off, on a per selection basis, and also allows you to fine-grade it with a couple of attributes.

So what we then do now. We install the plugin and enable it, and then wrap each pre code block and img tag with the plugins container tags by creating a snippet in TM, that makes use of a common dynamic variable, which is TM_selected_text.

The use of this snippet requires the plugin installed and enabled. You can make use of the context sensitive help command to find the download link.

If you are unfamiliar with all these shortcuts and key equivalents, here is a little Guide that you can follow:

When you have your article open, that needs to get fixed, then call up the Bundle Editor, so you can see which shortcut is used for the snippet, that we use. The snippet is already in the TXP Bundle, named Textile selection (plugin required). Select it and in the lower right, you can see the Activation method, that is used to call the snippet in your document. Here it has a key equivalent of ⌘ 1.

If the article is very long, with many images as often the case in documentations or technical articles,then it is a good Idea to make use of the find and replace command,so we call it with⌘ F and providing the search field just with the beginning of the image tag is enough to match them all.(Uncheck the Regular Selection Box here in this case)

I can now move from tag to tag each time by calling the find command and using return to move on to the next image tag,deselect with the arrow keys,and or using ⌘ ⇧ ← → to make the selection and then pressing ⌘ 1 to wrap the selection with our no-textile tags.

textile this selection

The same should be done with the pre code blocks, and after that finally I can switch off textile on a per article basis and republish my article and hurray, our page is validating again.

There are other more effective ways, but repetition is the mother of all learning, so this is a good exercise to improve typing skills.

Commands and column wrapping

back to top wrap with conditionals

Here is a another simple example of how to take advantage of columnar selection mode and the conditional wrapping command. I just made up this simple example via imagination, since I don't have anything practical at hand right now. Let's say you want to customise some link columns for each section having some external links differently for each section. That would be a common standard min task when authoring a page template file. When you use one page template for all your sections that have these link columns you can do this:

Provided, you have already generated your link form with your list element in there, you can create a snippet for convenience and RE-usage. Give it a tab trigger value of linklist.

We want to output everything as an unordered list, so we type ul and use ⌃ ⇧ <.We insert our snippet after return and then tab through to insert the values we need for our first section column.If we are inside a project folder, we can even cycle through the values of the form attribute if needed using an auto-completion command by sequentially hitting the Escape key.(Useful, if we have many forms, and can't remember the ones we have created.)

We can insert those link-tags one by one. However, what if we change our mind later on, about the category names or if we just keep duplicating the existing snippet, when we are to lazy, to type the tab trigger value each time ? No problem, but lets switch to columnar selection mode first by holding down the option key and drag a selection around our linklist tags. Now lets wrap first all the tags with our wrap selection with conditional tags command. So we do:⌃ ⇧ ⌘ LThis shall be a section conditional, so we type section at the first tab stop insertion and then our first section name.

Generic conditionals

We still want to change certain attribute values (Our category and section names here), so we can place the caret back at the beginning of the link list tags and then make use of the Oniguruma tabbing macro by sequentially hitting the enter key on the numeric keypad.(Doesn't back-tab though) Done.

tabbing through with Oniguruma

Terrific feature of multi stroke key Bindings

back to top

Another killer thing that I just installed yesterday is the use of a customized dict file, that allows you to hide all the special Glyphs behind ⌃ M This is useful, if you want to access those Glyphs from within other Bundles or outside of TextMate on other cocoa based applications. I used it to write this article with great convenience.

Read about it in Allans Blog here:multi stroke key-bindings.

More goodies to come

back to top

As I mentioned in one of the previous articles, I am going to look into a lot of more TM features, and how they can be taken advantage of, and document this stuff here as I move along and keep enjoying TM and Textpattern. Check back here if you like, since this article is still under revision.

Troubleshooting

back to top

IMPORTANT NOTICE:When you want to take advantage of Mike Wests, then you have to remember to rename all the extensions of your form and page templates as described here. Else the plugin will not import as expected,in case you had already modified the plugin code. I ran into this Issue myself and I first thought that it is a plugin Bug.

Latest version v0.7

TextMateBundle     Ⓧ   DOWNLOAD for Textpattern NEW VERSION

Last modified:    Tue 20 Feb 03:32:39 2007

Total amount of downloads: 1654 times


Posted ·2006-07-24 · by · marios ·


© 2006-2008 marios buttner

send this article to a friend

send article
  1. Hi this is great.
    Nice article.

    regards marios


    — marios    02/08/2006 04:36 pm    #
  2. ysHsnf unbtipyowipd, [url=http://ddmlrvnziwcv.com/]ddmlrvnziwcv[/url], [link=http://eyonsqmxonuy.com/]eyonsqmxonuy[/link], http://zdbmwrgzrkwp.com/


    atfabpkc    16/04/2008 04:42 am    #
  Textile Help