Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [syntax-highlighting]

Syntax highlighting is a feature of text editors that displays text, especially source code, in different colors and fonts according to the category of terms.

266
votes
2answers
104k views

Assigning custom extensions to a language's syntax highlighting in Notepad++

In the current version of Notepad++ opening .sql files results in Notepad applying SQL syntax highlighting to it. I'd like Notepad++ to do the same for other extensions as well, is there some setting ...
144
votes
1answer
92k views

How do I get Notepad++ to associate a file type with a language? [duplicate]

I have associated .wxs files with Notepad++. So far so good. However, it doesn't remember that it should use XML syntax highlighting. How do I associate a file-type with a Language?
124
votes
15answers
52k views

How to syntax highlight via Less

is there a way to syntax highlight a file I see in Less? actually I'm using this command to open an xml file (and sometimes a series of them) less htmleditors/htmleditors_config.xml or less [...
34
votes
2answers
17k views

Is there any way to get bash to have syntax highlighting like fish?

In the fish shell, the actual command line is syntax highlighted: Is there any way to get this same behavior in bash? There is something just like this but for zsh, not bash. Is it possible that ...
33
votes
3answers
56k views

Syntax highlighting in Microsoft Office Word [duplicate]

Possible Duplicate: How do I easily highlight the syntax of PHP code in Word? I need to paste some code (ANSI C) in Microsoft Office Word, and I need some form of syntax highlighting (instead of ...
32
votes
8answers
22k views

How do I easily highlight the syntax of PHP code in Word?

How do I easily write and syntax-highlighted PHP code (or any others programming language) in a Word 2009 document?
23
votes
5answers
11k views

Is there any *good* HTML-mode for emacs?

I love emacs, and I want to do my web-programming work in it, but I can't find a way to get it to edit HTML properly. I mean it's seriously awful. It will do HTML fine, but not PHP, javascript, etc....
22
votes
2answers
14k views

creating a simple vim syntax highlighting

i have a simple sort of a database file which consists only of entries in the following format variable=value i want to create a simple vim syntax highlighting for it and set it for specific file ...
22
votes
1answer
4k views

Pipe to less but keep the highlighting

Is it possible to pipe output (e.g. dmesg) to a command like less (or equivalent) and keep the text highlighting used by the original command? example: on the left dmesg | less on the right dmesg
22
votes
3answers
5k views

Convert HTML to image

Background Batch convert various syntax-highlighted source files (C, SQL, Java, PHP, batch, bash) into high-resolution images (600dpi), suitable for an eBook and printed book. Failed Solutions A ...
18
votes
3answers
12k views

Different language syntax highlighting within same file

I'm trying to get simple syntax highlighting working within a file. Here's the setup. I have an index.php file, which Notepad++ correctly highlights any PHP code between the <? and ?> tags. ...
17
votes
4answers
6k views

How do I enable syntax highlighting for .bash_aliases in vim?

I'm working on reorganizing my .bashrc. I moved my aliases to .bash_aliases (which is sourced by .bashrc, but I can't figure out how to enable syntax highlighting for this file. vim seems unable to ...
17
votes
4answers
15k views

Vim highlighting for specific file types (where to put syntax files, vim events, line to put into vimrc)

I have defined a file time jak.vim to offer custom highlighting when I take notes, however it is being applied to some files that do not have the .jak extension. Specifically a file named progress....
16
votes
2answers
2k views

How to interrupt emacs when control-g does not work in very large files?

I've run into some kind of O(n^2) or worse behavior when viewing very large (e.g. 128MB) files in Emacs and jumping to the end of the file. I think it may have to do with my coloring algorithm to ...
14
votes
5answers
7k views

How to change the syntax highlighting style in Meld

Meld 1.5.1 uses gtksourceview (via pygtksourceview) for its syntax-highlighting, however I'm unable to figure out how to configure it to use a specific style (color scheme/theme) from the ones ...
14
votes
2answers
8k views

Is there a way to have syntax highlighting or code blocks with Evernote?

How do you take notes on code snippets and or command line sequences in Evernote (Mac or PC)? Is there a way to have code blocks like the 'Code Sample' buttons here: example Any way to have colored ...
13
votes
6answers
6k views

Color coded Windows 7 Preview Pane?

Customizing what files you can preview is cool, but is there a way to create a custom preview extension to add syntax highlighting? I have many .h, .c, .cpp, .cs and .java files on my windows machine ...
13
votes
4answers
8k views

Where can I find a gallery of Pygments CSS files [closed]

I googled every possible combination but I couldn't find a list of syntax files. Is there a list of good ones?
13
votes
1answer
2k views

Is there any way to change Bitbucket code highlighting

I like the code coloring in Github so that keywords gets highlighted when view source code. But in Bitbucket i see very light color and almost no diff between codes , keywords etc. very bad color ...
13
votes
3answers
21k views

Better syntax highlighting for Java in Vim?

I've found Vim to have fantastic syntax highlighting with my preferred color schemes for Ruby and Python, but whenever I need to write Java code, it's like I haven't even turned on highlighting in the ...
11
votes
3answers
5k views

How can I highlight XML on the command line?

How can I highlight XML from stdin (e.g. piped from xmllint --format) to stdout? I know how to get highlighting working in nano and view, but is there something that just outputs to stdout and exits? ...
11
votes
6answers
9k views

Custom vim highlighting

I am editing some xml right now and I have been leaving myself some comments of things to come back to. Like this <!-- Question: bla bla --> I am editing with vim right now and I would like ...
11
votes
1answer
28k views

How can I copy text with syntax-highlighting from Notepad++? [duplicate]

I have an XML snippet in Notepad++ that I would like to share with a co-worker via email. In Notepad++ the syntax highlighting nicely shows off the elements and attributes. Here is a sample picture: ...
11
votes
1answer
3k views

Is it possible Notepad++ to change the theme based on current filetype

For example, if I open a text file, notepad++ would open it in 'default' theme. But if I open a php file for instance, it would open it in 'custom_theme1'. I know notepad++ is highly extensible, so I ...
10
votes
3answers
18k views

How do I make vim automatically apply c++ syntax highlight on Arduino files (.ino/.pde)?

How do I make vim automatically apply c++ syntax highlight on Arduino files (.ino/.pde)? Or how does vim syntax highlight know what is a c++ file? And how can I tell him that files that is called ....
10
votes
1answer
5k views

notepad++ - Applying CSS styles for SCSS files?

In Notepad++, I have some SCSS files for which I would like the syntax to be highlighted like CSS files are. How do I do this in Notepad++? In other words, I would like to apply the same styles to ...
9
votes
1answer
10k views

How to get syntax highlighting working in TextMate 2

I just cloned TextMate 2 from GitHub. Followed the instructions in the readme file and everything went smooth with the installation. However, there is no syntax highlighting. No problem – just need ...
9
votes
3answers
7k views

How to I use Textmate color themes with vim?

I have a textmate color theme I really like this, But I am a hardcore vim user. Is there an easy (painless) way for me to use this color scheme with vim?
9
votes
1answer
878 views

vim syntax highlight limited to 3000 chars

How do I allow vim to work its syntax highlight on lines longer than 3000 characters? I am having to write tests for a system and the input for the tests are a mess of encapsulated formats. My tests ...
9
votes
2answers
3k views

Vim: How to change the current item highlight color when substituting

I have changed my Vim colours so when I do a /search, every match is highlighted in bright yellow. This makes matches much easier to see. However, when I perform a substitution with the confirm flag ...
9
votes
2answers
1k views

Multiple foldmethods in vim

I use the folding option of vim quite a lot, and have usually set foldmethod to syntax. Recently I discovered that it is possible to add custom folds, such that I can put whole blocks in /*{{{*/ and /*...
9
votes
1answer
4k views

Modifying a gedit syntax highlighting file

I am trying to change a highlighting file from Gedit. I have modified the file /usr/share/gtksourceview-3.0/language-specs/fortran.lang because I want to change the cases in which the editor takes a ...
9
votes
1answer
2k views

Foldable/collapsable notepad++ markdown syntax

I am using Notepad++ for writing texts using Markdown syntax. I know there exists at least one Notepad++ style file to hightlight Markdows texts (see MultiMarkdown in Notepad ++ and https://github....
8
votes
1answer
3k views

How to change syntax for a specific folder in Sublime Text 3

I write JS projects in ES5 and ES6. I installed Babel-Sublime for highlighting Babel supported code. Now, I open a .js file written in ES6, goto "View -> syntax -> Open all with current extension as : ...
8
votes
1answer
5k views

how to turn off gvim error highlighting?

I use gvim as my text editor and the syntax coloring is great except it highlights "errors" and gives it a white background with red font. How do I turn off error highlighting? I find it annoying and ...
8
votes
2answers
1k views

Slowness in Vim's bracket-matching with the default PHP syntax

I am experiencing a noticeable slowness in Vim's bracket-matching and -highlighting feature. When the cursor is placed over a parenthesis or bracket, there is a delay of about 300ms on the console's ...
8
votes
1answer
2k views

How to have VIM show unclosed parenthesis?

Is there a way that I can change my .vimrc file so that unclosed parenthesis/brackets/braces are highlighted? For instance the following would highlight the parenthesis after the word main: public ...
7
votes
3answers
5k views

Turning on XML syntax highlighting in vim for a non-XML file

I'm using vim to browse through some log files (the file extension is .log) which contain a lot of XML. How can I turn on XML syntax highlighting after opening the file? Of course, I don't actually ...
7
votes
1answer
11k views

How to syntax highlight python scripts in PHP storm

I tried installing this script but then got this error message: I'm hoping for an answer that's similar to this one but for python instead of ruby.
7
votes
3answers
9k views

How to make Visual Studio 2010 highlight identical, selected words in editor ?

I would like to enable (if it exists) an option in Visual Studio 2010 that would highlight the same identical words to the selected ones. There is a feature like this already implemented e.g. in ...
7
votes
1answer
2k views

How can I configure syntax highlighting for a custom language in vim?

We use our own little language for small tasks, but we do not have Vim highlighting support for it.
7
votes
2answers
2k views

Highlighting command line in vim

Is it possible to change the coloring for the command line in vim? I realize that may be somewhat ambiguously stated, so I have some things that should clear it up a little. This image illustrates ...
7
votes
2answers
2k views

Toggle Syntax highlighting in Notepad++

I am running into speed-issues for big files, whose extension is recognized by Notepad++ which will be syntax-highlighted. Is there a Shortcut or option to assign keys to toggle Syntax-Highlighting in ...
7
votes
1answer
2k views

How do you define a new language specification for color syntax highlighting in Xcode 4?

For Xcode 3 there is plenty of information available about how to define a syntax highlighting specification for a language not already supported in Xcode. But there doesn't seem to be any ...
7
votes
1answer
12k views

How do I create my custom “User-Defined” language in Notepad++?

In Notepad++ there is a menu option: Language->"User-Defined". How do I customize that? What are capabilities of such option? Can I highlight date/time? Can I highlight 21-29th symbols in the lines?...
6
votes
2answers
10k views

No syntax highlighting in GVIM on Windows with _vimrc

My GVIM 7.3.46 install on Windows XP Professional SP3 32bit does not perform syntax highlighting if there exists a _vimrc file, at least not PHP and C. Even explicitly mentioning set syntax=php I get ...
6
votes
2answers
3k views

How can I highlight .htaccess code in Notepad++?

How can I highlight .htaccess code? I downloaded this XML file and I copy and pasted file content to userDefinedLanguage.xml inside my install directory. According to the documentation found here I ...
6
votes
2answers
8k views

Syntax highlighting in Terminal Mac OS X

How can I highlight different parts in the Mac OS X Terminal app? For example a different color for input and output? Are the pre-defined color themes I can activate/download?
6
votes
3answers
904 views

Sublime Text 3 - Detect syntax based on file header

How would I get Sublime Text 3 to recognize file type (i.e. set syntax and build system) based on a files header? For example: If the first line of a file was <!DOCTYPE html>, it would be ...
5
votes
3answers
4k views

LESS syntax highlighting in Geany

I'm using LESS CSS (PHP version). I'm also using Geany in Linux. Is there a LESS syntax file for Geany out there, or how I can go about editing the CSS one to suit LESS?