Specifying syntax for hosts file

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
senpai71
Posts: 4
Joined: Thu Feb 16, 2006 8:13 pm

Specifying syntax for hosts file

Post by senpai71 »

I'm trying to see whether it's possible to define a syntax file for the hosts file (C:\Windows\System32\drivers\etc\hosts).

Since the file doesn't have a suffix, I created a new syntax file (hosts.syn) with the following:

SingleComment = #

If I open the hosts file and manually set it to use this syntax file, it works, and commented-out lines display differently.

But I can't seem to create a document class which only applies to hosts - creating a new class and specifying "Files in class hosts" as simply "hosts" doesn't work.

Image

Anyone got any great ideas?
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

IIRC the trick is to use "hosts." as Files in class pattern.
The dot was important ...
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Also check whether another document class fits the file name - in my textpad, the text document class matches for "*.".
IIRC the classes are checked from bottom to top - first hit wins ...
(and I don't see any chance to change the order ...)
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

The dot in the filename is not required.

As MudGuard suggests, you can remove the entry:
Configure | Preferences... | Document Classes | Text | Files in class | *.

Alternatively, you can give the class a name, for example, ~ hosts, that places it lexicographically after all the other classes.
senpai71
Posts: 4
Joined: Thu Feb 16, 2006 8:13 pm

Post by senpai71 »

Thanks @ben_josephs and @MudGuard - I simply removed the *. entry from the TXT class, and it's all working fine.
Post Reply