You are not logged in.
Pages: 1
I was wondering what kinds of syntax highlighting folks here like and use?
Ive recently read about only having comments highlighted in a program file , config, script etc and have given it a try in geany and it sort of makes sense that to understand the code, comments are better off highlighted than the actual code itself. So for example, a bashrc, config, C file will only have the comments in blue and the rest of the input witll be white, so lets say black background, blue syntax foreground and white code foreground for example, only 3 colors used in that order.
thoughts??
example:
Last edited by hevidevi (2022-02-04 12:29:24)
Offline
I'm a complete tart so I can't live without syntax highlighting. I find it useful for shell scripts because it indicates when I mess up the syntax, which happens often.
I use the default vim highlighting, here's an example featuring my lame status "script" for sway:
EDIT: yes, I am using whitespace to centre the clock; I don't know how to use JSON...
EDIT2: btw did you know OpenBSD's ksh can use GNU-style PS1 backslash-escaped special characters?
PS1='\e[36m\w \e[32m>\e[0m '
^ That replicates your PS1 without having to run pwd & sed every time you press <return>.
Last edited by Head_on_a_Stick (2022-02-04 19:18:38)
Brianna Ghey — Rest In Power
Offline
...EDIT: yes, I am using whitespace to centre the clock; I don't know how to use JSON...
Nothing wrong with that. if it works. Why make the code more complicated than it needs to be. Might I suggest using printf instead of echo which supports using \t for tab and \n for new line. Example.
printf "$(date +'%H:%M')\t\t\t\t$state$symbols\n"
Syntax highlighting is a blessing. It helps identify content between quotes, brackets,etc and easily find unclosed brackets, quotes. It can helps identify which code belongs to a certain code block (like a function or class). The advantage go on it. My job would b e so much more difficult without it.
Last edited by JWM-Kit (2022-02-04 21:44:46)
Offline
Might I suggest using printf
Thanks for the suggestion. I need spaces to line up the clock exactly on the centreline, tabs don't quite match. But I suppose it would be slightly cleaner to use mostly tabs with a few spaces:
printf "$(date +'%H∶%M')\t\t\t\t\t\t\t\t\t\t\t\t %s%s\n" "$state" "$symbols"
Thanks again and apologies to the OP for the diversion.
Brianna Ghey — Rest In Power
Offline
I need spaces to line up the clock exactly on the centreline, tabs don't quite match.
printf "%$((COLUMNS / 2))s%s%s\n" "$(date +%H%M)" "$state" "$symbols"
Then, for the OP, I think some syntax highlighting is good some really bad; especially when it's made for dark background where I use light background.
Offline
Thanks Ralph, that is a beautiful suggestion, but unfortunately the sway-bar status_command doesn't know the value of "$COLUMNS" for the bar so that code just results in no space at all between the clock and the battery indicator.
I've settled on
printf "%s%98s%s\n" "$(date +'%H∶%M')" "$state" "$symbols"
Which does at least look less silly, even if it isn't.
And now back to the thread topic...
Brianna Ghey — Rest In Power
Offline
I was wondering what kinds of syntax highlighting folks here like and use?
I don't mind what highlighting to use, as long as there is some one! Currently I use geany and nice editor defaults syntax highlighting configurations. My only concern is using white background, I dislike dark modes. Other than that, I can use any colour scheme.
Offline
Thanks for the input everyone. I like dark modes as its easy on the eyes for me, light colors tend to give me eye strain.
Thanks for the heads up on the ps1 in loksh head on a stick
Offline
There are alternate color schemes for geany. Check out the screenshots directory to see examples.
https://github.com/codebrainz/geany-themes
I used the default highlighting for geany for years, but it's become harder to read the orange on white, so I switched to gedit colors, and sometimes I switch to a dark background and use himbere.
https://github.com/codebrainz/geany-the … /gedit.png
https://github.com/codebrainz/geany-the … mbeere.png
Offline
fsmithred, yes ive downloaded and had a look at those geany themes. I like to use the cobalt color scheme, its old one.
Offline
My opinion on Dark mode is that is depends on the purpose of the text. I prefer dark mode for most jobs, but if I'm using office software I need the white background. I feel that the whole purpose of office software is to create documents that look good on paper. So it needs a background the color of paper. Which is white.
EDIT : Of course syntax highlighting is not used in office apps. So I guess when it comes to anything with syntax highlighting I prefer dark mode.
Last edited by JWM-Kit (2022-02-05 17:23:31)
Offline
Pages: 1