Way to copy syntax highlighting in gedit?

If none of the more specific forums is the right place to ask

Way to copy syntax highlighting in gedit?

Postby kcbagr » 2018-03-28 13:02

Is there a way to save the syntax highlighting of a gedit document so that it can be backed up with the highlighting?

Is there a way to apply syntax highlighting to groups of files instead of one at a time?
kcbagr
 
Posts: 35
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

Postby debiman » 2018-03-28 18:19

kcbagr wrote:Is there a way to save the syntax highlighting of a gedit document so that it can be backed up with the highlighting?
no.
why would you need that.

Is there a way to apply syntax highlighting to groups of files instead of one at a time?
usually happens automatically when you open the file anyhow, but i know of no editor that can explicitely apply the same syntax highlighting to a group of files.
again, why do you think you need that? are your files not recognized automatically?
User avatar
debiman
 
Posts: 2499
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

Postby kcbagr » 2018-03-29 10:34

debiman wrote:
kcbagr wrote:Is there a way to save the syntax highlighting of a gedit document so that it can be backed up with the highlighting?
no.
why would you need that.

Is there a way to apply syntax highlighting to groups of files instead of one at a time?
usually happens automatically when you open the file anyhow, but i know of no editor that can explicitely apply the same syntax highlighting to a group of files.
again, why do you think you need that? are your files not recognized automatically?


I "need" it because I have gone to a lot of trouble to mark certain files with the syntax highlighting that I want. Yet when I copy said files over to an external hard drive (for backing up purposes), the highlighting is lost. So in the future, when I pull that backup (e.g., after upgrading to a new version of Debian), I will once again have to go through and manually mark all those files with the highlighting I want. It's a major PITA to have to do this every couple years.
kcbagr
 
Posts: 35
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

Postby debiman » 2018-03-29 14:37

kcbagr wrote:I have gone to a lot of trouble to mark certain files with the syntax highlighting that I want.

sorry, but i don't understand this statement.
can you describe the process?
in my understanding, syntax highlighting is something that the editor (nano, geany, vim, gedit ...) does automatically when i open the file. in a very few cases it does not recognize the correct syntax, and i have to go to
Menu => Filetype => [Language]
or something like that.

are you saying you somehow applied the colors manually to your code?
User avatar
debiman
 
Posts: 2499
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

Postby kcbagr » 2018-03-30 13:23

I'm not opening "code" more as notes that are organized via code highlighting.

So if I open a .txt file, it has no highlighting. To help organize the appearance, I go to Gedit Hamburger Menu > View > Highlight Mode = .desktop.

I have found no other way to "activate" .desktop syntax highlighting. So it's a rather clunky process of applying this syntax to each and every file that I want it to appear on.
kcbagr
 
Posts: 35
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

Postby pylkko » 2018-03-30 13:44

Gedit applies the highlighting according to the file suffix.

I don't understand what you want, however it is possible to save syntax highlighted text to pdf or similar and then it will be 'permanent'
User avatar
pylkko
 
Posts: 1310
Joined: 2014-11-06 19:02

Re: Way to copy syntax highlighting in gedit?

Postby debiman » 2018-03-31 05:33

kcbagr wrote:I'm not opening "code" more as notes that are organized via code highlighting.

So if I open a .txt file, it has no highlighting. To help organize the appearance, I go to Gedit Hamburger Menu > View > Highlight Mode = .desktop.

I have found no other way to "activate" .desktop syntax highlighting. So it's a rather clunky process of applying this syntax to each and every file that I want it to appear on.

it will work when all your notes are renamed something.desktop.
User avatar
debiman
 
Posts: 2499
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

Postby kcbagr » 2018-03-31 12:19

debiman wrote:
kcbagr wrote:I'm not opening "code" more as notes that are organized via code highlighting.

So if I open a .txt file, it has no highlighting. To help organize the appearance, I go to Gedit Hamburger Menu > View > Highlight Mode = .desktop.

I have found no other way to "activate" .desktop syntax highlighting. So it's a rather clunky process of applying this syntax to each and every file that I want it to appear on.

it will work when all your notes are renamed something.desktop.


When I rename the file, for example "something.desktop", gedit reports "There was an error launching the application."

Is there a particular way in naming it so it works?
kcbagr
 
Posts: 35
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

Postby kcbagr » 2018-03-31 12:28

pylkko wrote:Gedit applies the highlighting according to the file suffix.

I don't understand what you want, however it is possible to save syntax highlighted text to pdf or similar and then it will be 'permanent'


pylkko,

1) open gedt
2) type some text
3) save the document
4) go to the hamburger menu and select: View > Highlight Mode = .desktop

What "file suffix" is causing this .desktop highlighting? (as you are saying it is according to file suffix).
kcbagr
 
Posts: 35
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

Postby debiman » 2018-04-01 10:39

kcbagr wrote:When I rename the file, for example "something.desktop", gedit reports "There was an error launching the application."

are you sure gedit issues this message, and not your filemanager?
you have to right-click on the file and Open With... => gedit.

if it is indeed gedit issueing that message, then gedit is broken.

you made an unlucky choice of highlighting format for your notes, because .desktop files are somewhat reserved on freedesktop systems.
User avatar
debiman
 
Posts: 2499
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

Postby static-catsit » 2018-04-03 06:35

When I rename the file, for example "something.desktop", gedit reports "There was an error launching the application."

Is there a particular way in naming it so it works?


To view .desktop files you can open up Gedit and then drop the file in.
User avatar
static-catsit
 
Posts: 34
Joined: 2011-04-12 23:36

Re: Way to copy syntax highlighting in gedit?

Postby pylkko » 2018-04-03 09:59

kcbagr wrote:
pylkko wrote:Gedit applies the highlighting according to the file suffix.

I don't understand what you want, however it is possible to save syntax highlighted text to pdf or similar and then it will be 'permanent'


pylkko,

1) open gedt
2) type some text
3) save the document
4) go to the hamburger menu and select: View > Highlight Mode = .desktop

What "file suffix" is causing this .desktop highlighting? (as you are saying it is according to file suffix).



yes, if you use .c you get c syntax highlighting, and guess what? if you use .py you get Python syntax highlighting. if you, however right a python script and name it whatever.txt you will not get it automatically, but you need to do the procedure of clicking the "hamburger menu" etc that you want to avoid.
User avatar
pylkko
 
Posts: 1310
Joined: 2014-11-06 19:02

Re: Way to copy syntax highlighting in gedit?

Postby kcbagr » 2018-04-03 12:04

Thanks for all your help guys! I really appreciate all the info posted.
kcbagr
 
Posts: 35
Joined: 2016-09-22 18:10


Return to General Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable