An editor with syntax highlight

How to do that? Use TextField somehow? I do not want HTMLEditor, as it has to be a plain text.

What kind of syntax highlighting do you want to achieve?
After the text has been edited and syntax highlighted how to you plan to convert it to plain text without losing the syntax highlighting?

Similar Messages

  • HTML editor with syntax highlighting and UTF-8 support

    In an ongoing effort to move our lives into the cloud and into our pockets (and as a part of an article series for a tech blog), me and a friend are trying to completely replace the need for computers with our iPhones.
    In some ways, it is going splendidly (Documents to Go Premium + foldable bluetooth keyboard = all my writing needs as a journalist solved). In others, concessions have to be made (as a practicing musician, my options are a bit limited, but with the help of Xewton Music Studio, Multitrack DAW/NanoStudio, etc, I can at least lay down some basic tracks, create basic MIDI compositions, etc).
    However, there is one area in where we’ve made no headway at all. My friend has the great misfortune of being blessed with logic , and therefore, unlike me, does honest programming and web app designing work. And as far as we know, there is not a single HTML/script editor with more than just the bare, basic functions in the app store.
    What we need is this:
    * Syntax highlighting
    * Support for UTF-8
    A built-in FTP editor would be a nice bonus, but is not essential.
    We found one for the iPad, but when we contacted the company behind the app, they revealed no immediate plans for an iPhone version. (They felt coding on the iPhone was, at best, impractical, but they did concede the fact that if there are indeed users who have that need, the existence of an iOS HTML editor would be justified, and possible lucrative, regardless of their feelings on the matter. On that ground, they promised to examine the possibilities to port their iPad app in the future, but so far, no signs.)
    Does anyone know of such an app? Rest assured your assistance will be mentioned in the article series should you point us in the right direction

    Unfortunately, my friend has offered his iPhone an ultimatum. No syntax highlighting, no computer replacement. It is strange that such as standardized feature has not found its way into any known HTML editor for iOS.
    But FTPOntheGo seems to be a great app in general, so thanks!

  • Best strategy for creating a Code Editor (w/ syntax highlighting) in flash

    I'm looking into creating a javascript code editor in flash. I would light to include syntax highlighting and am eliciting suggestings on how best to approach it.
    Here are my thoughts so far:
    I don't see anything pre-built, so I'll have to do it myself, am I wrong here?
    I have seen as3syntaxhighlihgt which will take code and turn it into a highlighted HTML file, but not sure whether or not I could find a way to combine that with a text editor that could support html???
    Thanks for any input that can help guide me.
    David

    After more research I've answered this one myself. For anyone else comming across this thread here is what I found:
    as3syntaxhighlight is a good option for code highlighting in flash, see the demo at:
    http://anirudhs.chaosnet.org/blog/2009.01.12.html
    It embeds very easily and quickly.
    Other options exist for editors built in JS that could potentially be ported:
    http://en.wikipedia.org/wiki/Comparison_of_Javascript-based_source_code_editors

  • Editor for ASP with syntax highlighting? (I use Bluefish)

    Is there a decent, simple (or not-so-simple) editor for ASP code?  Or, is there a way to get Bluefish to highlight ASP correctly?
    Don't suggest VIM.  I love it, but I haven't learned the intricacies of it yet. 
    And, yes, I apologize for writing ASP... 

    Hi,
    this is a short introduction, might help at start:
    Starts with some generell settings, please note that I just add these
    settings to the files in /usr/share/scite, most of the stuff can also be set in
    files in your ~. Refer to scite docs for filenames onn that.
    SciTEGlobal.properties: general settings which are mostly scattered over
    the file. Find the lines and tweak them.
    # I like my Scite with tabs and a statusbar, displaying line and column
    tabbar.visible=1
    tabbar.hide.one=1
    tabbar.multiline=1
    statusbar.visible=1
    #comment out this line to have it displayed under the textfield not besides
    #split.vertical=1
    #display line numbers (create enough space for 4 digits)
    line.margin.visible=1
    line.margin.width=4
    # ask b4 automatically reload an altered file on disk
    are.you.sure.on.reload=1
    # show name and number of my tab in titlebar
    title.full.path=1
    title.show.buffers=1
    # save the buffer state in a file
    and reload on startup
    save.recent=1
    save.session=1
    load.on.activate=1
    # allows 25 tabs
    buffers=25
    # I plain hate tabs and using 8 spaces is waste of place
    # converts tab hits to spaces
    tabsize=2
    indent.size=2
    use.tabs=0
    # some sane fontsettings: - the ! activates pango -> AA fonts
    # sets them all to similar sizes and monospace font
    # after the if PLAT_GTK these must be tabs in intendation!
    if PLAT_GTK
    font.base=font:!bitstream vera sans mono,size:9
    font.small=font:!bitstream vera sans mono,size:8
    font.comment=font:!bitstream vera sans mono,italics,size:9
    font.code.comment.box=$(font.comment)
    font.code.comment.line=$(font.comment)
    font.code.comment.doc=$(font.comment)
    font.text=font:!bitstream vera sans mono,size:9
    font.text.comment=font:!bitstream vera sans mono,size:8
    font.embedded.base=font:!bitstream vera sans mono,size:9
    font.embedded.comment=font:!bitstream vera sans mono,size:9
    font.monospace=font:!bitstream vera sans mono,size:9
    font.vbs=font:!bitstream vera sans mono,italics,size:9
    # uuh, netscape - long time not seen, replce with firefox
    if PLAT_GTK
    command.print.*=a2ps "$(FileNameExt)"
    command.scite.help=mozilla-firefox "file://$(SciteDefaultHome)/SciTEDoc.html"
    # add a vertical line at column 80
    edge.column=80
    edge.mode=1
    edge.colour=#E0E0E0
    go on to html.properties file; to get the advantages you need the php.api
    and the phpfunctions.properties from http://scintilla.sourceforge.net/SciTEExtras.html
    there you also find api files for ASP
    #replace netscape with mozilla-firefox again
    if PLAT_GTK
    command.go.$(file.patterns.web)=mozilla-firefox "file:///$(FilePath)"
    # load the .api file which I downloaded from the web; it contains, per line,
    # a short explaination of each command
    # $file.patterns.php is defined for *.php and friends by file extensions
    api.$(file.patterns.php)=$(SciteDefaultHome)/php.api
    # the calltips for the hypertext lexer shall not be case sensitive
    calltip.hypertext.ignorecase=1
    # define how the calltipps should be parsed, the following is the same as
    # the standard anyway, but might be overwritten by some people in SciTEGlobal
    calltip.hypertext.parameters.start=(
    calltip.hypertext.parameters.end=)
    calltip.hypertext.parameters.separators=,
    # some calltips have an additionally explaination after the final ")"
    # -this makes display them in a second line
    calltip.hypertext.end.definition=)
    # autocopleter stuff
    # defines which type of characters let the autocompletion pop up
    autocomplete.hypertext.start.characters=_$(chars.alpha)
    # also the autocompletion should not be case sensitive since, grrr php and html
    autocomplete.html.ignorecase=1
    # extend the "Extras" menu with some commands
    # Tidy Checking
    command.name.1.$(file.patterns.web)=HTML Tidy Validate
    command.1.$(file.patterns.web)=tidy -quiet -errors $(FilePath)
    error.select.line=1
    # Tidy Cleanup and indent
    command.name.2.$(file.patterns.web)=HTML Tidy Cleanup
    command.2.$(file.patterns.web)=tidy -i -wrap 80 -m $(FilePath)
    # the executed command alternates the file, so it should be saved b4 and must be
    # re-read -> activate are.you.sure.on.reload=1 , makes things easier to handle
    # !!!! THERE IS NO UNDO ON THIS COMMAND !!!!
    command.save.before.1.$(file.patterns.web)=1
    command.is.filter.2.$(file.patterns.web)=1
    # activate a lint checker for php files
    command.name.1.$(file.patterns.php)=Check PHP syntax
    command.1.$(file.patterns.php)=php -l $(FilePath)
    the tidy doesn't work onClick, but it shows you the errors in line and column
    some pictures to show stuff:
    the gray edge at column 80 and the php-lint checker in action:
    autocomplete code:
    the calltip, NOTE: it is wrapped after the ) which was our setting:
    calltip.hypertext.end.definition=)
    and the delimiter , let highlight the the correct argument:
    whoever want's jump in and wikify that, go ahead, leave me a note where
    I shall help.
    -neri

  • Syntax Highlighting for MATRIXx MathScript and TPL

    There have been some questions about text editors for MATRIXx, so I wanted to let everyone know about an application note that we just posted. It describes how to configure a syntax highlighter for use with MathScript and Template Programming Language (TPL). There is also an example of how Crimson Editor can be configured. I choose Crimson Editor because it was free, but the same thing can be done in other syntax highlighters. Using a syntax highlighter makes MATRIXx code a lot easier to read.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/C43375149CB01C3186256E530081EAA5
    While I am at it, I am going to point out some other resources. The application note is located on Developer Zone section of our website, where
    you can find other MATRIXx examples and tutorials:
    http://zone.ni.com/devzone/devzone.nsf/webcategories/A92DB8BA2DE149F486256CBC00655A0C?opendocument
    If you have code or examples that you want to share with other users you can submit the example to the Example Code Library:
    http://www.ni.com/devzone/dev_exchange/ex_search.htm
    Suggestions and feedback can be submitted from Product Feedback section of Contact NI:
    http://sine.ni.com/apps/we/nicc.call_me?p_action=country&p_lang_id=US
    And of course the main MATRIXx page is:
    http://www.ni.com/matrixx
    Carl L
    National Instruments

    I found another editor with syntax highlighting capabilities for MATRIXx. The editor is VIM which is based on the Unix VI editor, and is available on both Solaris and Windows.
    www.vim.org
    Carl L
    National Instruments
    www.ni.com/matrixx

  • Syntax Highlighting and Undo Problem

    Hello Guys. I am working ona very simple type of Java Code Editor with syntax highlighting feature. It works fine as far as the syntax highlighting, cut, copy, paste etc are concerned but when I added Undo, Redo feature, it was not working as Undo Redo should. The UndoManager first removes the text attributes and finally the main Undo job. For example if I paste word public , the UndoManager will first remove the attributes and after about third or fouth click on the Undo button removes the pasted word.
    Please Help.

    Here's the complete demo code.
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    import javax.swing.text.rtf.*;
    import javax.swing.undo.*;
    class ColorTextInTextPane extends JFrame implements UndoableEditListener
         private Hashtable keywords,impclasses;
         JEditorPane edit;
         UndoManager undo;
         JButton undoIt, redoIt;
         JPanel southButtonPanel;
         MyDocument doc = new MyDocument();
         public ColorTextInTextPane()
              super("ColorTextInTextPane");
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              edit = new JEditorPane();
              edit.setEditorKit(new StyledEditorKit());
              edit.setEditable(true);
              doc.addUndoableEditListener(this);
              edit.setDocument(doc);
              JScrollPane scroll=new JScrollPane(edit);
              undo = new UndoManager();
              undoIt = new JButton("Undo");
              undoIt.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    undoAction(ae);
              redoIt = new JButton("Redo");
              redoIt.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    redoAction(ae);
              southButtonPanel = new JPanel();
              southButtonPanel.add(undoIt);
              southButtonPanel.add(redoIt);
              getContentPane().add(scroll);
              getContentPane().add(southButtonPanel, BorderLayout.SOUTH);
              setSize(300,300);
              setVisible(true);
              Object dummyObject = new Object();
              keywords = new Hashtable();
              keywords.put( "abstract", dummyObject );
              keywords.put( "boolean", dummyObject );
              keywords.put( "break", dummyObject );
              keywords.put( "byte", dummyObject );
              keywords.put( "byvalue", dummyObject );
              keywords.put( "case", dummyObject );
              keywords.put( "cast", dummyObject );
              keywords.put( "catch", dummyObject );
              keywords.put( "char", dummyObject );
              keywords.put( "class", dummyObject );
              keywords.put( "const", dummyObject );
              keywords.put( "continue", dummyObject );
              keywords.put( "default", dummyObject );
              keywords.put( "do", dummyObject );
              keywords.put( "double", dummyObject );
              keywords.put( "else", dummyObject );
              keywords.put( "extends", dummyObject );
              keywords.put( "false", dummyObject );
              keywords.put( "final", dummyObject );
              keywords.put( "finally", dummyObject );
              keywords.put( "float", dummyObject );
              keywords.put( "for", dummyObject );
              keywords.put( "future", dummyObject );
              keywords.put( "generic", dummyObject );
              keywords.put( "goto", dummyObject );
              keywords.put( "if", dummyObject );
              keywords.put( "implements", dummyObject );
              keywords.put( "import", dummyObject );
              keywords.put( "inner", dummyObject );
              keywords.put( "instanceof", dummyObject );
              keywords.put( "int", dummyObject );
              keywords.put( "interface", dummyObject );
              keywords.put( "long", dummyObject );
              keywords.put( "native", dummyObject );
              keywords.put( "new", dummyObject );
              keywords.put( "null", dummyObject );
              keywords.put( "operator", dummyObject );
              keywords.put( "outer", dummyObject );
              keywords.put( "package", dummyObject );
              keywords.put( "private", dummyObject );
              keywords.put( "protected", dummyObject );
              keywords.put( "public", dummyObject );
              keywords.put( "rest", dummyObject );
              keywords.put( "return", dummyObject );
              keywords.put( "short", dummyObject );
              keywords.put( "static", dummyObject );
              keywords.put( "super", dummyObject );
              keywords.put( "switch", dummyObject );
              keywords.put( "synchronized", dummyObject );
              keywords.put( "this", dummyObject );
              keywords.put( "throw", dummyObject );
              keywords.put( "throws", dummyObject );
              keywords.put( "transient", dummyObject );
              keywords.put( "true", dummyObject );
              keywords.put( "try", dummyObject );
              keywords.put( "var", dummyObject );
              keywords.put( "void", dummyObject );
              keywords.put( "volatile", dummyObject );
              keywords.put( "while", dummyObject );
              Object dummyObject1 = new Object();
              impclasses = new Hashtable();
              impclasses.put( "JFrame", dummyObject1);
              impclasses.put( "Applet", dummyObject1);
                    impclasses.put( "JApplet", dummyObject1);
                    impclasses.put( "JTextField", dummyObject1);
                    impclasses.put( "JLabel", dummyObject1);
                    impclasses.put( "JPanel", dummyObject1);
                    impclasses.put( "JButton", dummyObject1);
         public void undoableEditHappened(UndoableEditEvent ev) {
        undo.addEdit(ev.getEdit());
        updateMenu();
      void undoAction(ActionEvent e) {
        try {
          if (undo.canUndo())
            undo.undo();
          updateMenu();
        catch (CannotRedoException cre) {
      void redoAction(ActionEvent e)
        try {
          if (undo.canRedo())
            undo.redo();
          updateMenu();
        catch (CannotRedoException cre) {
      public void updateMenu()
        undoIt.setEnabled(undo.canUndo());
        redoIt.setEnabled(undo.canRedo());
         public static void main(String a[])
              new ColorTextInTextPane();
         class MyDocument extends DefaultStyledDocument
              DefaultStyledDocument doc;
              MutableAttributeSet normal;
              MutableAttributeSet keyword;
              MutableAttributeSet comment;
              MutableAttributeSet quote;
              MutableAttributeSet impclasses1;
              public MyDocument()
                   doc = this;
                   putProperty( DefaultEditorKit.EndOfLineStringProperty, "\n" );
                   normal = new SimpleAttributeSet();
                   StyleConstants.setForeground(normal, Color.black);
                   comment = new SimpleAttributeSet();
                   StyleConstants.setForeground(comment, Color.green);
                   StyleConstants.setItalic(comment, true);
                   keyword = new SimpleAttributeSet();
                   StyleConstants.setForeground(keyword, Color.blue);
                   StyleConstants.setBold(keyword, true);
                   quote = new SimpleAttributeSet();
                   StyleConstants.setForeground(quote, Color.red);
                   StyleConstants.setBold(quote, true);
                   impclasses1 = new SimpleAttributeSet();
                   StyleConstants.setForeground(impclasses1, Color.magenta);
                   StyleConstants.setBold(impclasses1, true);
              public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
                   super.insertString(offset, str, a);
                   processChangedLines(offset, str.length());
              public void remove(int offset, int length) throws BadLocationException
                   super.remove(offset, length);
                   processChangedLines(offset, 0);
              public void processChangedLines(int offset, int length) throws BadLocationException
                   String content = doc.getText(0, doc.getLength());
                   Element root = doc.getDefaultRootElement();
                   int startLine = root.getElementIndex( offset );
                   int endLine = root.getElementIndex( offset + length );
                   for (int i = startLine; i <= endLine; i++)
                        int startOffset = root.getElement( i ).getStartOffset();
                        int endOffset = root.getElement( i ).getEndOffset();
                        applyHighlighting(content, startOffset, endOffset - 1);
              public void applyHighlighting(String content, int startOffset, int endOffset)
                   throws BadLocationException
                   int index;
                   int lineLength = endOffset - startOffset;
                   int contentLength = content.length();
                   if (endOffset >= contentLength)
                        endOffset = contentLength - 1;
                   //  set normal attributes for the line
                   doc.setCharacterAttributes(startOffset, lineLength, normal, true);
                   //  check for multi line comment
                   String multiLineStartDelimiter = "/*";
                   String multiLineEndDelimiter = "*/";
                   index = content.lastIndexOf( multiLineStartDelimiter, endOffset );
                   if (index > -1)
                        int index2 = content.indexOf( multiLineEndDelimiter, index );
                        if ( (index2 == -1) || (index2 > endOffset) )
                             doc.setCharacterAttributes(index, endOffset - index + 1, comment, false);
                             return;
                        else
                        if (index2 >= startOffset)
                             doc.setCharacterAttributes(index, index2 + 2 - index, comment, false);
                             return;
                   //  check for single line comment
                   String singleLineDelimiter = "//";
                   index = content.indexOf( singleLineDelimiter, startOffset );
                   if ( (index > -1) && (index < endOffset) )
                        doc.setCharacterAttributes(index, endOffset - index + 1, comment, false);
                        endOffset = index - 1;
                   //  check for tokens
                   checkForTokens(content, startOffset, endOffset);
              private void checkForTokens(String content, int startOffset, int endOffset)
                   while (startOffset <= endOffset)
                        //  find the start of a new token
                        while ( isDelimiter( content.substring(startOffset, startOffset + 1) ) )
                             if (startOffset < endOffset)
                                  startOffset++;
                             else
                                  return;
                        if ( isQuoteDelimiter( content.substring(startOffset, startOffset + 1) ) )
                             startOffset = getQuoteToken(content, startOffset, endOffset);
                        else
                             startOffset = getOtherToken(content, startOffset, endOffset);
              private boolean isDelimiter(String character)
                   String operands = ";:{}()[]+-/%<=>!&|^~*";
                 if (Character.isWhitespace( character.charAt(0) ) ||
                      operands.indexOf(character) != -1 )
                      return true;
                 else
                      return false;
              private boolean isQuoteDelimiter(String character)
                   String quoteDelimiters = "\"'";
                   if (quoteDelimiters.indexOf(character) == -1)
                      return false;
                 else
                      return true;
              private boolean isKeyword(String token)
                   Object o = keywords.get( token );
                   return o == null ? false : true;
              private boolean isimpclasses1(String token)
                   Object o = impclasses.get( token );
                   return o == null ? false : true;
              private int getQuoteToken(String content, int startOffset, int endOffset)
                   String quoteDelimiter = content.substring(startOffset, startOffset + 1);
                   String escapedDelimiter = "\\" + quoteDelimiter;
                   int index;
                   int endOfQuote = startOffset;
                   //  skip over the escaped quotes in this quote
                   index = content.indexOf(escapedDelimiter, endOfQuote + 1);
                   while ( (index > -1) && (index < endOffset) )
                        endOfQuote = index + 1;
                        index = content.indexOf(escapedDelimiter, endOfQuote);
                   // now find the matching delimiter
                   index = content.indexOf(quoteDelimiter, endOfQuote + 1);
                   if ( (index == -1) || (index > endOffset) )
                        endOfQuote = endOffset;
                   else
                        endOfQuote = index;
                   doc.setCharacterAttributes(startOffset, endOfQuote - startOffset + 1, quote, false);
                            //String token = content.substring(startOffset, endOfQuote + 1);
                            //System.out.println( "quote: " + token );
                   return endOfQuote + 1;
              private int getOtherToken(String content, int startOffset, int endOffset)
                 int endOfToken = startOffset + 1;
                   while ( endOfToken <= endOffset )
                        if ( isDelimiter( content.substring(endOfToken, endOfToken + 1) ) )
                             break;
                        endOfToken++;
                   String token = content.substring(startOffset, endOfToken);
                            //System.out.println( "found: " + token );
                   if ( isKeyword( token ) )
                        doc.setCharacterAttributes(startOffset, endOfToken - startOffset, keyword, false);
                   if(isimpclasses1 ( token) )
                        doc.setCharacterAttributes(startOffset, endOfToken - startOffset, impclasses1, false);
                   return endOfToken + 1;
    }

  • Syntax highlighted program code in keynote?

    Is there any easy way insert programming code (in my case Ruby code) into a slide so it shows up with syntax highlighting and formating suitable for the code?
    I.E. so it looks like the highlighted code in Textmate or other gui editors?

    TextWrangler (and thus presumably BBEdit) do preserve their syntax colouring when PDFed, as does Taco HTML Edit. My guess is that this is capability is an app-by-app feature.
    If you were desperate for a PDF output to Keynote, you could always copy the text from Textmate and paste it into the freeware TextWrangler. You would likely have to adjust the default syntax colouring to match Textmate, but that would be relatively straightforward.

  • XML Syntax Highlighting

    Hi, I need help with XML Syntax Highlighting. I try to create simple XML editor, but I have probleblems with Syntax Highlighting.
    Is there anyone who can help me?

    Here is personal recommendation, this 3rd party syntax highlight component works quite well for many JTextComponents
    Check out: http://ostermiller.org/syntax/
    ICE

  • How do I enable syntax highlighting for jspf files on Dreamweaver CS6 on Windows?

    I followed the instructions (which I modified for CS6) in this posting: http://blog.metameister.com/blog/2011/04/08/open-new-file-types-and-add-syntax-highlightin g-in-dreamweaver-cs5-on-window…
    but it did not work for CS6.
    How do I enable syntax highlighting for jspf files on Dreamweaver CS6 on Windows 7?
    cheers
    Marvin in Edmonton

    Ok, I figured it out after hunting for a few hours.
    Step 1. Add the File Type
    In Dreamweaver’s toolbar:
    Select Edit > Preferences; 
    under File Types / Editors, add .jspf to the line “Open in Code View:”.
    Step 2. Extensions.txt
    Add file type .jspf to the Extensions.txt files. There are two of these files:
    C:\Users\[username]\AppData\Roaming\Adobe\Dreamweaver CS6\en_US\Configuration
    C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS6\configuration
    Step 3. MMDocumentTypes.xml
    Add jspf to the MMDocumentTypes.xml files. Open this file in Notepad or Text Editor. Do not modify the Dreamweaver configuration files within Dreamweaver.
    There are three MMDocumentTypes.xml files to be modified: 
    C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS6\configuration\DocumentTypes
    C:\Users\mhaagsma\AppData\Roaming\Adobe\Dreamweaver CS6\en_US\Configuration
    C:\Users\mhaagsma\AppData\Roaming\Adobe\Dreamweaver CS6\en_US\Configuration\DocumentTypes\
    Step 4. Restart Dreamweaver
    Hopefully the file type will now be recognized and appear with syntax highlighting.

  • Query syntax highlighting lost when using national characters.

    Theres a minor bug with syntax highlighting. If I have a query in sqldeveloper like -
    select * from table
    where name = N'fred'
    and ... ... ...
    All the coloured syntax highlighting is lost from the N' onwards.
    Edited by: [email protected] on 24-Feb-2009 03:18

    Hi jonathanthomas,
    Since this issue is related to the web development,
    you could ask this question in the ASP.NET forum:
    http://forums.asp.net. If then, you could get
    an answer more quickly and professional. Thanks for your cooperation.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Nano syntax highlighting: catch-all syntax for configuration files

    After years of using nano, I only recently learned that it supports syntax coloring... (Why would they turn that off by default? ) Well, I thought I'll make up for it by making extra good use of it from now on...
    Unfortunately it didn't ship a highlighting syntax for the the kind of files that I use nano the most for: system configuration files.
    So I wrote my own, and after tweaking a bit here and there whenever I encountered a config file for which the highlighting wasn't satisfactory at first, I think the result is now good enough (screenshots below) that it's worth sharing with my fellow Arch users:
    Code & Instructions:
    Here is the syntax definition:
    # config file highlighting
    syntax "conf" "(\.(conf|config|cfg|cnf|rc|lst|list|defs|ini|desktop|mime|types|preset|cache|seat|service|htaccess)$|(^|/)(\w*crontab|mirrorlist|group|hosts|passwd|rpc|netconfig|shadow|fstab|inittab|inputrc|protocols|sudoers)$|conf.d/|.config/)"
    # default text
    color magenta "^.*$"
    # special values
    icolor brightblue "(^|\s|=)(default|true|false|on|off|yes|no)(\s|$)"
    # keys
    icolor cyan "^\s*(set\s+)?[A-Z0-9_\/\.\%\@+-]+\s*([:]|\>)"
    # commands
    color blue "^\s*set\s+\<"
    # punctuation
    color blue "[.]"
    # numbers
    color red "(^|\s|[[/:|<>(){}=,]|\])[-+]?[0-9](\.?[0-9])*%?($|\>)"
    # keys
    icolor cyan "^\s*(\$if )?([A-Z0-9_\/\.\%\@+-]|\s)+="
    # punctuation
    color blue "/"
    color brightwhite "(\]|[()<>[{},;:=])"
    color brightwhite "(^|\[|\{|\:)\s*-(\s|$)"
    # section headings
    icolor brightyellow "^\s*(\[([A-Z0-9_\.-]|\s)+\])+\s*$"
    color brightcyan "^\s*((Sub)?Section\s*(=|\>)|End(Sub)?Section\s*$)"
    color brightcyan "^\s*\$(end)?if(\s|$)"
    # URLs
    icolor green "\b(([A-Z]+://|www[.])[A-Z0-9/:#?&$=_\.\-]+)(\b|$| )"
    # XML-like tags
    icolor brightcyan "</?\w+((\s*\w+\s*=)?\s*("[^"]*"|'[^']*'|!?[A-Z0-9_:/]))*(\s*/)?>"
    # strings
    color yellow "\"(\\.|[^"])*\"" "'(\\.|[^'])*'"
    # comments
    color white "#.*$"
    color blue "^\s*##.*$"
    color white "^;.*$"
    color white start="<!--" end="-->"
    To install, save the above above code snippet as a file called conf.nanorc in the folder /usr/share/nano/ (or /usr/local/share/nano/ or similar if you feel strongly about the /usr <--> /usr/local separation), and then add the following to the end of the file /etc/nanorc:
    ## Configuration files (catch-all syntax)
    include "/usr/share/nano/conf.nanorc"
    Hints:
    The colors I chose look good (imo) with the terminal background and color settings that I use, but might not look good, or even readable, with yours, so simply change the color names in the code snippet to whatever you prefer - valid color names are:
    If you use a console with white background, you'll have to change at least the white color I chose for comments and punctuation.
    The first code line in the snippet includes a regular expression that defines for which file names this syntax highlighting should be used. Whenever you encounter a config file that is not matched by this, but you would still like to open it with syntax highlighting, you can manually select this syntax with nano's -Y switch, like so:
    nano -Y conf myConfigFile
    Technical Note:
    It's implemented as a single catch-all syntax, since nano chooses which syntax to apply based on the filename, and in the case of config files usually not much can be learned about the content format from the file name extension (.conf can by anything from flat key/value tuples to XML, .ini can be the official INI format or something else, etc...).
    This means that some compromises have been made, so with this highlighting syntax probably no config file looks 100% as good as a highlighting syntax that would be specifically optimized for one kind of config format, but all in all the vast majority of config files should look pretty good.
    Screenshots:
    /etc/rc.conf,  /etc/hosts:
    /etc/pacman.conf,  /etc/group:
    xorg.conf,  some .desktop file:
    httpd.conf (Apache config),  php.ini:
    More screenshots:
    /etc/fonts/fonts.conf (uses XML)
    /etc/inittab
    /etc/fstab
    /etc/inputrc
    /etc/mime.types
    /etc/protocols
    /etc/xinetd.conf
    See Also:
    nano syntax highlighting: GNU makefiles
    Update [2012-01-28]: Made some more improvements to the syntax definition (see post)
    Last edited by sas (2012-02-01 15:26:43)

    doug piston wrote:I deal with alot of .mk files and would love to see it there.
    You mean GNU makefiles?
    I'm afraid they might be out of scope for this generic config-file syntax.
    Logically they're not system config files, and technically they're a pretty specialized and complex format (different "types" of rules, rules spanning multiple lines, rules containing arbitrary Bash code, etc.).
    This is how an .mk file currently looks with this highlighting syntax:
    $ nano -Y conf /usr/lib/httpd/build/rules.mk
    And apart from highlighting variables of the form $$abc or $(abc), I'm not sure how much can be improved here without breaking the highlighting for more conventional config files.
    It would probably be better to create a specialized highlighting syntax just for .mk files.
    EDIT: I sat down and did just that, here's the result: nano syntax highlighting: GNU makefiles, and here is how the above makefile snipped looks with it:
    Last edited by sas (2012-02-01 15:18:52)

  • No syntax highlighting.

    Hi,
    I'm having problems with syntax highlighting - it doesn't work.
    If I leave a cfm file open before closing eclipse and then eclipse reopen eclipse, syntax highlighting will kick in; but as soon as I open another file no syntax highlighting.
    I'm running eclipse 3.5.2.
    Thank you,
    Kasia

    This is a known bug - the syntax highlighting in PL/SQL files only works after having opened PL/SQL from the database. See EA3: File based development - where is the syntax highlighting? for example.
    theFurryOne

  • Syntax highlighting in basic editor

    First of all. Thanks for finally upgrading the forum software. So far it looks like it works much better than the former version. However I'm not totally happy with the basic text editor.
    There is quite a lot of code posted in these forums. Is it possible to have the syntax highlighting button in the basic editor?
    It helps a lot on readability, and when this button is hidden away in the advanced editor I'm afraid that a lot of users will not find it.

    Don’t have an answer for that. Will check with Jive to see if the features of the Inline RTE are configurable.
    Thanks!

  • Syntax highlighting not working with label on if statement in fortran in Visual studio 2010

    I am having a difficult time in figuring out the syntax highlighting in Visual studio. I am using fortran code and there are labels in if statements as follows: 
                if_2003: IF (FRAC_PBED(NNSED,L).LT.0.0.AND.
         +                   FRAC_PBED(NNSED,L).GT.SMALL_NEG_NO) THEN
                  FRAC_PBED(NNSED,L) = 0.0
           TSED_PBED(1,NNSED,L) = 0.0
         END IF if_2003
    So the problem I am having is when I click on the `if` next to label `if_2003`, then I cannot use `CTRL + ]` to move to the ending `if`. If there is no label before `if`, then the shortcut is working fine. I don't know what I could do so that it would start
    behaving as it is supposed to. 
    In the contrary, when I have do loop as follows: 
        do_410: DO NNSED=1,NSTD
             D50AVG(L) = D50AVG(L) + 
             +                 FRAC_ALAY_SURF(NNSED,L)*D50(NNSED)/10000.  ! BASED ON BED COMPOSITION
        C
             TSED_ALAY_SURF(2,NNSED,L)=TSED_ALAY_SURF(1,NNSED,L)
             TSED_ALAY_BUFF(2,NNSED,L)=TSED_ALAY_BUFF(1,NNSED,L)
             TSED_PBED(2,NNSED,L)=TSED_PBED(1,NNSED,L)
                  END DO do_410
    I can move to the end/start of `do` loop using the keyboard shortcut `CTRL + ]`. Any suggestions is appreciated.  
    Regards, Jdbaba

    Hello Jdbaba,
    Based on my research, your post is related to use fortran in Visual Studio:https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-build-intel-mkl-program-with-intel-fortran-in-microsoft-visual-studio This
    technology is provided by Intel. So the question should be consulted on Intel fortran related forum. Not Visual Studio Setup forum, setup forum is about install/uninstall Visual Studio.
    Best regards,  
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Enable syntax highlighting with configuration file in emacs

    When editing configuration files such as .procmailrc, .fetchmailrc, Emacs won't automatically highlight syntax for me.
    I can enable syntax highlighting in Vim by appending "syntax on"  to the .vimrc.
    I tried adding "global-font-lock-mode t" in the .emacs file, but it didn't solve my problem.
    What is the solution?

    igndenok wrote:
    Some of my config file have this (using conf-unix-mode)
    # this is .somerc
    # -*- conf-unix -*-
    Or using this in your .emacs
    (add-to-list 'auto-mode-alist '("\\.*rc$" . conf-unix-mode))
    I followed your advice, and it does have some syntax highlighting, but less than Vim does.
    For example, Vim will highlight all the names of colors in the .muttrc file, but Emacs doesn't.
    I guess Emacs is not as strong as Vim when it comes to editing configuration files.
    Last edited by yu3k (2011-09-14 10:06:47)

Maybe you are looking for

  • How do I get chapter markers defined in a compound clip to show up in the DVD menu?

    I have created a timeline to burn a DVD/Blu-Ray. The timeline contains 3 compound clips. Each compound clip contains roughly 25 chapter markers. When I open the Share > DVD dialog, it shows the Chapter button in the preview, but the DVD itself doesn'

  • JTable: Adding a second row?!

    Hi there, I wrote my own TableModel and now it?s possible to add "one" new row into my JTable via an event (the event is released by a JButton) out of my JFrame. But trying to add a second row into the JTable fails. The data of the new row overwrites

  • How do you create a engraved effect in illustrator cs4?

    say for example, i want to make a metal object look like it has text engraved/chisled into it. what is the fastest (but most realistic) way of getting this effect without drawing all of the secondary 3d looking paths by hand based on copies of the fl

  • Why are certain features deemed uncompatible when upon forced installation...they work?

    All revisions since 3.0 do not load foxkeh theme,foxkeh everywhere,lolifox,etc.because they are deemed incompatible. When a forced installation is done using nightly tester tools, lo and behold! they work just fine!! So what makes these add-ons incom

  • Green Screen using AVC-Intra 100 ugly

    Been using the hpx300 for approx two months mostly in 720p with great results. Just wraped our first true HD green screen shoot using avc-intra 100 at 24p with the intent of producing a white background mac-ad type, 5 min talking head corporate piece