this post was submitted on 25 Jul 2024
52 points (100.0% liked)

Linux

1258 readers
100 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
top 13 comments
sorted by: hot top controversial new old
[–] thingsiplay 21 points 3 months ago (2 children)

What you are looking for is called Syntax Highlight. Are you asking this for the terminal? I think this is a property of the shell. Fish has it builtin and for ZSH, there is a plugin: https://github.com/zsh-users/zsh-syntax-highlighting I don't know if its possible with Bash.

[–] bubstance@lemmy.sdf.org 12 points 3 months ago (2 children)

Closest thing for bash would be ble.sh.

[–] Binette@lemmy.ml 8 points 3 months ago

Tried it out and it works! Thanks!

[–] t0mri@lemmy.ml 3 points 3 months ago (1 children)

Yeah, I used to use that before. But its slower for me. So now I use fish for interactions

[–] theshatterstone54@feddit.uk 1 points 3 months ago

Yeah, it's slow. I use it currently (because of better vi mode support) but plan to switch back to zsh.

[–] Binette@lemmy.ml 6 points 3 months ago (1 children)

Yes, I am looking for a syntax highlighter for the terminal. The one I use is called Kitty.

[–] hallettj@leminal.space 2 points 3 months ago

It would make sense for the terminal to handle syntax highlighting since that would match how editors work. But the convention is that the shell handles highlighting, not the terminal. You can check which shell you are running with the command,

$ echo $SHELL

It's done that way because the shell is a running program that is capable of telling the terminal which colors to show (by mixing color escape sequences into text). Compare that to code in an editor which is text, not a running program so the only option is for the editor to handle highlighting[1]. Editors need syntax files to configure highlighting for all the different programming languages, while terminals don't need this because the shell tells them what colors to show.

[1] setting aside the "semantic highlighting" LSP capability - that was invented long after syntax highlighting conventions were established

[–] boredsquirrel@slrpnk.net 17 points 3 months ago* (last edited 3 months ago)

Fish shell

You can change the used shell in the configs. At least for Alacritty, when I used it (dont care, it was still kinda broken, I just use Konsole)

[–] Andy@programming.dev 6 points 3 months ago

I suggest trying this one for Zsh, over the more common one: https://github.com/zdharma-continuum/fast-syntax-highlighting

[–] Cube6392 2 points 3 months ago

Yes! Zsh-syntax-highlighting is a starting point to look at. You can also use fish shell