Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
3
votes
3
answers
739
views
Customizing source-highlight's color schemes?
The `source-highlight` package is installed on my system. It highlights files I view with less using `/usr/bin/lesspipe` and `LESSOPEN` environment variable. Now, I want to change the color scheme this mechanism uses for some/all filetypes. I have root on the machine. How do I do this? Note: It's a...
The
source-highlight
package is installed on my system. It highlights files I view with less using /usr/bin/lesspipe
and LESSOPEN
environment variable.
Now, I want to change the color scheme this mechanism uses for some/all filetypes. I have root on the machine. How do I do this?
Note: It's a Devuan 3 Beowulf (~= Debian 10 Buster) Linux distribution.
einpoklum
(10753 rep)
Jan 4, 2020, 11:55 PM
• Last activity: Aug 2, 2025, 10:39 PM
80
votes
5
answers
55057
views
less command and syntax highlighting
I need to use the `less` command with the syntax highlighting of the vim command for `python`, `C`, `bash` and other languages. How do I apply syntax highlighting colors according to `vim` colors for `less` command?
I need to use the
less
command with the syntax highlighting of the vim command for python
, C
, bash
and other languages.
How do I apply syntax highlighting colors according to vim
colors for less
command?
PersianGulf
(11308 rep)
Sep 17, 2013, 06:17 AM
• Last activity: May 29, 2025, 02:29 PM
3
votes
1
answers
2153
views
Vim Syntax Highlight for Configuration Files
The vim version on my faculty cluster has a great feature in highlighting the syntax for Linux standard configuration files (like /etc/network/interfaces or httpd.conf). I've tried a lot of settings and options in the way to obtain the same behavior, but nothing helps. Any ideas? Thank you! :)
The vim version on my faculty cluster has a great feature in highlighting the syntax for Linux standard configuration files (like /etc/network/interfaces or httpd.conf).
I've tried a lot of settings and options in the way to obtain the same behavior, but nothing helps.
Any ideas?
Thank you! :)
Filip Ion Dorinel
(131 rep)
Jan 9, 2016, 02:56 PM
• Last activity: Apr 24, 2025, 09:03 AM
0
votes
0
answers
17
views
Nvim syntax highlighting disabled by screen command
When I open up neovim on my raspbian device the syntax highlighting works perfectly well. As soon as I use the screen command (to create a multi-paned setup) nvim becomes black and white. Colors remain in bash after the screen command, and this problem persists across reboots. Any idea what's going...
When I open up neovim on my raspbian device the syntax highlighting works perfectly well. As soon as I use the screen command (to create a multi-paned setup) nvim becomes black and white. Colors remain in bash after the screen command, and this problem persists across reboots. Any idea what's going on and how I can fix it?
Sambews
(1 rep)
Mar 18, 2025, 10:37 AM
• Last activity: Mar 18, 2025, 11:48 AM
0
votes
0
answers
51
views
How can I Colorize my custom .bashrc file w/ nano in shell
im using an arch linux variant with xfce, opening up a terminal shell and running **sudo nano .bashrc** I can see the file is colorized despite there being no headers referencing a schema. Looking inside dir ***/usr/share/nano-syntax-highlighting/*** shows no file for bashrc configs I would like to...
im using an arch linux variant with xfce, opening up a terminal shell and running **sudo nano .bashrc** I can see the file is colorized despite there being no headers referencing a schema.
Looking inside dir ***/usr/share/nano-syntax-highlighting/*** shows no file for bashrc configs
I would like to use the same colors that are used for**.bashrc** for my **.customrc** file.
How and where can I set this?
Rachel1983
(23 rep)
Feb 9, 2025, 05:03 AM
• Last activity: Feb 9, 2025, 10:41 AM
1
votes
0
answers
19
views
.jsf (JOE editor) syntax highlighting for todo.txt
I can't get the JOE editor to highlight tags like ``due:YYYY-MM-TT`` for due dates or ``rec:NP`` for recurrences to work; I was able to highlight prioritized tasks though. * A sample `todo.txt` looks like this: ```text update the ad with Sara (B) ask Richard about stuff send questions to Mr K next w...
I can't get the JOE editor to highlight tags like `
due:YYYY-MM-TT
for due dates or
rec:NP
` for recurrences to work; I was able to highlight prioritized tasks though.
* A sample todo.txt
looks like this:
update the ad with Sara
(B) ask Richard about stuff
send questions to Mr K next week
(B) ask T about integration for A
(A) test 1110 due:2024-12-09 rec:1d
test 1120 due:2024-12-09 rec:1w and tell S
* I'm trying to highlight the prioritized tasks and the tags with this todotxt.jsf
:
# Todo.txt syntax highlighting for JOE
=Idle
=Prio CYAN bold
=Due bg_MAGENTA
=Rec bg_YELLOW
:lineStart Idle
* idle buffer
"(" prio noeat buffer
:idle Idle
* idle buffer
" :" tagwordsIdle hold
"\n" lineStart
:prio Prio
* prio buffer
" :" tagwordsPrio hold
"\n" lineStart
:tagwordsIdle Idle
* idle
"\n" lineStart strings
"due" dueIdle recolor=-2
#"rec" recIdle
done
:tagwordsPrio Prio
* prio
"\n" lineStart strings
"due" duePrio recolor=-2
#"rec" recPrio
done
:dueIdle Due
* dueIdle
" \t" idle
:duePrio Due
* duePrio
" \t" prio
How would I highlight individual tags/words within a line?
montionoimi
(11 rep)
Dec 9, 2024, 03:11 PM
• Last activity: Dec 10, 2024, 11:09 AM
1
votes
2
answers
596
views
Whois queries with color output
Is there an easy way to make `whois` queries from the terminal have syntax coloring in the output so it would be easier to read? Something basic like coloring `NOT FOUND` in red, and field names and dates in different colors would already be useful. It doesn't matter if the coloring is not 100% accu...
Is there an easy way to make
whois
queries from the terminal have syntax coloring in the output so it would be easier to read?
Something basic like coloring NOT FOUND
in red, and field names and dates in different colors would already be useful. It doesn't matter if the coloring is not 100% accurate.
Lassi
(891 rep)
Apr 10, 2019, 07:49 PM
• Last activity: Aug 22, 2024, 06:44 PM
0
votes
2
answers
89
views
gtksourceview: syntax highlight for language groff in gedit
Sciancisco and I developed a syntax highlighter for the **Groff** markup language to be used with Gedit, Pluma, Xed etc. I installed it in `/usr/share/gtksourceview-4/language-specs/groff.lang` and it always worked fine, but now I'm using Debian Trixie and it doesn't work anymore. Any clue? ```xml *...
Sciancisco and I developed a syntax highlighter for the **Groff** markup language to be used with Gedit, Pluma, Xed etc. I installed it in
/usr/share/gtksourceview-4/language-specs/groff.lang
and it always worked fine, but now I'm using Debian Trixie and it doesn't work anymore. Any clue?
* name: the "G" of "Groff" was capitalized.
*
* mimetypes and globs: completely changed based upon "All known MIME
types" and their filename patterns, available at
https://www.digipres.org/formats/mime-types/
*
* comment-new and comment-old: the "." (dot) was included as part of the
comment. Added "\.".
-->
application/x-troff;application/x-troff-man;text/troff
*.1;*.2;*.3;*.4;*.5;*.6;*.7;*.8;*.groff;*.man;*.roff
\.\\#
$
\.\\"
$
\\[[]
[]]
\\.[[]
[]]
\\[(]..
\\.[(]..
\\..
\\.
^\.EQ(\s|$)
^\.EN
^\.PS(\s|$)
^\.PE
^\.TS(\s|$)
^\.TE
^\.cstart(\s|$)
^\.cend
^\.R1(\s|$)
^\.R2
^\.[[]
^\.[]]
^\.[A-Z0-9_]+
^\.[a-z]+
Daniel
(432 rep)
Aug 14, 2024, 06:08 PM
• Last activity: Aug 15, 2024, 04:00 PM
17
votes
2
answers
11401
views
How to enable syntax highlighting in ranger preview?
I have seen some screenshots where ranger uses syntax-highlighting in its preview window. So I was wondering how to enable this feature and found out that I need the `scope.sh` file in the directory `/home/user/.config/ranger/scop.sh`, which will be generated with the command `$ ranger --copy-config...
I have seen some screenshots where ranger uses syntax-highlighting in its preview window. So I was wondering how to enable this feature and found out that I need the
scope.sh
file in the directory
/home/user/.config/ranger/scop.sh
,
which will be generated with the command
$ ranger --copy-config=scope
.
After generating it however the preview window completely disappears,
although I inserted set use_preview_script true
in rc.config
.
Q: Does someone know how to enable syntax-highlighting (especially for C/C++) in the ranger preview window?
PatrickSteiner
(621 rep)
Apr 5, 2018, 08:47 AM
• Last activity: Mar 5, 2024, 08:21 PM
4
votes
4
answers
1028
views
Emacs - Changing show-paren-mode Areas
I like show-paren-mode in Emacs, but I would really like to change the highlighting behavior for closing brackets. That is, I want the opening bracket to be highlighted when the point is on the closing bracket. The default behavior highlights the opening bracket when the point is on the character fo...
I like show-paren-mode in Emacs, but I would really like to change the highlighting behavior for closing brackets.
That is, I want the opening bracket to be highlighted when the point is on the closing bracket. The default behavior highlights the opening bracket when the point is on the character following the closing bracket.
Is this easy to change? Also, I would be interested in potential benefits of keeping the show-paren-mode behavior as it is.
user22531
Nov 4, 2013, 07:33 PM
• Last activity: Feb 28, 2024, 04:34 PM
1
votes
0
answers
185
views
Custom syntax highlighting misbehaving in gedit
For gedit, I'm creating a custom syntax highlighter for a markup-like language that I created to accomplish some natural language manipulation stuff, so I thought I'd get started with the simple keywords, seeing as I don't need to come up with regexes for them. I've defined the following in the XML:...
For gedit, I'm creating a custom syntax highlighter for a markup-like language that I created to accomplish some natural language manipulation stuff, so I thought I'd get started with the simple keywords, seeing as I don't need to come up with regexes for them.
I've defined the following in the XML:
Should I be using a regex for these or did I just botch the XML? Also, why do the
text/x-c;text/x-csrc;image/x-xpixmap
*.foo
ref
alt
pos
num
#
$
@
[
]
:
=
:?
&
The syntax does highlight, but only on some odd conditions. Specifically, any keyword in the operators
context must be both preceded by and followed by a non-keyword character, lest it will fail to highlight.

members
keywords highlight without issue?
Alex Clough
(111 rep)
Aug 2, 2016, 01:16 AM
• Last activity: Feb 15, 2024, 04:54 PM
1
votes
1
answers
112
views
What's overriding my .vimrc tabstop size setting for CMake files?
In my `~/.vim/vimrc`, I have: ``` set shiftwidth=4 set tabstop=4 ``` and when I edit a plain text file, that is respected. However, when I edit a CMake file - these both becomes 8. I tried looking for the cause of this change, but couldn't figure it out: * Nothing in `/usr/share/vim/vim90/syntax/cma...
In my
~/.vim/vimrc
, I have:
set shiftwidth=4
set tabstop=4
and when I edit a plain text file, that is respected. However, when I edit a CMake file - these both becomes 8. I tried looking for the cause of this change, but couldn't figure it out:
* Nothing in /usr/share/vim/vim90/syntax/cmake.vim
seems to be related to tab stops, or to include another vim file.
* Same for /usr/share/vim/vim90/syntax/cmake.vim
.
* The CMakeLists.txt
files I'm editing have no modeline.
What's causing this? Is there a definition I've missed? And - can I override it somehow?
einpoklum
(10753 rep)
Dec 22, 2023, 09:59 PM
• Last activity: Dec 24, 2023, 01:30 AM
0
votes
2
answers
1052
views
How do I get rid of this leading space highlighting in Nano (Ubuntu)?
Here's an image: [![enter image description here][1]][1] Every time I type something with a leading tab, I get this obnoxious green/teal background until I type a value in for that line. Also, for some reason on line 27, the color I entered is also highlighted with the green/teal background (It's no...
Here's an image:
Every time I type something with a leading tab, I get this obnoxious green/teal background until I type a value in for that line.
Also, for some reason on line 27, the color I entered is also highlighted with the green/teal background (It's not whitespace, yet still gets highlighting like it is)
Other lines with trailing whitespace also gets the same treatment.
How can I get rid of this? I don't want any of this whitespace highlighting.
Any help would be greatly, greatly, appreciated.
Edit:
-----
I deleted the offending line and still have the issue:


fmotion1
(63 rep)
Sep 23, 2023, 01:29 AM
• Last activity: Sep 23, 2023, 01:08 PM
0
votes
1
answers
84
views
nano unhighlight string if a quote is escaped
I'm trying to unhighlight string if one of the quotes is escaped. `sh.nanorc` regex is as follows: `color brightyellow ""(\\.|[^"])*""` I'm having success with the closing quote when preceding it with `[^\\]`: `color brightyellow ""(\\.|[^"])*"[^\\]"` But if I do the same to the opening one, althoug...
I'm trying to unhighlight string if one of the quotes is escaped.
sh.nanorc
regex is as follows:
color brightyellow ""(\\.|[^"])*""
I'm having success with the closing quote when preceding it with [^\\]
:
color brightyellow ""(\\.|[^"])*"[^\\]"
But if I do the same to the opening one, although it does the work, but it also starts either coloring any other symbol preceding the string if the opening quote isn't escaped, or uncoloring the string if it starts at beginning of line.
So, how to get it done clean with both quotes?
Multifix
(145 rep)
Aug 12, 2023, 11:53 AM
• Last activity: Aug 29, 2023, 08:46 PM
0
votes
1
answers
355
views
Any 'cat' colorized tool?
I sometimes `cat` a c file or a JSON file, there is no colorful format text. Is there any command line tool that can show colorful format text as it is in ex: gedit?
I sometimes
cat
a c file or a JSON file, there is no colorful format text.
Is there any command line tool that can show colorful format text as it is in ex: gedit?
Mark K
(955 rep)
Mar 29, 2023, 06:12 AM
• Last activity: Mar 29, 2023, 10:33 PM
0
votes
1
answers
727
views
Terminal is losing the blink and is not showing text after using (batcat)
So, I used `batcat` to syntax highlight a file in the terminal. After I close it through Ctrl + C , my cursor stops blinking and I cant see the text I type in my terminal. [Error](https://github.com/JothaM123/errorinlinux/raw/main/error.mp4)
So, I used
batcat
to syntax highlight a file in the terminal. After I close it through Ctrl + C, my cursor stops blinking and I cant see the text I type in my terminal.
[Error](https://github.com/JothaM123/errorinlinux/raw/main/error.mp4)
lunix
(129 rep)
Mar 26, 2023, 10:23 AM
• Last activity: Mar 27, 2023, 01:34 PM
0
votes
1
answers
241
views
Vim color problem
I've a strange problem with vim editor: if i write a simple text, all is normal, white text [![enter image description here][1]][1] If i add shebang, save and exit...reopen and ..color change after first line! [![enter image description here][2]][2] :(( Can you help me?! Thanks in advance! [1]: http...
I've a strange problem with vim editor:
if i write a simple text, all is normal, white text
If i add shebang, save and exit...reopen and ..color change after first line!
:(( Can you help me?!
Thanks in advance!


ancoling67
(109 rep)
Mar 9, 2023, 05:03 AM
• Last activity: Mar 9, 2023, 01:08 PM
4
votes
0
answers
1009
views
How to create a Kate highlight syntax to CSV files
I'm working with CSV files, and I'm using vim because of the rainbow CSV plugin that makes the editing easier: http://www.vim.org/scripts/script.php?script_id=4598 But I prefer using Kate, and as I did not find anything on the Internet like it. I'm trying to do a syntax highlight myself, but I'm not...
I'm working with CSV files, and I'm using vim because of the rainbow CSV plugin that makes the editing easier:
http://www.vim.org/scripts/script.php?script_id=4598
But I prefer using Kate, and as I did not find anything on the Internet like it. I'm trying to do a syntax highlight myself, but I'm not familiar with the file format and do not know if it is possible to do something similar to rainbow CSV on Kate.
I was trying to do an itemData for each word position, but it did not work as I expected.
I want each word to have a different colour.
Text example:
word0,word1,word2,word3,word4,...,wordN
If anyone could help me, I would appreciate it.
mvp83
(41 rep)
Apr 22, 2015, 03:12 PM
• Last activity: Dec 13, 2022, 07:48 AM
9
votes
3
answers
11728
views
Change directory for Kate syntax highlighting files
I'm running Standard Debian Wheezy with KDE 4.8.4 and Kate 3.8.4. The Kate text editor's syntax highlighting files are located in: /usr/share/kde4/apps/katepart/syntax If I run kde4-config --prefix this gives /usr and $KDEDIR is empty. This results in that only XML files in the upper direcory are us...
I'm running Standard Debian Wheezy with KDE 4.8.4 and Kate 3.8.4.
The Kate text editor's syntax highlighting files are located in:
/usr/share/kde4/apps/katepart/syntaxIf I run
kde4-config --prefixthis gives
/usrand $KDEDIR is empty. This results in that only XML files in the upper direcory are used for highlighting.
In several other forums, I saw that it should work to create a folder "syntax" in
~/.kde/share/apps/katepart/ If I put syntax-highlighting files there on my system, they appear to be ignored. How can someone change/set the directory for the syntax-highlighting files used by *Kate* to an arbitrary directory?
Chrispie
(3893 rep)
Jan 5, 2014, 12:58 PM
• Last activity: Sep 15, 2022, 06:55 AM
0
votes
1
answers
155
views
nano highlighting fails in matching shell array brackets
The last two array expansions don't get proper highlighting:  This is the setting in `sh.nanorc` that defines it: # More complicated variable names; handles braces and replacements and arrays. color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(...
The last two array expansions don't get proper highlighting:

This is the setting in
sh.nanorc
that defines it:
# More complicated variable names; handles braces and replacements and arrays.
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
What do I have to fix in the regex to catch this miss?
Multifix
(145 rep)
Jul 7, 2022, 07:56 AM
• Last activity: Jul 7, 2022, 08:22 AM
Showing page 1 of 20 total questions