Convert Figma logo to code with AI

zdharma-continuum logofast-syntax-highlighting

Feature-rich syntax highlighting for ZSH

1,127
76
1,127
36

Top Related Projects

Fish shell like syntax highlighting for Zsh.

Fish-like autosuggestions for zsh

A Zsh theme

172,325

🙃 A delightful community-driven (with 2,300+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.

13,946

The configuration framework for Zsh

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.

Quick Overview

Fast Syntax Highlighting is a feature-rich syntax highlighting plugin for Zsh. It provides real-time, optimized syntax highlighting for shell commands, supporting various color themes and customization options. The project aims to enhance the command-line experience by making it more visually appealing and easier to read.

Pros

  • Extremely fast and efficient highlighting, even for large files
  • Supports a wide range of programming languages and file types
  • Highly customizable with various themes and options
  • Actively maintained and regularly updated

Cons

  • Requires Zsh shell, not compatible with other shells like Bash
  • May have a slight learning curve for advanced customization
  • Can potentially slow down shell startup time if not configured properly
  • Some users may find the default color scheme too vibrant

Getting Started

To install Fast Syntax Highlighting, follow these steps:

  1. Clone the repository:
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
  ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
  1. Add the plugin to your .zshrc file:
plugins=(... fast-syntax-highlighting)
  1. Source your .zshrc file or restart your terminal:
source ~/.zshrc

After installation, Fast Syntax Highlighting will automatically start working. You can customize its behavior by adding configuration options to your .zshrc file. For example, to change the theme:

FAST_HIGHLIGHT_STYLES[comment]='fg=blue,bold'
FAST_HIGHLIGHT_STYLES[alias]='fg=magenta,bold'

For more advanced configuration options and features, refer to the project's documentation on GitHub.

Competitor Comparisons

Fish shell like syntax highlighting for Zsh.

Pros of zsh-syntax-highlighting

  • More established and widely used in the Zsh community
  • Simpler implementation, potentially easier to understand and modify
  • Broader compatibility with various Zsh versions and configurations

Cons of zsh-syntax-highlighting

  • Slower performance, especially with longer commands or complex scripts
  • Less frequent updates and maintenance compared to fast-syntax-highlighting
  • Limited customization options for highlighting styles and colors

Code Comparison

zsh-syntax-highlighting:

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
ZSH_HIGHLIGHT_STYLES[command]='fg=blue,bold'
ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta,bold'

fast-syntax-highlighting:

FAST_HIGHLIGHT_STYLES[command]='fg=blue,bold'
FAST_HIGHLIGHT_STYLES[alias]='fg=magenta,bold'
FAST_HIGHLIGHT_STYLES[globbing]='fg=cyan,bold'

fast-syntax-highlighting offers more granular control over highlighting styles and includes additional features like multi-line command highlighting and improved performance. However, zsh-syntax-highlighting remains a solid choice for users who prefer a simpler setup or have compatibility concerns with newer Zsh features.

Fish-like autosuggestions for zsh

Pros of zsh-autosuggestions

  • Provides real-time suggestions based on command history, enhancing productivity
  • Lightweight and focused on a single feature, making it easy to integrate
  • Customizable suggestion strategy and appearance

Cons of zsh-autosuggestions

  • Limited to autosuggestions only, lacking syntax highlighting capabilities
  • May slow down terminal performance in large directories or with extensive history

Code comparison

zsh-autosuggestions:

# Basic configuration
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'

fast-syntax-highlighting:

# Basic configuration
zinit light zdharma-continuum/fast-syntax-highlighting
fast-theme XDG:overlay

Summary

zsh-autosuggestions focuses on providing intelligent command suggestions, while fast-syntax-highlighting offers comprehensive syntax highlighting for the Zsh shell. The former enhances command input efficiency, while the latter improves readability and visual feedback. Users often combine both plugins for a more feature-rich Zsh experience, balancing the strengths of each to create a powerful and user-friendly command-line environment.

A Zsh theme

Pros of Powerlevel10k

  • Highly customizable prompt with many built-in segments and styles
  • Fast performance, even with complex configurations
  • Easy setup wizard for quick configuration

Cons of Powerlevel10k

  • Focused solely on prompt customization, not syntax highlighting
  • May require additional plugins for full shell functionality
  • Steeper learning curve for advanced customizations

Code Comparison

While a direct code comparison isn't relevant due to the different purposes of these projects, here's a brief example of how they might be used in a .zshrc file:

Fast-syntax-highlighting:

source /path/to/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh

Powerlevel10k:

source /path/to/powerlevel10k/powerlevel10k.zsh-theme

Summary

Fast-syntax-highlighting focuses on real-time syntax highlighting for the Zsh shell, enhancing readability and command recognition. Powerlevel10k, on the other hand, is a highly customizable Zsh theme that provides an informative and visually appealing prompt. While they serve different purposes, both can be used together to create a powerful and attractive Zsh environment. Fast-syntax-highlighting excels in improving command-line readability, while Powerlevel10k offers extensive prompt customization options and performance optimizations.

172,325

🙃 A delightful community-driven (with 2,300+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.

Pros of Oh My Zsh

  • Comprehensive framework with a wide range of plugins and themes
  • Large community and extensive documentation
  • Easy to set up and configure for beginners

Cons of Oh My Zsh

  • Can be slower to load due to its extensive feature set
  • May include unnecessary features for some users
  • Potential for conflicts between plugins

Code Comparison

Oh My Zsh (theme configuration):

ZSH_THEME="robbyrussell"
plugins=(git docker kubectl)
source $ZSH/oh-my-zsh.sh

Fast Syntax Highlighting (installation and activation):

git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
  ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
echo "source ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" >> ~/.zshrc

Fast Syntax Highlighting focuses solely on syntax highlighting, providing a faster and more efficient solution for this specific feature. Oh My Zsh, on the other hand, offers a complete Zsh configuration framework with various features beyond syntax highlighting. While Oh My Zsh is more beginner-friendly and feature-rich, Fast Syntax Highlighting may be preferred by users looking for a lightweight, performance-oriented syntax highlighting solution that can be integrated into their existing Zsh setup.

13,946

The configuration framework for Zsh

Pros of Prezto

  • Comprehensive Zsh configuration framework with a modular design
  • Includes a wide range of pre-configured modules for enhanced functionality
  • Offers a more complete shell environment out-of-the-box

Cons of Prezto

  • Heavier and potentially slower startup time compared to Fast-syntax-highlighting
  • May include unnecessary features for users who prefer a minimal setup
  • Requires more configuration and customization to tailor to specific needs

Code Comparison

Prezto (module loading):

zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory'

Fast-syntax-highlighting (basic usage):

source /path/to/fast-syntax-highlighting.plugin.zsh

Fast-syntax-highlighting focuses solely on syntax highlighting, while Prezto provides a full-featured Zsh configuration framework. Prezto requires more setup but offers a broader range of features, whereas Fast-syntax-highlighting is lightweight and specialized for improving command-line readability through syntax highlighting.

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.

Pros of zsh-autocomplete

  • Offers more comprehensive autocomplete suggestions, including file paths and command options
  • Provides real-time, as-you-type completion suggestions
  • Includes a menu-based selection system for easier navigation through suggestions

Cons of zsh-autocomplete

  • May have a steeper learning curve due to its more complex features
  • Can potentially slow down terminal performance on older systems or with large directories
  • Might conflict with other Zsh plugins or custom configurations

Code comparison

zsh-autocomplete:

zstyle ':autocomplete:*' min-input 1
zstyle ':autocomplete:*' insert-unambiguous yes
zstyle ':autocomplete:*' widget-style menu-select

fast-syntax-highlighting:

FAST_HIGHLIGHT[use_brackets]=1
FAST_HIGHLIGHT[use_pattern_matching]=1
FAST_HIGHLIGHT[use_regexp]=1

Summary

While fast-syntax-highlighting focuses primarily on syntax highlighting for Zsh, zsh-autocomplete offers a more comprehensive autocomplete solution. fast-syntax-highlighting is generally lighter and faster, making it ideal for users who prioritize performance and simplicity. On the other hand, zsh-autocomplete provides a richer set of features for those who want more advanced autocompletion capabilities, albeit with potential performance trade-offs on some systems.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Fast Syntax Highlighting (F-Sy-H) Gitter

Feature rich syntax highlighting for Zsh.

image could not be loaded

Table of Contents

Other Contents

News

  • 15-06-2019
    • A new architecture for defining the highlighting for specific commands: it now uses abstract definitions instead of top-down, regular code. The first effect is the highlighting for the git command it is now maximally faithful, it follows the git command almost completely. Screencast

Installation

Manual

Clone the Repository.

git clone https://github.com/zdharma-continuum/fast-syntax-highlighting ~/path/to/fsh

And add the following to your zshrc file.

source ~/path/to/fsh/fast-syntax-highlighting.plugin.zsh

Zinit

Add the following to your zshrc file.

zinit light zdharma-continuum/fast-syntax-highlighting

Here's an example of how to load the plugin together with a few other popular ones with the use of Turbo, i.e.: speeding up the Zsh startup by loading the plugin right after the first prompt, in background:

zinit wait lucid for \
 atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
    zdharma-continuum/fast-syntax-highlighting \
 blockf \
    zsh-users/zsh-completions \
 atload"!_zsh_autosuggest_start" \
    zsh-users/zsh-autosuggestions

Antigen

Add the following to your zshrc file.

antigen bundle zdharma-continuum/fast-syntax-highlighting

Fig

Fig adds apps, shortcuts, and autocomplete to your existing terminal.

Install fast-syntax-highlighting in just one click.

Zgen

Add the following to your .zshrc file in the same place you're doing your other zgen load calls in.

zgen load zdharma-continuum/fast-syntax-highlighting

Oh-My-Zsh

Clone the Repository.

git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
  ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

And add fast-syntax-highlighting to your plugin list.

Features

Themes

Switch themes via fast-theme {theme-name}.

image could not be loaded

Run fast-theme -t {theme-name} option to obtain the snippet above.

Run fast-theme -l to list available themes.

Variables

Comparing to the project zsh-users/zsh-syntax-highlighting (the upper line):

image could not be loaded
image could not be loaded

Brackets

image could not be loaded

Conditions

Comparing to the project zsh-users/zsh-syntax-highlighting (the upper line):

image could not be loaded

Strings

Exact highlighting that recognizes quotings.

image could not be loaded

here-strings

image could not be loaded

exec descriptor-variables

Comparing to the project zsh-users/zsh-syntax-highlighting (the upper line):

image could not be loaded

for-loops and alternate syntax (brace {/} blocks)

image could not be loaded

Function definitions

Comparing to the project zsh-users/zsh-syntax-highlighting (the upper 2 lines):

image could not be loaded

Recursive eval and $( ) highlighting

Comparing to the project zsh-users/zsh-syntax-highlighting (the upper line):

image could not be loaded

Chroma functions

Highlighting that is specific for a given command.

image could not be loaded

The chromas that are enabled by default can be found here.

Math-mode highlighting

image could not be loaded

Zcalc highlighting

image could not be loaded

Performance

Performance differences can be observed in this Asciinema recording, where a 10 kB function is being edited.