Hi,
I got a couple of suggestions.
First of all, open URL: I'm used to clicking on a URL in a text and go to that URL in a webbrowser. In Mac OS 9, there was an extension that allowed to do that by command-clicking on any URL. In Mac OS X virtually all text editors or text viewers, if you right-click on a URL, you get a menu which (among others) says "Open URL". Try BBEdit, SubEthaEdit, Stickies, or TextEdit. They all have this feature. Except for TextMate. Perhaps I can create it using "Filter Through Command...", but that's clumsy. I suggest to add this feature like in all other editors.
Second, Diff's: Well, this has been discussed on the list before. The diff function in TextMate is not really useful. Actually, Compare Texts is still the only thing I use BBEdit for. Even though Apple's FileMerge does a better job of showing the diff's (much better then either BBEdit or TextMate), BBEdit most definately has the best integration of viewing AND editing diffs, as well as ignoring line endings and white space (TextMate diff can't handle anything but unix line endings). This is very high on my wish-list for TextMate.
Last, draffing URL's: Dragging. I struggled long to understand "DragCommands" (there is not useful mention of them in the help or on the wiki). I would love to be able to make a DragCommand that allows me to drag a URL to a HTML text file, and that the drag then automatically inserted a <a href="$URL">$name</a>, preferable with the previous selection as the $name. However, it seems that now, DragCommands only work on files, not on other drags like URL's and images.
Oh, sorry if I sound critical. I love TextMate. I really adore the UTF-8 support (actually that was the single most important reason for me to make the switch to TextMate as my default editor). Keep up the good work!
Regards, Freek Dijkstra
Ah,
Forgot another suggestion: Force Open with TextMate I often am editing files in a folder, with the folder opened in a project tab. Sometimes a files has no extension (e.g. a configuration file or a "README" or "CHANGES" file), and when I double click it (in the project tab), TextEdit opens another editor, like TextEdit. I would appreciate an item in the contextual menu when I right-click such a file "Open With TextMate", which just opens it in TextMate, rather then in the external editor.
Regards, Freek
PS: Sorry about the double post just yet. Feel free to flame me, as long you do that off-list ;-)
On 9/12/2005, at 22:33, Freek Dijkstra wrote:
[...] when I double click it (in the project tab), TextEdit opens another editor, like TextEdit. I would appreciate an item in the contextual menu when I right-click such a file "Open With TextMate"
Single-click opens it in TextMate, double-click in the Finder-- assigned application. In addition you can right-click and select “Open «file» in New Window”.
Allan Odgaard wrote:
On 9/12/2005, at 22:33, Freek Dijkstra wrote:
[...] when I double click it (in the project tab), TextEdit opens another editor, like TextEdit. I would appreciate an item in the contextual menu when I right-click such a file "Open With TextMate"
Single-click opens it in TextMate, double-click in the Finder--assigned application. In addition you can right-click and select “Open «file» in New Window”.
No, it doesn't. It highly depends on the type of file. Today, I spent 15 minutes to find a reproducible example, but couldn't find one.
Thankfully, the file "misc" mentioned by Owen in his mail just yet is such an example -- there seems no way to open that in TextMate if it is in a drawer, and that is Very Annoying, since I-Know-It-Is-a-Text-File, And I-Am-The-User-And-I-Am-Alway-Right ;-)
So even if TextMate thinks it can't open a file (for whatever reasons), I still propose to have a contextual-menu options which tells textMate to just open it.
Regards, Freek
On 12/12/2005, at 0.08, Freek Dijkstra wrote:
Allan Odgaard wrote:
Single-click opens it in TextMate, double-click in the Finder-- assigned application. In addition you can right-click and select “Open «file» in New Window”.
No, it doesn't. It highly depends on the type of file. Today, I spent 15 minutes to find a reproducible example, but couldn't find one.
Right click on the file and 'treat as text file' or whatever it's called? Textmate keeps a list of extensions it considers text files. This might of course be a problem with no-extension files, I am not sure.
-- Sune.
Sune Foldager wrote:
On 12/12/2005, at 0.08, Freek Dijkstra wrote:
Allan Odgaard wrote:
Single-click opens it in TextMate, double-click in the Finder--assigned application. In addition you can right-click and select “Open «file» in New Window”.
No, it doesn't. It highly depends on the type of file. Today, I spent 15 minutes to find a reproducible example, but couldn't find one.
Right click on the file and 'treat as text file' or whatever it's called? Textmate keeps a list of extensions it considers text files. This might of course be a problem with no-extension files, I am not sure.
It's specifically about files without an extension. Though I attempt to give all files I create a good extension, some files just don't have one by default, like the "README" and "INSTALLATION" files you sometimes see in a freshly downloaded folder with source files.
Of course, I can quickly go to the finder and rename the file, but that would more or less defeat the ease-of-use of TextMate.
In those cases I get a contextual menu with these options: New File... Add Existing Files... Rename... Remove Selected Files... -- Open Selected File in New Window (disabled) Reveal "README" In Finder No Alternative Application for "README" (disabled) Show Information... (disabled) -- New Folder Group Selected Files (disabled) -- Treat Files with ".txt" as Text (disabled)
The "Treat Files with ".txt" as Text" shows the extension of the previously selected file, which in this case was a .txt file, but if I previously had selected a .doc file, it would have said ".doc" and still be disabled. A slight visual bug, nothing serious.
Note that a missing file extension is not the only reason why TextMate does not want to open the file. For example, I downloaded Owen's file:
mkdir testfolder; cd testfolder wget http://backspaces.net/files/misc head misc > misc1
If I then open testfolder (i.e. "mate testfolder"), I get a drawer with misc and misc1. TextMate opens misc1 without problems, but refuses to display the content of misc. "file" give the same result for both files: "Bourne shell script text executable".
Regards, Freek
On 12/12/2005, at 0:55, Freek Dijkstra wrote:
It's specifically about files without an extension. Though I attempt to give all files I create a good extension, some files just don't have one by default, like the "README" and "INSTALLATION" files you sometimes see in a freshly downloaded folder with source files. [...]
When a file is w/o extension TextMate (heuristically) scans to see if it's text, and if so, opens the file. So README and INSTALLATION should give you no problems.
Note that a missing file extension is not the only reason why TextMate does not want to open the file. For example, I downloaded Owen's file: [...]
Which is indeed missing a file extension and fails the “is this text”- test because at line 667 it contains a 0x08 character (bs) -- found using a regexp search for: [\x{00}-\x{1F}&&[^\s]].
I'll try to make it more liberal wrt allowing control characters in text.
[...] "file" give the same result for both files: "Bourne shell script text executable".
That's not based on the file extension.
Thanks, Allan!
Based on your excellent feedback, I was able to determine the problem.
When a file is w/o extension TextMate (heuristically) scans to see if it's text, and if so, opens the file. So README and INSTALLATION should give you no problems.
The problem was a 0x0C character (signifying a page break).
I'll try to make it more liberal wrt allowing control characters in text.
Thanks!
[...] "file" give the same result for both files: "Bourne shell script text executable".
That's not based on the file extension.
A bit off-topic. I'm aware of that. In fact, I would not recommend using the output of "file" for a decision, since it is based on the "magic" file, and I have found that this magic file can differ considerably between installations.
Regards, Freek
On 09 Dec 2005, at 22:04, Freek Dijkstra wrote:
Hi,
I got a couple of suggestions.
First of all, open URL: I'm used to clicking on a URL in a text and go to that URL in a webbrowser. In Mac OS 9, there was an extension that allowed to do that by command-clicking on any URL. In Mac OS X virtually all text editors or text viewers, if you right-click on a URL, you get a menu which (among others) says "Open URL". Try BBEdit, SubEthaEdit, Stickies, or TextEdit. They all have this feature. Except for TextMate. Perhaps I can create it using "Filter Through Command...", but that's clumsy. I suggest to add this feature like in all other editors.
For this there is "Open URL" in the Services menu, look at this hint to assign a shortcut to it: http://www.macosxhints.com/article.php?story=20040416191600412
The hard part is to find an available shortcut...
-- Fred
On 12/9/05, Fred B. fredb7@starflam.com wrote:
On 09 Dec 2005, at 22:04, Freek Dijkstra wrote:
First of all, open URL: I'm used to clicking on a URL in a text and go to that URL in a webbrowser.
For this there is "Open URL" in the Services menu, look at this hint to assign a shortcut to it: http://www.macosxhints.com/article.php?story=20040416191600412
It's also easy to make a custom command to open the selected URL. I put one inside my Text bundle. Here's the entire thing:
open "$TM_SELECTED_TEXT"
Both of these solutions do require the URL to be selected first. A version that didn't require that (i.e. you could simply place the caret inside the URL) would be nice, but a bit more work.
pb
-- Paul Bissex http://e-scribe.com/news/ Northampton MA USA 01061-0847
First of all, open URL: I'm used to clicking on a URL in a text and go to that URL in a webbrowser.
For this there is "Open URL" in the Services menu, look at this hint to assign a shortcut to it: http://www.macosxhints.com/article.php?story=20040416191600412
It's also easy to make a custom command to open the selected URL. I put one inside my Text bundle. Here's the entire thing:
open "$TM_SELECTED_TEXT"
Both of these solutions do require the URL to be selected first. A version that didn't require that (i.e. you could simply place the caret inside the URL) would be nice, but a bit more work.
Thanks for both hints! However, I still prefer to have a "Open URL" in a contextual menu, for two reasons: 1. I can still use it without assigning a shortcut key (I admit that I probably am a minority, given TextMate heavily key-based operation, but I do like to use my mouse) 2. I think it is less clumsy then the other options, e.g. (a) hack /System/Library/CoreServices/SystemUIServer.app/Contents/Info.plist (as the macosxhints suggests; I don't mind hacking /Library, but DO mind hacking /System). (b) Install ICeCoffEE (which provides system-wide ⌘-click behaviour, but forces to install Application Enhancer (APE)) (c) Forces me to first select the URL. 3. It is in-line with other Editors, like Apple's TextEdit, Apple's Stickies, BareBones' BBEdit, TheCodingMonkeys' SubEthaEdit, TeXShop, -- in short most other editors I know of :-)
As a side-note: This is what the readme of ICeCoffEE told on this subject:
Apple has provided ⌘-click URL opening in Mac OS X 10.2 and later in two places.
Apple’s Multilingual Text Editor (MLTE) service lets you ⌘-click URLs to open them. Apple’s FileMaker Pro 7 is an example of an application which uses MLTE.
Terminal lets you use ⌘-double-click URLs to open them.
I'm fine with either way (context menu with "Open URL", ⌘-click or ⌘-double-click); alternatively, I recommend that TextMate does not underline URL's if it does not threat them special -- I found it utterly confusing that I got a visual clue that they were special, but could not act upon that.
Regards, Freek
On 12/12/2005, at 0:41, Freek Dijkstra wrote:
However, I still prefer to have a "Open URL" in a contextual menu, for two reasons:
When the activation scheme of bundle items gets expanded to support mouse gestures, this will be possible. But it's long term.
Allan Odgaard wrote:
On 12/12/2005, at 0:41, Freek Dijkstra wrote:
However, I still prefer to have a "Open URL" in a contextual menu, for two reasons:
When the activation scheme of bundle items gets expanded to support mouse gestures, this will be possible. But it's long term.
Thanks!
In the mean time, is there a variable which returns the full word at the place the caret is located, rather then the selected text?
Regards, Freek
On 12/12/2005, at 8:42, Freek Dijkstra wrote:
In the mean time, is there a variable which returns the full word at the place the caret is located, rather then the selected text?
TM_CURRENT_WORD but this is defined by word characters, so if this is to grab the URL you probably want to extract it from TM_CURRENT_LINE instead, using TM_COLUMN_NUMBER as the carets offset into the line. Using the regexp from the plain text grammar (to underline links) a command would be something like:
open $(perl -pe <<<$TM_CURRENT_LINE "s/.{0,$TM_COLUMN_NUMBER}((https?| ftp|mailto):\S+?)(?=[)>,.':;"]*(\s|$)).*/$1/")