Sublime Forum

RTF plugin

#1

Hi,
I’m brand new to this product (and forum)
I’m wondering if exists an rtf plug in, that could trat this kind of file.
For my work, I need to insert a variable name, inside a pre-formatted .rtf. I need to work with text editor, because if I open it with MS WOrd, it insert many trash info that let my file invalid.
So I’m looking for a text editor that could format (visiby: i.e. made the rtf code coulored) the text.

Is there somethings?

TIA

Renato

1 Like

#2

Nobody knows ? I just would know if is there somethings or I am completely out off road

TIA

Renato

0 Likes

#3

Hi,
just now a friend of mine, told me that using a Ruby on Rails syntax, I could produce the same effect for a script language (Taskjuggler)
I’m wondering if could this tip be used also for RTF. I mean: do exist a filter for a language that could be compatible with RTF?

Renato

0 Likes

#4

Sublime Text isn’t a word processor, it’s a text editor. It deals with text files, not binary files such as rtf, doc or similar.

0 Likes

#5

@quarnster: RTF (Rich Text Format) is a text based format, not a binary format. It is used to represent documents with formatting and images like a Word .doc file, but it is plain text in its native format.

An RTF file is a swamp of backslashes, keywords and nested curly braces that would very much benefit from syntax highlighting.

For example, the DropBox “Getting Started.rtf”:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\f0\fs20 Welcome to Dropbox!\par
\par
Unlike other programs, Dropbox doesn't have a complicated interface to learn. It's built right into your desktop!  Here's how to get 
started:\par
\par
\b Step 1: \b0  Drag and drop any file or folder into your Dropbox folder.\par
\par
\b Step 2: \b0  Once your file/folder is inside your Dropbox folder, the program immediately starts syncing it to our secure servers.  
Once this has finished, the file's icon is marked with a green check.  Your file is now safely backed up online and also accessible from 
the Dropbox website. (http://www.getdropbox.com)\par
\par
\b Step 3:\b0   Install Dropbox (http://www.getdropbox.com/install) on other computers you use, and they'll also receive a copy of the 
files you've put in your Dropbox.\par
\par
That's it!    Now that Dropbox is watching your file, any changes you make will sync up instantly and automatically.  This gives you the 
freedom to work on any computer you choose. For more help adding files to Dropbox, see here: https://www.getdropbox.com/help/90\par
\par
Happy Dropboxing!\par
- The Dropbox Team\par
\par
\par
}

@renareto, I didn’t find any syntax coloring files for RTF after a brief search, but you could try some of the ones included with Sublime to see if you find one that is useful. The one called “Rd (R Documentation)” seems to pick up on words following a backslash, which sort of highlights RTF keywords. If you look at its file, (C:\SublimeText2\Data\Packages\R\Rd (R Documentation).tmLanguage on my system) you may be able to work out how to make it handle other parts of RTF too.

0 Likes

#6

Hi ToddFiske,
thank you for the reply.
As you said, I want to deal with the .rtf text (I mean not the format, for that I will always use the various wordxxx)
Now I will look what you told me, and I will let you know.

Thank you

Renato
ps
I’m not able to find this file tmLanguage. Is this the name of the file?

0 Likes

#7

Hi Renato,

tmLanguage is a filename extension. You will find these files in the subdirectories under your Packages folder. The location of that depends on what platform you’re on, and how you installed Sublime. I’m on Windows and use the portable version, so I made a C:\SublimeText2 folder with a Data folder in it, and just extract each new zip file into there. If you used the installer, your Packages folder will end up in your APPDATA path, which would be something like C:\Users<your-username>\AppData\Roaming\Sublime Text 2\Packages.

tmLanguage files (which come from TextMate) are XML files that give scope names to blocks of text that are matched by various regular expression. The one I mentioned is “Rd (R Documentation).tmLanguage” under the R package (in the folder Packages\R).

For better descriptions of these things and more, check out these pages:

Settings — Sublime Text Unofficial Documentation
docs.sublimetext.info/en/latest/ … tings.html

Reference: Syntax Definitions — Sublime Text Unofficial Documentation
docs.sublimetext.info/en/latest/ … xdefs.html

Extending Sublime: Syntax Definitions — Sublime Text Unofficial Documentation
docs.sublimetext.info/en/latest/ … xdefs.html

To try out different syntax definitions, load your rtf file then click on the syntax name in the lower right corner of the Sublime window (may say “Plain Text” at first). You will see a large menu of choices. The R option is a sub-menu from which you can choose Rd (R Documentation).

Todd

0 Likes