turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Toggle Syntax Highlighting

Open amay5267 opened this issue 2 years ago • 7 comments

Hi @magiblot How to Toggle Syntax Highlighting? Personally I would like to be able to toggle syntax highlighting on/off for C/CPP.

amay5267 avatar Nov 30 '22 14:11 amay5267

Hi @amay5267!

There is currently no way to select the syntax highlighting or disable it manually, but it gets automatically enabled in these cases:

  • When opening a file with C/C++ extension.
  • When saving a file with C/C++ extension.

So, for example, if you open a new editor with Ctrl+N, you can enable syntax highlighting by saving the file with a .cpp/.cc/.h/etc. extension. Or, if you want to create a source code file from the command line, and you run turbo newSourceFile.cc, you will get an editor with syntax highlighting even though the file newSourceFile.cc does not exist yet.

I don't know if this is enough for what you are trying to do.

magiblot avatar Nov 30 '22 18:11 magiblot

Hi @magiblot How to switch syntax off manually in source code for C/CPP? I like how it behaves in C# source code case e.g. newSourceFile.cs - no syntax color you see. How to do the same as C# but for pure C source code ?

amay5267 avatar Nov 30 '22 19:11 amay5267

How to not automatically enable syntax highlighting in newSourceFile.c and newSourceFile.cc files?

amay5267 avatar Nov 30 '22 19:11 amay5267

It is not automatically enabled in C# source code e.g. newSourceFile.cs

amay5267 avatar Nov 30 '22 19:11 amay5267

Okay, now I understand you. There's currently no way to do this; C# source files do not get syntax highlighting because it is not supported yet.

I can implement this.

magiblot avatar Nov 30 '22 19:11 magiblot

Perfect! As a temporary workaround I write C source code but save it with .cs extension. Than I rename the file with Turbo and with .c extension

amay5267 avatar Nov 30 '22 19:11 amay5267

I am not sure if you are familiar with Vim. If you do vim HelloWorld.c, vim opens HelloWorld.c with syntax on. Now if you are in vim and write :syntax off - magic happens. I want the same magic in Turbo.

amay5267 avatar Nov 30 '22 19:11 amay5267