Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
Binette ( Binette@lemmy.ml )  to Linux@lemmy.mlEnglish · 2 years ago

Anyone knows if it's possible to color command line commands as you type them (kind of like an editor)?

message-square
message-square
11
link
fedilink
52
message-square

Anyone knows if it's possible to color command line commands as you type them (kind of like an editor)?

Binette ( Binette@lemmy.ml )  to Linux@lemmy.mlEnglish · 2 years ago
message-square
11
link
fedilink
alert-triangle
You must log in or register to comment.
  • thingsiplay ( thingsiplay@beehaw.org ) 
    link
    fedilink
    arrow-up
    21
    ·
    2 years ago

    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 ( bubstance@lemmy.sdf.org ) deleted by creator
      link
      fedilink
      English
      arrow-up
      12
      ·
      2 years ago

      deleted by creator

      • Binette ( Binette@lemmy.ml ) OP
        link
        fedilink
        English
        arrow-up
        8
        ·
        2 years ago

        Tried it out and it works! Thanks!

      • t0mri ( t0mri@lemmy.ml ) deleted by creator
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        1 year ago

        deleted by creator

        • theshatterstone54 ( theshatterstone54@feddit.uk ) 
          link
          fedilink
          arrow-up
          1
          ·
          2 years ago

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

    • Binette ( Binette@lemmy.ml ) OP
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

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

      • hallettj ( hallettj@leminal.space ) 
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years 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 (he) ( boredsquirrel@slrpnk.net ) 
    link
    fedilink
    arrow-up
    17
    ·
    2 years 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)

  • ssm ( ssm@lemmy.sdf.org ) deleted by creator
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    2 years ago

    deleted by creator

  • Andy ( Andy@programming.dev ) 
    link
    fedilink
    arrow-up
    6
    ·
    2 years ago

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

  • Skull giver ( skullgiver@popplesburger.hilciferous.nl ) 
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    2 years ago

    deleted by creator

    • Gamma ( gamma@programming.dev ) 
      link
      fedilink
      English
      arrow-up
      8
      ·
      2 years ago

      zsh-syntax-highlighting

      There’s also a fork called fast-syntax-highlighting, I use it.

    • gomp ( gomp@lemmy.ml ) 
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      Powershell does this on Windows. May also work on Linux?

      Yes: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux

      Should you choose to install it, it will bring the total of people running powershell on linux to one :)

      (I’m kidding, of course, more or less)

      • Skull giver ( skullgiver@popplesburger.hilciferous.nl ) 
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        2 years ago

        deleted by creator

        • gomp ( gomp@lemmy.ml ) 
          link
          fedilink
          arrow-up
          1
          ·
          2 years ago

          Never used powershell (thanks heavens, I’ve not touched windows since windows 7). Is it similar to nushell?

          • Skull giver ( skullgiver@popplesburger.hilciferous.nl ) 
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            2 years ago

            deleted by creator

  • The Cuuuuube ( Cube6392@beehaw.org ) 
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 years ago

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

Linux@lemmy.ml

linux@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !linux@lemmy.ml

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

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

  • !opensource@lemmy.ml
  • !libre_culture@lemmy.ml
  • !technology@lemmy.ml
  • !libre_hardware@lemmy.ml

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

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 5.57K users / 6 months
  • 1.31K local subscribers
  • 68.1K subscribers
  • 8.11K Posts
  • 108K Comments
  • Modlog
  • mods:
  • AgreeableLandscape ( AgreeableLandscape@lemmy.ml ) deleted by creator
  • nooter692 ( nooter692@lemmy.ml ) 
  • MarcellusDrum ( MarcellusDrum@lemmy.ml ) 
  • Arthur Besse ( cypherpunks@lemmy.ml ) 
  • Cyclohexane ( cyclohexane@lemmy.ml ) 
  • d3Xt3r ( d3Xt3r@lemmy.nz ) deleted by creator
  • BE: 0.19.21
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code