Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-10-16 11:28:20

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Finally a text editor on windows to rival TextMate!

I’m just so delighted with this I though I’d share it. It really is sublime :)

sublimetext.com

Offline

#2 2009-10-16 12:19:47

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Finally a text editor on windows to rival TextMate!

Thanks! looks great!

It works fine on Linux with wine !

Offline

#3 2009-10-16 12:37:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Finally a text editor on windows to rival TextMate!

Thanks for sharing. Looks pretty sweet, even if you’re supposed to pay for it ;-)

However, I have one specific requirement of the syntax highlighter (usually for PHP) in my text editors: it must highlight the code properly regardless of whether the code has <?php ... ?> markers or not.

Back story: when editing plugins I tend to keep a file in my local directory that holds just the raw PHP code. I edit it in my local text editor and when I’m happy, do CTRL-A, CTRL-C, then paste it into the Plugin Composer’s Edit window, and hit Save. To me, that’s the fastest way to effect changes to plugin code. But code in that field in the TXP database cannot have the <?...?> markers around it because of the way it is eval()d. So I deliberately omit them in all my raw source files. And that causes 99% of Syntax Highlighters to go… huh??

Yes I could edit code in the plugin template format and therefore have the markers in it but that has two drawbacks: 1) if I’m copying and pasting code to the Plugin Composer I can’t CTRL-A because it has all the header info and docs in the file; 2) I have to mess with FTP after saving and that involves mouse clicks which slow me down (sidenote: since I hit CTRL-S to save the file around every 30 seconds or so, editing it ‘directly’ on the server using the auto-FTP facility in the text editor is not an option either because it’d be forever uploading half-done code full of syntax errors, plus it’s slow having to wait for an upload every time I save: I only want to upload when I’m done editing).

I have only found one Windoze-based text editor in the galaxy (ConText) that can do syntax highlighting based on file extension. SublimeText, pNotepad, Notepad++, Notepad2, Textpad, PSPad, EditPlus, Crimson, jEdit, UltraEdit, PFE… I’ve tried them all and none of them can do it — even if you ‘force’ the syntax highlighting to be PHP it will not highlight the code unless you add the markers to the text itself. Madness! I even tried hacking some of the syntax files to see if I could get round it and contacting the developers of some of the better tools, but have not managed it yet, nor had any feedback. I guess it’s just me that works this way…

If anyone has found a way of making SublimeText or any other decent text editor do this, please share. Can’t believe something as simple as “if file extension is .php and markers not present, assume php syntax highlighting” can only be done by one (pretty good and free) text editor in the world :-)

Last edited by Bloke (2009-10-16 12:39:42)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2009-10-16 12:52:02

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Finally a text editor on windows to rival TextMate!

Bloke

I’m using notepad++ with itsalltext and I had the same problem.
My solution (at least with notepadd++) is to write at the beginning of the plugin php code this: //<?
Maybe it’s not elegant but works ok.

Offline

#5 2009-10-16 12:58:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Finally a text editor on windows to rival TextMate!

redbot wrote:

My solution (at least with notepadd++) is to write at the beginning of the plugin php code this: //<?

Hey, nice tip — thanks! I never thought of commenting it out. Just figured it wouldn’t work cos it’d need to be the first thing in the file. I’ll give it a spin when/if I get annoyed with ConText and go through the motions of finding a decent replacement.

Thank you.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2009-10-16 13:01:16

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Finally a text editor on windows to rival TextMate!

Bloke, in the menus :

View>Apply syntax highlighting>Open all with current extensions as…

does this do what you want?

I don’t have PSPad right now but if I remember well it can do it too. Not sure.
It’s easy to tweak the options in Code browser, I do that for .txp files written by cnk_versioning.

Last edited by PascalL (2009-10-16 13:03:47)

Offline

#7 2009-10-16 13:07:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,293
Website GitHub

Re: Finally a text editor on windows to rival TextMate!

PascalL wrote:

View>Apply syntax highlighting>Open all with current extensions as… does this do what you want?

Sadly no. I got all excited (yes I have no life…) when I saw that option earlier but it still requires the <? start marker to render the syntax highlighting. Note also that PHP is missing from the list (?!). Bizarrely, it seems that the HTML highlighter is the one to use for PHP.

I’ll take a look at CodeBrowser, it’s not one I’m familiar with. Thanks.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2009-10-16 13:16:10

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Finally a text editor on windows to rival TextMate!

Note also that PHP is missing from the list (?!). Bizarrely, it seems that the HTML highlighter is the one to use for PHP.

Raaah missed!, you’re totally right! sad!

I’ll take a look at CodeBrowser, it’s not one I’m familiar with. Thanks.

It’s a code folder. Very nice and clever! Not good if you like to have all your code visible at once.

To do what you want, go to
Tools>Options>Configurations>Php and change the “patterns” option.

Last edited by PascalL (2009-10-16 13:23:31)

Offline

#9 2009-10-16 13:30:02

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Finally a text editor on windows to rival TextMate!

I know this is slightly off-topic but parhaps someone can find these tips useful.

As I said I’m using notepad++ (or gedit on ubuntu) + itsalltext!

First useful thing is to set itsalltext options to show textareas content directly with .xml hilighting. This has the following advantages:
  • txp forms and page have automatic sintax hilighting
  • simple text shows as simple text
  • plugin’s php code (using the plugin composer) is shown in xml too (not good) but if you use the tip I said before (//<?) you simply have to change the language to php and all is ok

If you use cnk_versioning you can set notepad++ preferences so to open all files with extension “txp” (applied by cnk_versioning) as if they were xml files so as soon as they are opened they are perfectly hilighted

P.S. If I remember correctly the //<? trick works with gedit too

Last edited by redbot (2009-10-16 13:30:56)

Offline

#10 2009-10-16 14:01:16

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Finally a text editor on windows to rival TextMate!

redbot wrote:

If I remember correctly the //<? trick works with gedit too

Yes it does :) Thanks for the tip(s), I use gedit all the time.

Offline

#11 2009-10-16 14:36:40

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Finally a text editor on windows to rival TextMate!

I don’t have PSPad right now but if I remember well it can do it too. Not sure.

answer to myself: it can !

Bloke, try PSPad again, go to…
Settings>Program settings>Multihighlighter
>uncheck “PHP

Last edited by PascalL (2009-10-16 14:37:46)

Offline

#12 2009-10-16 15:19:48

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Finally a text editor on windows to rival TextMate!

FireFusion wrote:

I’m just so delighted with this I though I’d share it. It really is sublime :)

When I saw your headline, I thought you meant Vim :). (It’s better than TextMate though.)

Offline

Board footer

Powered by FluxBB