Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Way to copy syntax highlighting in gedit?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
kcbagr
Posts: 53
Joined: 2016-09-22 18:10

Way to copy syntax highlighting in gedit?

#1 Post by kcbagr »

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?

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

#2 Post by debiman »

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?

kcbagr
Posts: 53
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

#3 Post by kcbagr »

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.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

#4 Post by debiman »

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?

kcbagr
Posts: 53
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

#5 Post by kcbagr »

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.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Way to copy syntax highlighting in gedit?

#6 Post by pylkko »

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
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

#7 Post by debiman »

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.

kcbagr
Posts: 53
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

#8 Post by kcbagr »

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: 53
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

#9 Post by kcbagr »

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).

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Way to copy syntax highlighting in gedit?

#10 Post by debiman »

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
static-catsit
Posts: 34
Joined: 2011-04-12 23:36

Re: Way to copy syntax highlighting in gedit?

#11 Post by static-catsit »

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
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Way to copy syntax highlighting in gedit?

#12 Post by pylkko »

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.

kcbagr
Posts: 53
Joined: 2016-09-22 18:10

Re: Way to copy syntax highlighting in gedit?

#13 Post by kcbagr »

Thanks for all your help guys! I really appreciate all the info posted.

Post Reply