Questions tagged [syntax-highlighting]

Syntax highlighting is a feature of some text editors that display text (especially source code) in different colors and fonts according to the category of terms.

Syntax highlighting is a feature of some text editors that display text (especially source code) in different colors and fonts according to the category of terms. For example, any given language will have certain repeating elements like strings, variables, functions or other keywords that can be color-coded to improve readability. It is used to identify syntax errors in the code and to make reading the code more visually appealing.

3278 questions
544
votes
6 answers

How to customise file type to syntax associations in Sublime Text?

I'd like Sublime 2 editor to treat *.sbt files (to highlight syntax) as Scala language, same as *.scala, but I can't find where to set this up. Do you happen to know?
Ivan
  • 59,167
  • 87
  • 235
  • 370
404
votes
6 answers

Set language for syntax highlighting in Visual Studio Code

Before the confusion begins, this question is about Code, the new lightweight Visual Studio Editor. You can get it from here: https://code.visualstudio.com/ I have a textfile (.txt) with CSS in it and want to get syntax hightlighting. You can open…
Florian Leitgeb
  • 12,686
  • 5
  • 27
  • 36
230
votes
19 answers

Syntax highlighting/colorizing cat

Is there a method to colorize the output of cat, the way grep does. For grep, in most consoles it displays a colored output highlighting the searched keywords. Otherwise, you can force it by calling grep --color Is there a generic way to color the…
Lelouch Lamperouge
  • 7,227
  • 7
  • 38
  • 57
211
votes
10 answers

Copy Notepad++ text with formatting?

I'm using Notepad++ to write code. How do I copy code in Notepad++ along with its formatting to paste into Microsoft Word? (i.e. syntax highlights, etc)
Josh
  • 12,636
  • 28
  • 109
  • 157
205
votes
3 answers

Source code highlighting in LaTeX

I need to highlight source code in LaTeX. The package listings seems to be the best choice for most use-cases and for me it was, until now. However, now I need more flexibility. Generally, what I’m looking for is a real lexer. In particular, I need…
Konrad Rudolph
  • 482,603
  • 120
  • 884
  • 1,141
151
votes
8 answers

How To Format A Block of Code Within a Presentation?

I am preparing a presentation using Google Slides, though I can also work on the presentation within Open Office that will include code snippets. Is there any easy way to perform basic syntax highlighting on the code snippets with either Google…
Noah Goodrich
  • 23,504
  • 12
  • 61
  • 95
146
votes
9 answers

Syntax highlighting for Jade in Sublime Text 2?

I just started using Sublime Text 2 on Mac. I also just started using Jade for my views in Node.js, and am wondering if there is a way to add syntax highlighting for Jade into Sublime Text 2.
James Simpson
  • 12,799
  • 25
  • 71
  • 104
135
votes
2 answers

Diff syntax highlighting in Github Markdown

I'm writing documents that should explain code in C# using Markdown. I use the ```csharp to get csharp highlighting. I sometimes want to highlight something specific in the code using bold or anything. I know about
 etc... but it takes away my…
Noam
  • 2,877
  • 4
  • 23
  • 41
132
votes
6 answers

How to force vim to syntax-highlight a file as html?

How do I set vim's syntax highlighting to treat a file extension as an html file? I'm using ez template, so the file's extension is .ezt. But a lot of it is normal html code.
Karthick
  • 3,685
  • 5
  • 26
  • 33
125
votes
6 answers

Jenkinsfile syntax highlighting in Java project using Intellij Idea

We already tried the approaches as listed below: https://github.com/oliverlockwood/jenkinsfile-idea-plugin https://st-g.de/2016/08/jenkins-pipeline-autocompletion-in-intellij After having searched the web for many hours on multiple days, we still…
rexford
  • 4,167
  • 5
  • 22
  • 36
117
votes
4 answers

Persistent :set syntax for a given filetype?

I'm working on a Symfony2 project which uses Twig, and the filetypes are myfile.html.twig. Vim doesn't automatically detect the syntax highlighting and so applies none. I can use :set syntax=HTML after I've opened the file but this is a pain when…
Bendihossan
  • 2,099
  • 5
  • 18
  • 25
116
votes
14 answers

SublimeText encloses lines in white rectangles

It's rather annoying and I can't seem to figure out why.
Doug Smith
  • 27,683
  • 54
  • 189
  • 363
112
votes
3 answers

How to tell which colorscheme a Vim session currently uses

You can set the Vim color scheme by issuing :colorscheme SCHEME_NAME but, oddly enough, you can't get the currently used scheme by issuing :colorscheme as this results in "E471: Argument required". I also don't see the color scheme listed in the…
gotgenes
  • 34,337
  • 27
  • 93
  • 119
112
votes
2 answers

knitr Markdown highlighting in Emacs?

Is there any modification of an existing tool or new tool that will syntax-highlight (colour) blocks of R code in a knitr markdown document when opened in Emacs? The knitr chunks I am looking at are triple-backtick blocks [```] that contain R code…
719016
  • 8,262
  • 17
  • 72
  • 140
110
votes
13 answers

Syntax highlighting code with Javascript

What Javascript libraries can you recommend for syntax highlighting blocks in HTML? (One suggestion per answer please).
mlambie
  • 7,336
  • 6
  • 32
  • 41
1
2 3
99 100