diff --git a/.editorconfig b/.editorconfig
index 9e9506e..c25c645 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,6 +1,7 @@
# Space or Tabs?
# https://stackoverflow.com/questions/35649847/objective-reasons-for-using-spaces-instead-of-tabs-for-indentation
# https://stackoverflow.com/questions/12093748/how-to-use-tabs-instead-of-spaces-in-a-shell-script
+# https://github.com/editorconfig/editorconfig-defaults/blob/master/editorconfig-defaults.json
#
# 1. What happens when I press the Tab key in my text editor?
# 2. What happens when I request my editor to indent one or more lines?
@@ -57,302 +58,3 @@ indent_size = 4
[*.{cs,csx,cake,vb,vbx}]
# Default Severity for all .NET Code Style rules below
dotnet_analyzer_diagnostic.severity = warning
-
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules
-[*.{cs,csx,cake,vb,vbx}]
-# "this." and "Me." qualifiers
-dotnet_style_qualification_for_field = true:warning
-dotnet_style_qualification_for_property = true:warning
-dotnet_style_qualification_for_method = true:warning
-dotnet_style_qualification_for_event = true:warning
-# Language keywords instead of framework type names for type references
-dotnet_style_predefined_type_for_locals_parameters_members = true:warning
-dotnet_style_predefined_type_for_member_access = true:warning
-# Modifier preferences
-dotnet_style_require_accessibility_modifiers = always:warning
-csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
-visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning
-dotnet_style_readonly_field = true:warning
-# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
-# Expression-level preferences
-dotnet_style_object_initializer = true:warning
-dotnet_style_collection_initializer = true:warning
-dotnet_style_explicit_tuple_names = true:warning
-dotnet_style_prefer_inferred_tuple_names = true:warning
-dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
-dotnet_style_prefer_auto_properties = true:warning
-dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
-dotnet_diagnostic.IDE0045.severity = suggestion
-dotnet_style_prefer_conditional_expression_over_return = false:suggestion
-dotnet_diagnostic.IDE0046.severity = suggestion
-dotnet_style_prefer_compound_assignment = true:warning
-dotnet_style_prefer_simplified_interpolation = true:warning
-dotnet_style_prefer_simplified_boolean_expressions = true:warning
-# Null-checking preferences
-dotnet_style_coalesce_expression = true:warning
-dotnet_style_null_propagation = true:warning
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
-# File header preferences
-# file_header_template = \n© PROJECT-AUTHOR\n
-# If you use StyleCop, you'll need to disable SA1636: File header copyright text should match.
-# dotnet_diagnostic.SA1636.severity = none
-# Undocumented
-dotnet_style_operator_placement_when_wrapping = end_of_line:warning
-csharp_style_prefer_null_check_over_type_check = true:warning
-
-# C# Style Rules
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules
-[*.{cs,csx,cake}]
-# 'var' preferences
-csharp_style_var_for_built_in_types = true:warning
-csharp_style_var_when_type_is_apparent = true:warning
-csharp_style_var_elsewhere = true:warning
-# Expression-bodied members
-csharp_style_expression_bodied_methods = true:warning
-csharp_style_expression_bodied_constructors = true:warning
-csharp_style_expression_bodied_operators = true:warning
-csharp_style_expression_bodied_properties = true:warning
-csharp_style_expression_bodied_indexers = true:warning
-csharp_style_expression_bodied_accessors = true:warning
-csharp_style_expression_bodied_lambdas = true:warning
-csharp_style_expression_bodied_local_functions = true:warning
-# Pattern matching preferences
-csharp_style_pattern_matching_over_is_with_cast_check = true:warning
-csharp_style_pattern_matching_over_as_with_null_check = true:warning
-csharp_style_prefer_switch_expression = true:warning
-csharp_style_prefer_pattern_matching = true:warning
-csharp_style_prefer_not_pattern = true:warning
-# Expression-level preferences
-csharp_style_inlined_variable_declaration = true:warning
-csharp_prefer_simple_default_expression = true:warning
-csharp_style_pattern_local_over_anonymous_function = true:warning
-csharp_style_deconstructed_variable_declaration = true:warning
-csharp_style_prefer_index_operator = true:warning
-csharp_style_prefer_range_operator = true:warning
-csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
-# "Null" checking preferences
-csharp_style_throw_expression = true:warning
-csharp_style_conditional_delegate_call = true:warning
-# Code block preferences
-csharp_prefer_braces = true:warning
-csharp_prefer_simple_using_statement = true:suggestion
-dotnet_diagnostic.IDE0063.severity = suggestion
-# 'using' directive preferences
-csharp_using_directive_placement = inside_namespace:warning
-# Modifier preferences
-csharp_prefer_static_local_function = true:warning
-
-# .NET Unnecessary code rules
-[*.{cs,csx,cake,vb,vbx}]
-dotnet_code_quality_unused_parameters = all:warning
-dotnet_remove_unnecessary_suppression_exclusions = none:warning
-
-# C# Unnecessary code rules
-[*.{cs,csx,cake}]
-csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
-dotnet_diagnostic.IDE0058.severity = suggestion
-csharp_style_unused_value_assignment_preference = discard_variable:suggestion
-dotnet_diagnostic.IDE0059.severity = suggestion
-
-# .NET formatting rules
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#net-formatting-rules
-[*.{cs,csx,cake,vb,vbx}]
-# Organize using directives
-dotnet_sort_system_directives_first = true
-dotnet_separate_import_directive_groups = false
-# Dotnet namespace options
-dotnet_style_namespace_match_folder = true:suggestion
-dotnet_diagnostic.IDE0130.severity = suggestion
-
-# C# formatting rules
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#c-formatting-rules
-[*.{cs,csx,cake}]
-# Newline options
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#new-line-options
-csharp_new_line_before_open_brace = all
-csharp_new_line_before_else = true
-csharp_new_line_before_catch = true
-csharp_new_line_before_finally = true
-csharp_new_line_before_members_in_object_initializers = true
-csharp_new_line_before_members_in_anonymous_types = true
-csharp_new_line_between_query_expression_clauses = true
-# Indentation options
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#indentation-options
-csharp_indent_case_contents = true
-csharp_indent_switch_labels = true
-csharp_indent_labels = no_change
-csharp_indent_block_contents = true
-csharp_indent_braces = false
-csharp_indent_case_contents_when_block = false
-# Spacing options
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#spacing-options
-csharp_space_after_cast = false
-csharp_space_after_keywords_in_control_flow_statements = true
-csharp_space_between_parentheses = false
-csharp_space_before_colon_in_inheritance_clause = true
-csharp_space_after_colon_in_inheritance_clause = true
-csharp_space_around_binary_operators = before_and_after
-csharp_space_between_method_declaration_parameter_list_parentheses = false
-csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
-csharp_space_between_method_declaration_name_and_open_parenthesis = false
-csharp_space_between_method_call_parameter_list_parentheses = false
-csharp_space_between_method_call_empty_parameter_list_parentheses = false
-csharp_space_between_method_call_name_and_opening_parenthesis = false
-csharp_space_after_comma = true
-csharp_space_before_comma = false
-csharp_space_after_dot = false
-csharp_space_before_dot = false
-csharp_space_after_semicolon_in_for_statement = true
-csharp_space_before_semicolon_in_for_statement = false
-csharp_space_around_declaration_statements = false
-csharp_space_before_open_square_brackets = false
-csharp_space_between_empty_square_brackets = false
-csharp_space_between_square_brackets = false
-# Wrap options
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#wrap-options
-csharp_preserve_single_line_statements = false
-csharp_preserve_single_line_blocks = true
-# Namespace options
-# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#namespace-options
-csharp_style_namespace_declarations = file_scoped:warning
-
-[*.{cs,csx,cake,vb,vbx}]
-
-# camel_case_style - Define the camelCase style
-dotnet_naming_style.camel_case_style.capitalization = camel_case
-# pascal_case_style - Define the PascalCase style
-dotnet_naming_style.pascal_case_style.capitalization = pascal_case
-# first_upper_style - The first character must start with an upper-case character
-dotnet_naming_style.first_upper_style.capitalization = first_word_upper
-# prefix_interface_with_i_style - Interfaces must be PascalCase and the first character of an interface must be an 'I'
-dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case
-dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I
-# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T'
-dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case
-dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T
-# disallowed_style - Anything that has this style applied is marked as disallowed
-dotnet_naming_style.disallowed_style.capitalization = pascal_case
-dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
-dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
-# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file
-dotnet_naming_style.internal_error_style.capitalization = pascal_case
-dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____
-dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____
-
-# All public/protected/protected_internal constant fields must be PascalCase
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
-dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal
-dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const
-dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field
-dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group
-dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
-dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning
-
-# All public/protected/protected_internal static readonly fields must be PascalCase
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
-dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal
-dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly
-dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field
-dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group
-dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
-dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning
-
-# No other public/protected/protected_internal fields are allowed
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
-dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal
-dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field
-dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group
-dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style
-dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error
-
-# All constant fields must be PascalCase
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md
-dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
-dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
-dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
-dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
-dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
-dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning
-
-# All static readonly fields must be PascalCase
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md
-dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
-dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
-dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
-dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group
-dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
-dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning
-
-# No non-private instance fields are allowed
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
-dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
-dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
-dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
-dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
-dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error
-
-# Private fields must be camelCase
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md
-dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private
-dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field
-dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group
-dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style
-dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning
-
-# Local variables must be camelCase
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md
-dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local
-dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local
-dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group
-dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style
-dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent
-
-# This rule should never fire. However, it's included for at least two purposes:
-# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers.
-# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#).
-dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = *
-dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field
-dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group
-dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style
-dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error
-
-# All of the following must be PascalCase:
-# - Namespaces
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-namespaces
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md
-# - Classes and Enumerations
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
-# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md
-# - Delegates
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types
-# - Constructors, Properties, Events, Methods
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members
-dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property
-dotnet_naming_rule.element_rule.symbols = element_group
-dotnet_naming_rule.element_rule.style = pascal_case_style
-dotnet_naming_rule.element_rule.severity = warning
-
-# Interfaces use PascalCase and are prefixed with uppercase 'I'
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
-dotnet_naming_symbols.interface_group.applicable_kinds = interface
-dotnet_naming_rule.interface_rule.symbols = interface_group
-dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style
-dotnet_naming_rule.interface_rule.severity = warning
-
-# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T'
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
-dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter
-dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group
-dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style
-dotnet_naming_rule.type_parameter_rule.severity = warning
-
-# Function parameters use camelCase
-# https://docs.microsoft.com/dotnet/standard/design-guidelines/naming-parameters
-dotnet_naming_symbols.parameters_group.applicable_kinds = parameter
-dotnet_naming_rule.parameters_rule.symbols = parameters_group
-dotnet_naming_rule.parameters_rule.style = camel_case_style
-dotnet_naming_rule.parameters_rule.severity = warning
diff --git a/.github/workflows/zsh-n.yml b/.github/workflows/zsh-n.yml
new file mode 100644
index 0000000..72c2666
--- /dev/null
+++ b/.github/workflows/zsh-n.yml
@@ -0,0 +1,57 @@
+---
+name: "✅ Zsh"
+on:
+ push:
+ paths:
+ - "**/*.ch"
+ - "**/*.zsh"
+ - "tests/*"
+ - "share/*"
+ - "themes/*"
+ - "functions/*"
+ pull_request:
+ paths:
+ - "**/*.ch"
+ - "**/*.zsh"
+ - "tests/*"
+ - "share/*"
+ - "themes/*"
+ - "functions/*"
+ workflow_dispatch: {}
+
+jobs:
+ zsh-matrix:
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - name: ⤵️ Check out code from GitHub
+ uses: actions/checkout@v3
+ - name: "⚡ Set matrix output"
+ id: set-matrix
+ run: |
+ MATRIX="$(find . -type d -name 'doc' -prune -o -type f \( -iname '*.zsh' -o -iname '*.ch' -o -iname 'fast-*' \) -print | jq -ncR '{"include": [{"file": inputs}]}')"
+ echo "MATRIX=${MATRIX}" >&2
+ echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
+ zsh-n:
+ runs-on: ubuntu-latest
+ needs: zsh-matrix
+ strategy:
+ fail-fast: false
+ matrix: ${{ fromJSON(needs.zsh-matrix.outputs.matrix) }}
+ steps:
+ - name: ⤵️ Check out code from GitHub
+ uses: actions/checkout@v3
+ - name: "⚡ Install dependencies"
+ run: sudo apt update && sudo apt-get install -yq zsh
+ - name: "⚡ zsh -n: ${{ matrix.file }}"
+ env:
+ ZSH_FILE: ${{ matrix.file }}
+ run: |
+ zsh -n "${ZSH_FILE}"
+ - name: "⚡ zcompile ${{ matrix.file }}"
+ env:
+ ZSH_FILE: ${{ matrix.file }}
+ run: |
+ zsh -fc "zcompile ${ZSH_FILE}"; rc=$?
+ ls -al "${ZSH_FILE}.zwc"; exit "$rc"
diff --git a/.github/workflows/zunit.yml b/.github/workflows/zunit.yml
index 4c8304c..78d107d 100644
--- a/.github/workflows/zunit.yml
+++ b/.github/workflows/zunit.yml
@@ -4,9 +4,21 @@ name: 🛡️ ZUnit
on:
workflow_dispatch:
push:
- branches: ["main", "develop"]
+ paths:
+ - "**/*.ch"
+ - "**/*.zsh"
+ - "tests/*"
+ - "share/*"
+ - "themes/*"
+ - "functions/*"
pull_request_target:
- branches: ["main", "develop"]
+ paths:
+ - "**/*.ch"
+ - "**/*.zsh"
+ - "tests/*"
+ - "share/*"
+ - "themes/*"
+ - "functions/*"
jobs:
build-macos:
diff --git a/.gitignore b/.gitignore
index 7fda70a..6711d38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ test/res
hold/*
*.zwc
._zi
+out.parse
### Vim
# Swap
diff --git a/.trunk/.gitignore b/.trunk/.gitignore
index 507283d..cf2f254 100644
--- a/.trunk/.gitignore
+++ b/.trunk/.gitignore
@@ -1,3 +1,7 @@
*out
*logs
-external
+*actions
+*notifications
+plugins
+user_trunk.yaml
+user.yaml
diff --git a/.github/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml
similarity index 94%
rename from .github/.markdownlint.yaml
rename to .trunk/configs/.markdownlint.yaml
index 465a928..fb94039 100644
--- a/.github/.markdownlint.yaml
+++ b/.trunk/configs/.markdownlint.yaml
@@ -8,4 +8,3 @@ line_length: false
spaces: false
url: false
whitespace: false
-MD041: false
diff --git a/.trunk/configs/.shellcheckrc b/.trunk/configs/.shellcheckrc
new file mode 100644
index 0000000..8c7b1ad
--- /dev/null
+++ b/.trunk/configs/.shellcheckrc
@@ -0,0 +1,7 @@
+enable=all
+source-path=SCRIPTDIR
+disable=SC2154
+
+# If you're having issues with shellcheck following source, disable the errors via:
+# disable=SC1090
+# disable=SC1091
diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml
index f256861..60c6f16 100644
--- a/.trunk/trunk.yaml
+++ b/.trunk/trunk.yaml
@@ -1,25 +1,32 @@
version: 0.1
cli:
- version: 0.15.1-beta
-repo:
- repo:
- host: github.com
- owner: z-shell
- name: F-Sy-H
+ version: 1.3.2
+plugins:
+ sources:
+ - id: trunk
+ ref: v0.0.8
+ uri: https://github.com/trunk-io/plugins
lint:
- linters:
- - name: markdownlint
- command:
- [markdownlint, -q, --config, .github/.markdownlint.yaml, "${target}"]
- direct_configs: [.github/.markdownlint.yaml]
enabled:
- - git-diff-check@SYSTEM
- - actionlint@1.6.15
- - gitleaks@8.9.0
- - markdownlint@0.32.1
- - prettier@2.7.1
+ - gitleaks@8.15.3
+ - shellcheck@0.9.0
+ - git-diff-check
+ - actionlint@1.6.23
- shfmt@3.5.0
+ - markdownlint@0.33.0
+ - oxipng@8.0.0
+ - prettier@2.8.3
ignore:
- linters: [ALL]
paths:
- "share/test/**"
+runtimes:
+ enabled:
+ - go@1.18.3
+ - node@18.12.1
+actions:
+ enabled:
+ - trunk-announce
+ - trunk-check-pre-push
+ - trunk-fmt-pre-commit
+ - trunk-upgrade-available
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 5081fb3..dad4de1 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,11 +1,8 @@
{
- "conventionalCommits.scopes": [
- "maintenance",
- "workspace",
- "general",
- "theme"
- ],
- "markdownlint.config": {
- "extends": ".github/.markdownlint.yaml"
+ "files.associations": {
+ "*za-*": "shellscript",
+ ".ch": "shellscript",
+ "fast-*": "shellscript",
+ ".fast-*": "shellscript"
}
}
diff --git a/.zunit.yml b/.zunit.yml
index e4fd57f..984fc97 100644
--- a/.zunit.yml
+++ b/.zunit.yml
@@ -1,8 +1,6 @@
tap: false
directories:
tests: tests
- output: tests/_output
- support: tests/_support
time_limit: 0
fail_fast: false
allow_risky: false
diff --git a/F-Sy-H.plugin.zsh b/F-Sy-H.plugin.zsh
old mode 100644
new mode 100755
index 3acb789..1b1415c
--- a/F-Sy-H.plugin.zsh
+++ b/F-Sy-H.plugin.zsh
@@ -26,51 +26,46 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
-
-
-# Standarized way of handling finding plugin dir,
+#
+# Standardized way of handling finding plugin dir,
# regardless of functionargzero and posixargzero,
# and with an option for a plugin manager to alter
# the plugin directory (i.e. set ZERO parameter)
#
# Standardized $0 Handling
-# https://z.digitalclouds.dev/community/zsh_plugin_standard#zero-handling
+# https://wiki.zshell.dev/community/zsh_plugin_standard#zero-handling
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
0="${${(M)0:#/*}:-$PWD/$0}"
-typeset -g FAST_HIGHLIGHT_VERSION=1.66
-typeset -g FAST_BASE_DIR="${0:h}"
-typeset -ga _FAST_MAIN_CACHE
-# Holds list of indices pointing at brackets that
-# are complex, i.e. e.g. part of "[[" in [[ ... ]]
-typeset -ga _FAST_COMPLEX_BRACKETS
-
# Functions Directory
-# https://z.digitalclouds.dev/community/zsh_plugin_standard#funtions-directory
+# https://wiki.zshell.dev/community/zsh_plugin_standard#funtions-directory
if [[ $PMSPEC != *f* ]]; then
fpath+=( "${0:h}/functions" )
fi
-# Check if Zsh's cache directory exist.
-if [[ -d $ZSH_CACHE_DIR ]]; then
- # Use Zsh's default cache directory.
- typeset -g FAST_WORK_DIR=${FAST_WORK_DIR:-${ZSH_CACHE_DIR}/fsh}
-else
- # Use common values to set default working directory.
- typeset -g FAST_WORK_DIR=${FAST_WORK_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/fsh}
-fi
+# Default global variables
+typeset -g FAST_HIGHLIGHT_VERSION=1.67
+typeset -g FAST_BASE_DIR="${0:h}"
+typeset -ga _FAST_MAIN_CACHE
+# Holds list of indices pointing at brackets that are complex, i.e. e.g. part of "[[" in [[ ... ]]
+typeset -ga _FAST_COMPLEX_BRACKETS
+
+# Allow user to override the working directory,
+# but default to $XDG_CACHE_HOME/f-sy-h and fall back to $FAST_BASE_DIR.
+typeset -g FAST_WORK_DIR=${FAST_WORK_DIR:-${XDG_CACHE_HOME:-~/.cache}/f-sy-h}
: ${FAST_WORK_DIR:=$FAST_BASE_DIR}
-# Expand any tilde in the (supposed) path.
FAST_WORK_DIR=${~FAST_WORK_DIR}
# Create working directory if it doesn't exist.
-[[ -w $FAST_WORK_DIR ]] || command mkdir -p "$FAST_WORK_DIR"
+[[ -w $FAST_WORK_DIR ]] || command mkdir -p "$FAST_WORK_DIR" || {
+ print -u2 "f-sy-h: cannot create working directory $FAST_WORK_DIR"
+ return 1
+}
# Invokes each highlighter that needs updating.
# This function is supposed to be called whenever the ZLE state changes.
-_zsh_highlight()
-{
+_zsh_highlight() {
# Store the previous command return code to restore it whatever happens.
local ret=$?
@@ -81,8 +76,8 @@ _zsh_highlight()
return $ret
fi
- emulate -LR zsh
- setopt extendedglob warncreateglobal typesetsilent noshortloops
+ builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+ builtin setopt extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd
local REPLY # don't leak $REPLY into global scope
local -a reply
@@ -141,13 +136,16 @@ _zsh_highlight()
fi
# yank / paste (zsh-5.1.1 and newer)
- (( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END"
+ (( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && \
+ _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END"
# isearch
- (( $+ISEARCHMATCH_ACTIVE )) && (( ISEARCHMATCH_ACTIVE )) && _zsh_highlight_apply_zle_highlight isearch underline "$ISEARCHMATCH_START" "$ISEARCHMATCH_END"
+ (( $+ISEARCHMATCH_ACTIVE )) && (( ISEARCHMATCH_ACTIVE )) && \
+ _zsh_highlight_apply_zle_highlight isearch underline "$ISEARCHMATCH_START" "$ISEARCHMATCH_END"
# suffix
- (( $+SUFFIX_ACTIVE )) && (( SUFFIX_ACTIVE )) && _zsh_highlight_apply_zle_highlight suffix bold "$SUFFIX_START" "$SUFFIX_END"
+ (( $+SUFFIX_ACTIVE )) && (( SUFFIX_ACTIVE )) && \
+ _zsh_highlight_apply_zle_highlight suffix bold "$SUFFIX_START" "$SUFFIX_END"
return $ret
@@ -202,16 +200,16 @@ _zsh_highlight_apply_zle_highlight() {
# Whether the command line buffer has been modified or not.
#
# Returns 0 if the buffer has changed since _zsh_highlight was last called.
-_zsh_highlight_buffer_modified()
-{
- [[ "${_ZSH_HIGHLIGHT_PRIOR_BUFFER:-}" != "$BUFFER" ]] || [[ "$REGION_ACTIVE" != "$_ZSH_HIGHLIGHT_PRIOR_RACTIVE" ]] || { _zsh_highlight_cursor_moved && [[ "$REGION_ACTIVE" = 1 || "$REGION_ACTIVE" = 2 ]] }
+_zsh_highlight_buffer_modified() {
+ [[ "${_ZSH_HIGHLIGHT_PRIOR_BUFFER:-}" != "$BUFFER" ]] || \
+ [[ "$REGION_ACTIVE" != "$_ZSH_HIGHLIGHT_PRIOR_RACTIVE" ]] || \
+ { _zsh_highlight_cursor_moved && [[ "$REGION_ACTIVE" = 1 || "$REGION_ACTIVE" = 2 ]] }
}
# Whether the cursor has moved or not.
#
# Returns 0 if the cursor has moved since _zsh_highlight was last called.
-_zsh_highlight_cursor_moved()
-{
+_zsh_highlight_cursor_moved() {
[[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (($_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR))
}
@@ -221,8 +219,7 @@ _zsh_highlight_cursor_moved()
# Helper for _zsh_highlight_bind_widgets
# $1 is name of widget to call
-_zsh_highlight_call_widget()
-{
+_zsh_highlight_call_widget() {
integer ret
builtin zle "$@"
ret=$?
@@ -231,15 +228,14 @@ _zsh_highlight_call_widget()
}
# Rebind all ZLE widgets to make them invoke _zsh_highlights.
-_zsh_highlight_bind_widgets()
-{
- setopt localoptions noksharrays
+_zsh_highlight_bind_widgets() {
+ builtin setopt local_options no_ksh_arrays
local -F2 SECONDS
local prefix=orig-s${SECONDS/./}-r$(( RANDOM % 1000 )) # unique each time, in case we're sourced more than once
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
zmodload zsh/zleparameter 2>/dev/null || {
- print -r -- >&2 'zsh-syntax-highlighting: failed loading zsh/zleparameter.'
+ builtin print -r -- >&2 'zsh-syntax-highlighting: failed loading zsh/zleparameter.'
return 1
}
@@ -290,7 +286,7 @@ _zsh_highlight_bind_widgets()
zle -N -- $cur_widget _zsh_highlight_widget_$cur_widget
else
# Default: unhandled case.
- print -r -- >&2 "zsh-syntax-highlighting: unhandled ZLE widget ${(qq)cur_widget}"
+ builtin print -r -- >&2 "zsh-syntax-highlighting: unhandled ZLE widget ${(qq)cur_widget}"
fi
esac
done
@@ -302,13 +298,12 @@ _zsh_highlight_bind_widgets()
# Try binding widgets.
_zsh_highlight_bind_widgets || {
- print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.'
+ builtin print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.'
return 1
}
-# Reset scratch variables when commandline is done.
-_zsh_highlight_preexec_hook()
-{
+# Reset scratch variables when command line is done.
+_zsh_highlight_preexec_hook() {
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=0
typeset -ga _FAST_MAIN_CACHE
@@ -317,35 +312,65 @@ _zsh_highlight_preexec_hook()
autoload -Uz add-zsh-hook
add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || {
- print -r -- >&2 'zsh-syntax-highlighting: failed loading add-zsh-hook.'
+ builtin print -r -- >&2 'zsh-syntax-highlighting: failed loading add-zsh-hook.'
}
-/fshdbg() {
- print -r -- "$@" >>! /tmp/reply
+/f-sy-h-debug() {
+ builtin print -r -- "$@" >>! /tmp/reply
}
-ZSH_HIGHLIGHT_MAXLENGTH=10000
+typeset -g ZSH_HIGHLIGHT_MAXLENGTH=10000
# Load zsh/parameter module if available
zmodload zsh/parameter 2>/dev/null
zmodload zsh/system 2>/dev/null
-autoload -Uz -- is-at-least fast-theme \
+autoload -Uz -- is-at-least \
.fast-read-ini-file .fast-run-git-command \
.fast-make-targets .fast-run-command .fast-zts-read-all
-autoload -Uz -- →chroma/-git.ch →chroma/-hub.ch →chroma/-lab.ch →chroma/-example.ch \
- →chroma/-grep.ch →chroma/-perl.ch →chroma/-make.ch →chroma/-awk.ch \
- →chroma/-vim.ch →chroma/-source.ch →chroma/-sh.ch →chroma/-docker.ch \
- →chroma/-autoload.ch →chroma/-ssh.ch →chroma/-scp.ch →chroma/-which.ch \
- →chroma/-printf.ch →chroma/-ruby.ch →chroma/-whatis.ch →chroma/-alias.ch \
- →chroma/-subcommand.ch →chroma/-autorandr.ch →chroma/-nmcli.ch \
- →chroma/-fast-theme.ch →chroma/-node.ch →chroma/-fpath_peq.ch \
- →chroma/-precommand.ch →chroma/-subversion.ch →chroma/-ionice.ch \
- →chroma/-nice.ch →chroma/main-chroma.ch →chroma/-ogit.ch →chroma/-zi.ch
+# Disabled: chroma/-vim.ch chroma/-which.ch
+autoload -Uz -- \
+ chroma/-alias.ch \
+ chroma/-autoload.ch \
+ chroma/-autorandr.ch \
+ chroma/-awk.ch \
+ chroma/-docker.ch \
+ chroma/-fpath_peq.ch \
+ chroma/-git.ch \
+ chroma/-grep.ch \
+ chroma/-hub.ch \
+ chroma/-ionice.ch \
+ chroma/-lab.ch \
+ chroma/-make.ch \
+ chroma/-nice.ch \
+ chroma/-nmcli.ch \
+ chroma/-node.ch \
+ chroma/-ogit.ch \
+ chroma/-perl.ch \
+ chroma/-precommand.ch \
+ chroma/-printf.ch \
+ chroma/-ruby.ch \
+ chroma/-scp.ch \
+ chroma/-sh.ch \
+ chroma/-source.ch \
+ chroma/-ssh.ch \
+ chroma/-subcommand.ch \
+ chroma/-subversion.ch \
+ chroma/-whatis.ch \
+ chroma/-zi.ch \
+ chroma/main-chroma.ch
+
+if (( FAST_THEME_MANAGER_DISABLED )) {
+ unset '_comps[fast-theme]' 2>/dev/null
+ unset -f chroma/-fast-theme.ch 2>/dev/null
+} else {
+ autoload -Uz -- fast-theme chroma/-fast-theme.ch chroma/-example.ch
+ alias f-sy-h=fast-theme
+}
-source "${0:h}/fast-highlight"
-source "${0:h}/fast-string-highlight"
+source "${0:h}/functions/fast-highlight"
+source "${0:h}/functions/fast-string-highlight"
local __fsyh_theme
zstyle -s :plugin:fast-syntax-highlighting theme __fsyh_theme
@@ -367,25 +392,17 @@ zstyle -s :plugin:fast-syntax-highlighting theme __fsyh_theme
unset __fsyh_theme
-alias fsh-alias=fast-theme
-
-fast-highlight-fill-option-variables
+
if [[ ! -e $FAST_WORK_DIR/secondary_theme.zsh ]] {
+ local theme_link=https://raw.githubusercontent.com/z-shell/F-Sy-H/main/share/free_theme.zsh
if { type curl &>/dev/null } {
- curl -fsSL -o "$FAST_WORK_DIR/secondary_theme.zsh" \
- https://raw.githubusercontent.com/z-shell/F-Sy-H/main/share/free_theme.zsh \
- &>/dev/null
+ command curl -fsSL -o "$FAST_WORK_DIR/secondary_theme.zsh" $theme_link &>/dev/null
} elif { type wget &>/dev/null } {
- wget -O "$FAST_WORK_DIR/secondary_theme.zsh" \
- https://raw.githubusercontent.com/z-shell/F-Sy-H/main/share/free_theme.zsh \
- &>/dev/null
+ command wget -O "$FAST_WORK_DIR/secondary_theme.zsh" $theme_link &>/dev/null
}
touch "$FAST_WORK_DIR/secondary_theme.zsh"
-}
-
-if [[ $(uname -a) = (#i)*darwin* ]] {
- typeset -gA FAST_HIGHLIGHT
- FAST_HIGHLIGHT[chroma-man]=
+ unset theme_link
}
[[ $COLORTERM == (24bit|truecolor) || ${terminfo[colors]} -eq 16777216 ]] || zmodload zsh/nearcolor &>/dev/null || true
diff --git "a/\342\206\222chroma/-alias.ch" b/chroma/-alias.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-alias.ch"
rename to chroma/-alias.ch
index 91462d0..e10edc5
--- "a/\342\206\222chroma/-alias.ch"
+++ b/chroma/-alias.ch
@@ -1,5 +1,7 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
+
(( next_word = 2 | 8192 ))
[[ "$__arg_type" = 3 ]] && return 2
@@ -28,5 +30,3 @@ fi
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git a/chroma/-autoload.ch b/chroma/-autoload.ch
new file mode 100755
index 0000000..fccb74d
--- /dev/null
+++ b/chroma/-autoload.ch
@@ -0,0 +1,103 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# Tracks autoload command - highlights function names if they exist somewhere
+# in $fpath. Also warns that the autoload function is already defined.
+#
+# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
+#
+# $2 - the current token, also accessible by $__arg from the above scope -
+# basically a private copy of $__arg; the token can be eg.: "grep"
+#
+# $3 - a private copy of $_start_pos, i.e. the position of the token in the
+# command line buffer, used to add region_highlight entry (see man),
+# because Zsh colorizes by *ranges* in command line buffer
+#
+# $4 - a private copy of $_end_pos from the above scope
+#
+
+(( next_word = 2 | 8192 ))
+
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
+local __style __chars
+integer __idx1 __idx2
+local -a __results __deserialized __noshsplit
+
+# First call, i.e. command starts, i.e. "grep" token etc.
+(( __first_call )) && {
+ FAST_HIGHLIGHT[chroma-autoload-counter]=0
+ FAST_HIGHLIGHT[chroma-autoload-counter-all]=1
+ FAST_HIGHLIGHT[chroma-autoload-message]=""
+ #FAST_HIGHLIGHT[chroma-autoload-message-shown]=""
+ [[ -z ${FAST_HIGHLIGHT[chroma-autoload-message-shown-at]} ]] && FAST_HIGHLIGHT[chroma-autoload-message-shown-at]=0
+ FAST_HIGHLIGHT[chroma-autoload-elements]=""
+ __style=${FAST_THEME_NAME}command
+
+} || {
+ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+ fi
+ (( FAST_HIGHLIGHT[chroma-autoload-counter-all] += 1, __idx2 = FAST_HIGHLIGHT[chroma-autoload-counter-all] ))
+
+ # Following call, i.e. not the first one.
+
+ # Check if chroma should end – test if token is of type
+ # "starts new command", if so pass-through – chroma ends
+ [[ "$__arg_type" = 3 ]] && return 2
+
+ if [[ "$__wrd" = [-+]* ]]; then
+ # Detected option, add style for it.
+ [[ "$__wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
+ __style=${FAST_THEME_NAME}single-hyphen-option
+ else
+ # Count non-option tokens.
+ (( FAST_HIGHLIGHT[chroma-autoload-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-autoload-counter] ))
+
+ if [[ $__wrd != (\$|\"\$)* && $__wrd != (/|\"/|\'/)* && $__wrd != \`* ]]; then
+ __results=( ${^fpath}/$__wrd(N) )
+ __deserialized=( "${(Q@)${(z@)FAST_HIGHLIGHT[chroma-fpath_peq-elements]}}" )
+ __results+=( ${^__deserialized}/$__wrd(N) )
+ [[ "${#__results}" -gt 0 ]] && {
+ __style=${FAST_THEME_NAME}correct-subtle
+ __deserialized=( "${(Q@)${(z@)FAST_HIGHLIGHT[chroma-autoload-elements]}}" )
+ [[ -z "${__deserialized[1]}" && ${#__deserialized} -eq 1 ]] && __deserialized=()
+ # Cannot use ${abc:+"$abc"} trick with ${~...}, so handle most
+ # cases of the possible shwordsplit through an additional array
+ __noshsplit=( ${~__wrd} )
+ __deserialized+=( "${(j: :)__noshsplit}" )
+ FAST_HIGHLIGHT[chroma-autoload-elements]="${(j: :)${(q@)__deserialized}}"
+ # Make the function defined for big-loop's *main-type mechanism
+ __fast_highlight_main__command_type_cache[${(j: :)__noshsplit}]="function"
+ } || __style=${FAST_THEME_NAME}incorrect-subtle
+ fi
+
+ if (( ${+functions[${(Q)__wrd}]} )); then
+ FAST_HIGHLIGHT[chroma-autoload-message]+="Warning: Function ${(Q)__wrd} already defined (e.g. loaded)"$'\n'
+ fi
+ fi
+
+ # Display only when processing last autoload argument
+ if (( ${#${(z)BUFFER}} == FAST_HIGHLIGHT[chroma-autoload-counter-all] )); then
+ # Display only if already shown message differs or when it timeouts
+ if [[ ${FAST_HIGHLIGHT[chroma-autoload-message]} != ${FAST_HIGHLIGHT[chroma-autoload-message-shown]} || \
+ $(( EPOCHSECONDS - FAST_HIGHLIGHT[chroma-autoload-message-shown-at] )) -gt 7 ]]; then
+ FAST_HIGHLIGHT[chroma-autoload-message-shown]=${FAST_HIGHLIGHT[chroma-autoload-message]}
+ FAST_HIGHLIGHT[chroma-autoload-message-shown-at]=$EPOCHSECONDS
+ zle -M "${FAST_HIGHLIGHT[chroma-autoload-message]}"
+ fi
+ fi
+}
+
+# Add region_highlight entry (via `reply' array).
+#
+# This is a common place of adding such entry, but any above code
+# can do it itself and skip setting __style to disable this code.
+[[ -n "$__style" ]] && \
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+
+# We aren't passing-through (no return 1 occurred), do obligatory things ourselves.
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git a/chroma/-autorandr.ch b/chroma/-autorandr.ch
new file mode 100755
index 0000000..4ba4e0b
--- /dev/null
+++ b/chroma/-autorandr.ch
@@ -0,0 +1,24 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+
+(( next_word = 2 | 8192 ))
+[[ "$__arg_type" = 3 ]] && return 2
+
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
+
+if (( __first_call )) || [[ "$__wrd" = -* ]]; then
+ return 1
+else
+ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+ fi
+ if [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/autorandr/$__wrd" ]] then
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
+ fi
+fi
+
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git a/chroma/-awk.ch b/chroma/-awk.ch
new file mode 100755
index 0000000..afcfd89
--- /dev/null
+++ b/chroma/-awk.ch
@@ -0,0 +1,106 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
+#
+# $2 - the current token, also accessible by $__arg from the above scope -
+# basically a private copy of $__arg; the token can be eg.: "grep"
+#
+# $3 - a private copy of $_start_pos, i.e. the position of the token in the
+# command line buffer, used to add region_highlight entry (see man),
+# because Zsh colorizes by *ranges* in command line buffer
+#
+# $4 - a private copy of $_end_pos from the above scope
+#
+
+(( next_word = 2 | 8192 ))
+
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
+local __style __chars __val __style2
+integer __idx1 __idx2
+
+# First call, i.e. command starts, i.e. "grep" token etc.
+(( __first_call )) && {
+ FAST_HIGHLIGHT[chroma-awk-counter]=0
+ FAST_HIGHLIGHT[chroma-awk-f-seen]=0
+ return 1
+} || {
+ # Following call, i.e. not the first one.
+
+ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+ fi
+
+ # Check if chroma should end – test if token is of type
+ # "starts new command", if so pass-through – chroma ends
+ [[ "$__arg_type" = 3 ]] && return 2
+
+ if [[ "$__wrd" = -* ]]; then
+ # Detected option, add style for it.
+ [[ "$__wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
+ __style=${FAST_THEME_NAME}single-hyphen-option
+ [[ "$__wrd" = "-f" ]] && FAST_HIGHLIGHT[chroma-awk-f-seen]=1
+ else
+ # Count non-option tokens.
+ (( FAST_HIGHLIGHT[chroma-awk-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-awk-counter] ))
+
+ # First non-option token is the pattern (regex), we will
+ # highlight it.
+ if (( FAST_HIGHLIGHT[chroma-awk-counter] == 1 && FAST_HIGHLIGHT[chroma-awk-f-seen] == 0 )); then
+ if print -r -- "${(Q)__wrd}" | gawk --source 'BEGIN { exit } END { exit 0 }' -f - >/dev/null 2>&1; then
+ __style2="${FAST_THEME_NAME}subtle-bg"
+ else
+ __style2="${FAST_THEME_NAME}incorrect-subtle"
+ fi
+
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style2]}")
+
+ # Highlight keywords
+ FSH_LIST=()
+ : "${__wrd//(#m)(BEGIN|END|FIELDWIDTHS|RS|ARGC|ARGV|ENVIRON|NF|NR|IGNORECASE|FILENAME|if|then|else|while|toupper|tolower|function|print|sub)/$(( fsh_sy_h_append($MBEGIN, $MEND) ))}";
+ for __val in "${FSH_LIST[@]}" ; do
+ [[ ${__wrd[${__val%%;;*}]} = [a-zA-Z0-9_] || ${__wrd[${__val##*;;}+1]} = [a-zA-Z0-9_] ]] && continue
+ __idx1=$(( __start_pos + ${__val%%;;*} ))
+ __idx2=__idx1+${__val##*;;}-${__val%%;;*}+1
+ (( __start=__idx1-${#PREBUFFER}, __end=__idx2-${#PREBUFFER}-1, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}reserved-word]},${FAST_HIGHLIGHT_STYLES[$__style2]}")
+ done
+
+ # Highlight regex characters
+ __chars="*+\\)(\{\}[]^"
+ __idx1=__start_pos
+ __idx2=__start_pos
+ while [[ "$__wrd" = (#b)[^$__chars]#([\\][\\])#((+|\*|\[|\]|\)|\(|\^|\}|\{)|[\\](+|\*|\[|\]|\)|\(|\^|\{|\}))(*) ]]; do
+ if [[ -n "${match[3]}" ]]; then
+ __idx1+=${mbegin[3]}-1
+ __idx2=__idx1+${mend[3]}-${mbegin[3]}+1
+ (( __start=__idx1-${#PREBUFFER}, __end=__idx2-${#PREBUFFER}, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}mathnum]},${FAST_HIGHLIGHT_STYLES[$__style2]}")
+ __idx1=__idx2
+ else
+ __idx1+=${mbegin[5]}-1
+ fi
+ __wrd="${match[5]}"
+ done
+ elif (( FAST_HIGHLIGHT[chroma-awk-counter] >= 2 || FAST_HIGHLIGHT[chroma-awk-f-seen] == 1 )); then
+ FAST_HIGHLIGHT[chroma-awk-f-seen]=0
+ # Handle paths, etc. normally - just pass-through to the big
+ # highlighter (the main f-sy-h highlighter, used before chromas).
+ return 1
+ fi
+fi
+}
+
+# Add region_highlight entry (via `reply' array).
+#
+# This is a common place of adding such entry, but any above
+# code can do it itself (and it does) and skip setting __style
+# to disable this code.
+[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+
+# We aren't passing-through (no return 1 occurred), do obligatory things ourselves.
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git "a/\342\206\222chroma/-docker.ch" b/chroma/-docker.ch
old mode 100644
new mode 100755
similarity index 99%
rename from "\342\206\222chroma/-docker.ch"
rename to chroma/-docker.ch
index 25994b4..c418a6b
--- "a/\342\206\222chroma/-docker.ch"
+++ b/chroma/-docker.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# Chroma function for command `docker'. It verifies command line, by denoting
# wrong and good arguments by color. Currently implemented: verification of
@@ -56,7 +57,6 @@ local -a __lines_list
if [[ "${FAST_HIGHLIGHT[chroma-docker-subcommand]}" = "image" ]]; then
[[ "$__wrd" != -* ]] && {
(( FAST_HIGHLIGHT[chroma-docker-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-docker-counter] ))
-
if (( __idx1 == 2 )); then
__style=${FAST_THEME_NAME}subcommand
elif (( __idx1 == 3 )); then
@@ -85,5 +85,3 @@ local -a __lines_list
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-example.ch" b/chroma/-example.ch
old mode 100644
new mode 100755
similarity index 91%
rename from "\342\206\222chroma/-example.ch"
rename to chroma/-example.ch
index e171fe8..50e0c36
--- "a/\342\206\222chroma/-example.ch"
+++ b/chroma/-example.ch
@@ -2,7 +2,7 @@
#
# Example chroma function. It colorizes first two arguments as `builtin' style,
# third and following arguments as `globbing' style. First two arguments may
-# be "strings", they will be passed through to normal higlighter (by returning 1).
+# be "strings", they will be passed through to normal highlighter (by returning 1).
#
# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
#
@@ -16,10 +16,10 @@
# $4 - a private copy of $_end_pos from the above scope
#
#
-# Overall functioning is: when command "example" is occured, this function
+# Overall functioning is: when command "example" is occurred, this function
# is called with $1 == 1, it ("example") is the first token ($2), then for any
# following token, this function is called with $1 == 0, until end of command
-# is occured (i.e. till enter is pressed or ";" is put into source, or the
+# is occurred (i.e. till enter is pressed or ";" is put into source, or the
# command line simply ends).
#
# Other tips are:
@@ -38,7 +38,7 @@
# Remember to reset the hash and others at __first_call == 1, so that you have
# a fresh state for new command.
-# Keep chroma-takever state meaning: until ;, handle highlighting via chroma.
+# Keep chroma-takeover state meaning: until ;, handle highlighting via chroma.
# So the below 8192 assignment takes care that next token will be routed to chroma.
(( next_word = 2 | 8192 ))
@@ -83,7 +83,7 @@ integer __idx1 __idx2
# Colorize 1..2 as builtin, 3.. as glob
if (( FAST_HIGHLIGHT[chroma-example-counter] <= 2 )); then
if [[ "$__wrd" = \"* ]]; then
- # Pass through, fsh main code will do the highlight!
+ # Pass through, f-sy-h main code will do the highlight!
return 1
else
__style=${FAST_THEME_NAME}builtin
@@ -106,7 +106,7 @@ integer __idx1 __idx2
[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
# We aren't passing-through, do obligatory things ourselves.
-# _start_pos=$_end_pos advainces pointers in command line buffer.
+# _start_pos=$_end_pos advances pointers in command line buffer.
#
# To pass through means to `return 1'. The highlighting of
# this single token is then done by fast-syntax-highlighting's
diff --git a/chroma/-fast-theme.ch b/chroma/-fast-theme.ch
new file mode 100755
index 0000000..1cc918b
--- /dev/null
+++ b/chroma/-fast-theme.ch
@@ -0,0 +1,43 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+
+(( next_word = 2 | 8192 ))
+[[ "$__arg_type" = 3 ]] && return 2
+
+local __first_call="$1" __wrd="${(Q)2}" __start_pos="$3" __end_pos="$4"
+local __style
+
+if (( __first_call )); then
+ FAST_HIGHLIGHT[chroma-fast-theme-first]=0
+ return 1
+elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+elif (( ${FAST_HIGHLIGHT[chroma-fast-theme-first]} )) || [[ $__wrd = -* ]]; then
+ return 1
+else
+ FAST_HIGHLIGHT[chroma-fast-theme-first]=1
+fi
+
+if [[ "$__wrd" = */* || "$__wrd" = (CONFIG|CACHE|LOCAL|HOME|OPT):* ]]; then
+ __wrd="${${__wrd/(#s)CONFIG:/${${XDG_CONFIG_HOME:-$HOME/.config}%/}/f-sy-h/}%.ini}.ini"
+ __wrd="${${__wrd/(#s)CACHE:/${${XDG_CACHE_HOME:-$HOME/.cache}%/}/f-sy-h/}%.ini}.ini"
+ __wrd="${${__wrd/(#s)LOCAL://usr/local/share/f-sy-h/}%.ini}.ini"
+ __wrd="${${__wrd/(#s)HOME:/$HOME/.f-sy-h/}%.ini}.ini"
+ __wrd="${${__wrd/(#s)OPT://opt/local/share/f-sy-h/}%.ini}.ini"
+ __wrd=${~__wrd} # allow user to quote ~
+else
+ __wrd="$FAST_BASE_DIR/themes/$__wrd.ini"
+fi
+
+if [[ -f $__wrd ]]; then
+ __style=${FAST_THEME_NAME}path
+else
+ __style=${FAST_THEME_NAME}incorrect-subtle
+fi
+
+(( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git "a/\342\206\222chroma/-fpath_peq.ch" b/chroma/-fpath_peq.ch
old mode 100644
new mode 100755
similarity index 93%
rename from "\342\206\222chroma/-fpath_peq.ch"
rename to chroma/-fpath_peq.ch
index 149df8c..de08465
--- "a/\342\206\222chroma/-fpath_peq.ch"
+++ b/chroma/-fpath_peq.ch
@@ -1,14 +1,15 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# This chroma does a narrow, obscure but prestigious parsing of fpath+=( elem1
# elem2 ... ) construct to provide *the* *future* contents of $fpath to
# -autoload.ch, so that it can detect functions in those provided directories
# `elem1', `elem2', etc. and highlight the functions with `correct-subtle'
-# instead of `incorrect-subtle'. Basically all thit is for command-lines like:
+# instead of `incorrect-subtle'. Basically all this is for command-lines like:
#
# % fpath+=( `pwd` ); autoload my-fun-from-PWD
-# Keep chroma-takever state meaning: until ; or similar (see $__arg_type below)
+# Keep chroma-takeover state meaning: until ; or similar (see $__arg_type below)
# The 8192 sum takes care that the next token will be routed to this chroma
(( next_word = 2 | 8192 ))
@@ -56,5 +57,3 @@ local -a deserialized
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git a/chroma/-git.ch b/chroma/-git.ch
new file mode 100755
index 0000000..e5a8a6e
--- /dev/null
+++ b/chroma/-git.ch
@@ -0,0 +1,930 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# Chroma function for command `git'. It colorizes the part of command line that holds `git' invocation.
+
+(( FAST_HIGHLIGHT[-git.ch-chroma-def] )) && return 1
+
+FAST_HIGHLIGHT[-git.ch-chroma-def]=1
+
+typeset -gA fsh__git__chroma__def
+fsh__git__chroma__def=(
+ ##
+ ## No subcommand
+ ##
+ ## {{{
+
+ subcmd:NULL "NULL_0_opt"
+ NULL_0_opt "
+ (-C|--exec-path=|--git-dir=|--work-tree=|--namespace=|--super-prefix=|--config-env=|
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || -c
+ <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP
+ <<>> __style=\${FAST_THEME_NAME}optarg-string // NO-OP
+ || (-v|--version|-h|--help|--html-path|--man-path|--info-path|-p|--paginate|
+ -P|--no-pager|--no-replace-objects|--bare)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ "subcommands" "::chroma/-git-get-subcommands" # run a function (the :: causes this) and use `reply'
+ #"subcommands" "(fetch|pull)" # run a function (the :: causes this) and use `reply'
+ "subcmd-hook" "chroma/-git-check-if-alias"
+ "subcommands-blacklist" "mv,other"
+
+ ## }}}
+
+ ##
+ ## `FETCH'
+ ##
+ ## {{{
+
+ subcmd:fetch "FETCH_MULTIPLE_0_opt^ // FETCH_ALL_0_opt^ // FETCH_0_opt //
+ REMOTE_GR_1_arg // REF_#_arg // NO_MATCH_#_opt"
+
+ # Special options (^ - has directives, currently - an :add and :del directive)
+ "FETCH_MULTIPLE_0_opt^" "
+ --multiple
+ <<>> __style=\${FAST_THEME_NAME}double-hyphen-option // NO-OP
+ || --multiple:add
+ <<>> REMOTE_GR_#_arg
+ || --multiple:del
+ <<>> REMOTE_GR_1_arg // REF_#_arg" # when --multiple is passed, then
+ # there is no refspec argument, only remotes-ids
+ # follow unlimited # of them, hence the # in the
+ # REMOTE_GR_#_arg
+
+ # Special options (^ - has directives - an :del-directive)
+ "FETCH_ALL_0_opt^" "
+ --all
+ <<>> __style=\${FAST_THEME_NAME}double-hyphen-option // NO-OP
+ || --all:del
+ <<>> REMOTE_GR_1_arg // REF_#_arg" # --all can be only followed by options
+
+ # FETCH_0_opt. FETCH-options (FETCH is an identifier) at position 0 ->
+ # -> before any argument
+ FETCH_0_opt "
+ (--depth=|--deepen=|--shallow-exclude=|--shallow-since=|--receive-pack=|--filter=|
+ --refmap=|--recurse-submodules=|-j|--jobs=|--submodule-prefix=|--recurse-submodules-default=|
+ -o|--server-option=|--upload-pack=|--negotiation-tip=|--set-upstream=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|--all|-a|--append|--unshallow|--atomic|--auto-maintenance|--update-shallow|--dry-run|-f|--force|
+ -k|--keep|-m|--multiple|-p|--prune|-n|--no-tags|-t|--tags|--prefetch |--no-recurse-submodules|--negotiation-tip|
+ --auto-gc|--filter|--write-fetch-head|--write-commit-graph|--show-forced-updates|-P|--prune-tags|--negotiate-only|
+ -u|--update-head-ok|-q|--quiet|-v|--verbose|--progress|--refetch|-4|--ipv4|-6|--ipv6|--stdin)
+ <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP"
+ # Above: note the two <<>>-separated blocks for options that have
+ # some arguments – the second pair of action/handler is being
+ # run when an option argument is occurred (first one: the option
+ # itself). If there is only one <<>>-separated block, then the option
+ # is set to be argument-less. The argument is a) -o/--option argument
+ # and b) -o/--option=argument.
+
+ REMOTE_GR_1_arg "NO-OP // ::chroma/-git-verify-remote-or-group" # This definition is generic, reused later
+ "REF_#_arg" "NO-OP // ::chroma/-git-verify-ref" # This too
+ "REMOTE_GR_#_arg" "NO-OP // ::chroma/-git-verify-remote-or-group" # and this too
+ # The hash `#' above denotes: an argument at any position
+ # It will nicely match any following (above the first explicitly
+ # numbered ones) arguments passed when using --multiple
+
+ # A generic action
+ NO_MATCH_\#_opt "* <<>> __style=\${FAST_THEME_NAME}incorrect-subtle // NO-OP"
+ NO_MATCH_\#_arg "__style=\${FAST_THEME_NAME}incorrect-subtle // NO-OP"
+
+ ## }}}
+
+ ##
+ ## PUSH
+ ##
+ ## {{{
+
+ subcmd:push "PUSH_0_opt // REMOTE_1_arg // REF_#_arg // NO_MATCH_#_opt"
+
+ PUSH_0_opt "
+ (--receive-pack=|--exec=|--repo=|--push-option=|--signed=|
+ --force-with-lease=|--recurse-submodules=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|--all|--mirror|--tags|--follow-tags|-n|--dry-run|--porcelain|
+ -d|--delete|--signed|--no-signed|--atomic|--no-atomic|
+ -o|--push-option|--prune|--force-with-lease|--no-force-with-lease|-f|--force|
+ --force-if-includes|-u|--set-upstream|--thin|--no-thin|-q|--quiet|-v|--verbose|
+ --progress|--no-recurse-submodules|--verify|--no-verify|-4|--ipv4|-6|--ipv6)
+ <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP"
+ REMOTE_1_arg "NO-OP // ::chroma/-git-verify-remote" # This definition is generic, reused later
+
+ ### }}}
+
+ ##
+ ## PULL
+ ##
+ ## {{{
+
+ subcmd:pull "PULL_0_opt // REMOTE_1_arg // REF_#_arg // NO_MATCH_#_opt"
+
+ PULL_0_opt "
+ (--recurse-submodules=|-S|--gpg-sign=|--log=|-s|--strategy=|-X|-j|--jobs=|
+ --strategy-option=|--rebase=|--depth=|--deepen=|--shallow-exclude=|
+ --shallow-since=|--signoff=|--negotiation-tip=|--upload-pack|-o|--server-option=|
+ --no-recurse-submodules=|--refmap=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|-q|--quiet|-v|--verbose|--progress|--no-recurse-submodules|--dry-run|
+ --commit|--no-commit|--cleanup|--edit|--no-edit|--ff|--no-ff|--ff-only|--log|--no-log|
+ --signoff|--no-signoff|--stat|-n|--no-stat|--squash|--show-forced-updates|--no-squash|
+ --verify|--verify-signatures|--no-verify-signatures|--summary|--set-upstream|--no-summary|
+ --allow-unrelated-histories|-r|--rebase|--no-rebase|--autostash|--no-autostash|--all|
+ -a|--append|--unshallow|--update-shallow|-f|--force|-p|--prune|-k|--keep|-t|--tags|--no-tags|
+ -u|--update-head-ok|--progress|-4|--ipv4|-6|--ipv6)
+ <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP"
+
+ ## }}}
+
+ ##
+ ## COMMIT
+ ##
+ ## {{{
+
+ subcmd:commit "COMMIT_#_opt // FILE_#_arg // NO_MATCH_#_opt"
+
+ "COMMIT_#_opt" "
+ (-m|--message=|-am)
+ <<>> NO-OP // ::chroma/-git-commit-msg-opt-action
+ <<>> NO-OP // ::chroma/-git-commit-msg-opt-ARG-action
+ || (-h|--help|-a|--all|-p|--patch|--reset-author|--short|--branch|
+ --porcelain|--long|-z|--null|-s|--signoff|-n|--no-verify|
+ --allow-empty|--allow-empty-message|-e|--edit|--no-edit|
+ --amend|--no-post-rewrite|-i|--include|-o|--only|--untracked-files|
+ -v|--verbose|-q|--quiet|--dry-run|--status|--no-status|--no-gpg-sign)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || (-C|--reuse-message=|-c|--reedit-message=|--fixup=|--squash=|
+ -F|--file=|--author=|--date=|-t|--template=|--cleanup=|
+ -u|--untracked-files=|-S|--gpg-sign=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action"
+
+ # A generic action
+ "FILE_#_arg" "NO-OP // ::chroma/-git-verify-file"
+
+ ## }}}
+
+ ##
+ ## MERGE
+ ##
+ ## {{{
+
+ subcmd:merge "MERGE_0_opt // COMMIT_#_arg"
+ MERGE_0_opt "
+ (-m)
+ <<>> NO-OP // ::chroma/-git-commit-msg-opt-action
+ <<>> NO-OP // ::chroma/-git-commit-msg-opt-ARG-action
+ (-S|--gpg-sign=|--log=|-e|--strategy=|-X|--strategy-option=|-F|--file|--cleanup=|
+ --into-name=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|--commit|--no-commit|-e|--edit|--no-edit|--ff|--no-ff|--ff-only|--autostash|
+ --log|--no-log|--signoff|--no-signoff|-n|--stat|--no-stat|--squash|--overwrite-ignore|
+ --no-squash|--verify-signatures|--no-verify|--no-verify-signatures|--summary|--no-summary|
+ -q|--quiet|-v|--verbose|--progress|--no-progress|--allow-unrelated-histories|
+ --rerere-autoupdate|--no-rerere-autoupdate|--abort|--quit|--continue)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ COMMIT_\#_arg "NO-OP // ::chroma/-git-verify-commit"
+
+ ## }}}
+
+ ##
+ ## RESET
+ ##
+ ## {{{
+
+ subcmd:reset "RESET_0_opt^ // RESET_0_opt // RESET_#_arg // NO_MATCH_#_opt"
+ "RESET_0_opt^" "
+ (--soft|--mixed|--hard|--merge|--keep)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || (--soft|--mixed|--hard|--merge|--keep):del
+ <<>> RESET_0_opt // RESET_#_arg
+ || (--soft|--mixed|--hard|--merge|--keep):add
+ <<>> RESET_1_arg // NO_MATCH_#_arg"
+
+ RESET_0_opt "
+ (--recurse-submodules=|--pathspec-from-file=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|-q|--quiet|-p|--patch|-N|--intent-to-add|--pathspec-file-nul)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+ RESET_1_arg "NO-OP // ::chroma/-git-verify-commit"
+
+ "RESET_#_arg" "NO-OP // ::chroma/-git-RESET-verify-commit-or-file"
+
+
+ ## }}}
+
+ ##
+ ## REVERT
+ ##
+ ## {{{
+
+ subcmd:revert "REVERT_SEQUENCER_0_opt^ // REVERT_0_opt // REVERT_#_arg // NO_MATCH_#_opt"
+ REVERT_0_opt "
+ (-m|--mainline|-S|--gpg-sign=|--strategy=|-X|--strategy-option=|--cleanup=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|-e|--edit|--no-edit|-n|--no-commit|-s|--signoff|--reference|--rerere-autoupdate)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ "REVERT_SEQUENCER_0_opt^" "
+ (--continue|--quit|--abort|--skip)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || (--continue|--quit|--abort|--skip):del
+ <<>> REVERT_0_opt // REVERT_#_arg
+ || (--continue|--quit|--abort|--skip):add
+ <<>> NO_MATCH_#_arg"
+
+ "REVERT_#_arg" "NO-OP // ::chroma/-git-verify-commit"
+
+ ## }}}
+
+ ##
+ ## DIFF
+ ##
+ ## TODO: #10 When a second argument is also a path and it points to a directory, then
+ ## git appends the previous file name to it – good to implement this too
+ ## {{{
+
+ subcmd:diff "DIFF_NO_INDEX_0_opt^ // DIFF_0_opt // COMMIT_FILE_DIR_#_arg // NO_MATCH_#_opt"
+
+ "DIFF_NO_INDEX_0_opt^" "
+ --no-index
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || --no-index:del
+ <<>> COMMIT_FILE_DIR_#_arg
+ || --no-index:add
+ <<>> FILE_1_arg // FILE_2_arg // NO_MATCH_#_arg"
+ DIFF_0_opt "
+ (-U|--unified=|--anchored=|--diff-algorithm=|--stat=|--stat-width=|--stat-name-width=|
+ --stat-graph-width|-X|--dirstat|--dirstat-by-file=|--stat-count=|--submodule=|--color=|
+ --color-moved=|--color-moved-ws=|--word-diff=|--word-diff-regex=|--color-words=|
+ --ws-error-highlight=|--abbrev=|-B|--break-rewrites=|-M|--find-renames=|-C|--find-copies=|-l|
+ --diff-filter=|-S|-G|--find-object=|--relative=|-O|--relative=|--inter-hunk-context=|--output=|
+ --output-indicator-new=|--output-indicator-old=|--output-indicator-context=|--ignore-submodules=|
+ --src-prefix=|--dst-prefix=|--line-prefix=|-I|--ignore-matching-lines=|--rotate-to=|--skip-to=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|-p|--patch|-u|-s|--no-patch|--raw|--patch-with-raw|--indent-heuristic|
+ --no-indent-heuristic|--minimal|--patience|--histogram|--stat|--cumulative|
+ --compact-summary|--numstat|--shortstat|--dirstat|--summary|
+ --patch-with-stat|-z|--name-only|--name-status|--submodule|--no-color|
+ --color-moved|--word-diff|--color-words|--no-renames|--check|
+ --full-index|--binary|--abbrev|--break-rewrites|--find-renames|--rename-empty|
+ --find-copies|--find-copies-harder|-D|--pickaxe-all|--pickaxe-regex|--follow|
+ --irreversible-delete|-R|--relative|-a|--text|--ignore-cr-at-eol|
+ --ignore-space-at-eol|-b|--ignore-space-change|-w|--ignore-all-space|
+ --ignore-blank-lines|-W|--function-context|--exit-code|--quiet|
+ --ext-diff|--no-ext-diff|--textconv|--no-textconv|--ignore-submodules|
+ --no-prefix|--ita-invisible-in-index|--ita-visible-in-index|-1|--base|-2|--ours|-3|--theirs|
+ -0|--cached)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ # A generic action
+ "COMMIT_FILE_DIR_#_arg" "NO-OP // ::chroma/-git-verify-commit-or-file-or-dir"
+
+ # A generic action
+ "FILE_1_arg" "NO-OP // ::chroma/-git-verify-file"
+
+ # A generic action
+ "FILE_2_arg" "NO-OP // ::chroma/-git-verify-file"
+
+ ## }}}
+
+ ##
+ ## ADD
+ ##
+ ## {{{
+
+ subcmd:add "ADD_0_opt // FILE_OR_DIR_#_arg // NO_MATCH_#_opt"
+
+ ADD_0_opt "
+ (--chmod=|--pathspec-from-file=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|-v|--verbose|-f|--force|-i|--interactive|-n|--dry-run|-p|--patch|-e|--edit|
+ --all|--no-all|-A|--ignore-removal|--no-ignore-removal|-u|--update|-N|--sparse|
+ --intent-to-add|--refresh|--ignore-errors|--ignore-missing|--renormalize|
+ --no-warn-embedded-repo|--pathspec-file-nul)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ FILE_OR_DIR_#_arg "NO-OP // ::chroma/-git-verify-file-or-dir"
+
+ ## }}}
+
+ ##
+ ## CHECKOUT
+ ##
+ ## {{{
+
+ subcmd:checkout "CHECKOUT_BRANCH_0_opt^ //
+ CHECKOUT_0_opt // FILE_OR_DIR_OR_BRANCH_OR_COMMIT_1_arg // FILE_#_arg //
+ FILE_#_arg // NO_MATCH_#_opt"
+
+ "CHECKOUT_BRANCH_0_opt^" "
+ (-b|-B|--orphan)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || (-b|-B|--orphan):del
+ <<>> FILE_OR_DIR_OR_BRANCH_OR_COMMIT_1_arg // FILE_#_arg // FILE_#_arg
+ || (-b|-B|--orphan):add
+ <<>> NEW_BRANCH_1_arg // COMMIT_2_arg // NO_MATCH_#_arg"
+
+ NEW_BRANCH_1_arg "NO-OP // ::chroma/-git-verify-correct-branch-name"
+
+ COMMIT_2_arg "NO-OP // ::chroma/-git-verify-commit"
+
+ CHECKOUT_0_opt "
+ (--conflict=|--recurse-submodules=|--track=|--pathspec-from-file=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-h|--help|-q|--quiet|--progress|--no-progress|-f|--force|-2|--ours|-3|--theirs|--guess|--overlay|
+ -b|-B|-t|--track|--no-track|-l|-d|--detach|--orphan|--ignore-skip-worktree-bits|
+ -m|--merge|-p|--patch|--ignore-other-worktrees|--no-ignore-other-worktrees|--overwrite-ignore|
+ --pathspec-file-nul)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ # A generic action
+ COMMIT_1_arg "NO-OP // ::chroma/-git-verify-commit"
+
+ # Unused
+ FILE_OR_BRANCH_OR_COMMIT_1_arg "NO-OP // ::chroma/-git-file-or-ubranch-or-commit-verify"
+ FILE_OR_DIR_OR_BRANCH_OR_COMMIT_1_arg "NO-OP // ::chroma/-git-file-or-dir-or-ubranch-or-commit-verify"
+
+ ## }}}
+
+ ##
+ ## REMOTE
+ ##
+ ## {{{
+
+ subcmd:remote "REMOTE_0_opt // REMOTE_ADD_1_arg // REMOTE_RENAME_1_arg // REMOTE_REMOVE_1_arg //
+ REMOTE_SET_HEAD_1_arg // REMOTE_SET_BRANCHES_1_arg //
+ REMOTE_GET_URL_1_arg // REMOTE_SET_URL_1_arg // REMOTE_SHOW_1_arg //
+ REMOTE_PRUNE_1_arg // REMOTE_UPDATE_1_arg"
+
+ REMOTE_0_opt "(-h|--help|-v|--verbose)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_ADD_1_arg "add ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_ADD_OPTS_1_opt // REMOTE_A_NAME_2_arg //
+ REMOTE_A_URL_3_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
+
+ REMOTE_RENAME_1_arg "rename ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_2_arg // REMOTE_A_NAME_3_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
+
+ REMOTE_REMOVE_1_arg "remove ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
+
+ REMOTE_SET_HEAD_1_arg "set-head ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_2_arg // BRANCH_3_arg //
+ REMOTE_SET_HEAD_OPTS_1_opt // REMOTE_SET_HEAD_OPTS_2_opt //
+ NO_MATCH_#_opt // NO_MATCH_#_arg"
+
+ REMOTE_SET_BRANCHES_1_arg "set-branches ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_SET_BRANCHES_OPTS_1_opt // REMOTE_2_arg //
+ BRANCH_#_arg // NO_MATCH_#_opt"
+
+ REMOTE_GET_URL_1_arg "get-url ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_GET_URL_OPTS_1_opt // REMOTE_2_arg //
+ NO_MATCH_#_opt // NO_MATCH_#_arg"
+
+ REMOTE_SET_URL_1_arg "set-url ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_SET_URL_OPTS_1_opt^ //
+ REMOTE_2_arg // REMOTE_A_URL_3_arg // REMOTE_A_URL_4_arg //
+ NO_MATCH_#_opt // NO_MATCH_#_arg"
+
+ REMOTE_SHOW_1_arg "show ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_SHOW_OPTS_1_opt // REMOTE_#_arg // NO_MATCH_#_opt"
+
+ REMOTE_PRUNE_1_arg "prune ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_PRUNE_OPTS_1_opt // REMOTE_#_arg // NO_MATCH_#_opt"
+
+ REMOTE_UPDATE_1_arg "update ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
+ add:REMOTE_UPDATE_OPTS_1_opt // REMOTE_GR_#_arg // NO_MATCH_#_opt"
+
+ REMOTE_ADD_OPTS_1_opt "
+ (-t|-m|--mirror=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (-f|--tags|--no-tags)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_SET_HEAD_OPTS_1_opt "
+ (-a|--auto|-d|--delete)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_SET_HEAD_OPTS_2_opt "
+ (-a|--auto|-d|--delete)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_SET_BRANCHES_OPTS_1_opt "
+ --add
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_GET_URL_OPTS_1_opt "
+ (--push|--all)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ "REMOTE_SET_URL_OPTS_1_opt^" "
+ --push|--add|--delete
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || (--add|--delete):del
+ <<>> REMOTE_A_URL_4_arg"
+
+ REMOTE_SHOW_OPTS_1_opt "
+ -n
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_PRUNE_OPTS_1_opt "
+ (-n|--dry-run)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_UPDATE_OPTS_1_opt "
+ (-p|--prune)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ REMOTE_A_NAME_2_arg "NO-OP // ::chroma/-git-verify-correct-branch-name"
+ REMOTE_A_NAME_3_arg "NO-OP // ::chroma/-git-verify-correct-branch-name"
+ REMOTE_A_URL_3_arg "NO-OP // ::chroma/main-chroma-std-verify-url"
+ REMOTE_A_URL_4_arg "NO-OP // ::chroma/main-chroma-std-verify-url"
+ BRANCH_3_arg "NO-OP // ::chroma/-git-verify-branch"
+ BRANCH_\#_arg "NO-OP // ::chroma/-git-verify-branch"
+ REMOTE_2_arg "NO-OP // ::chroma/-git-verify-remote"
+ REMOTE_\#_arg "NO-OP // ::chroma/-git-verify-remote"
+
+ ## }}}
+
+ ##
+ ## LOG
+ ##
+
+ subcmd:log "LOG_0_opt // LOG_1_arg // FILE_#_arg // NO_MATCH_#_opt"
+
+ LOG_0_opt "
+ (--decorate=|--decorate-refs=|--decorate-refs-exclude=|-L|-n|--max-count=|
+ --skip=|--since=|--after=|--until=|--before=|--author=|--committer=|
+ --grep-reflog=|--grep=|--min-parents=|--max-parents=|--branches=|--tags=|
+ --remotes=|--glob=|--exclude=|--no-walk=|--pretty=|--format=|--encoding=|
+ --expand-tabs=|--notes=|--show-notes=|--date=|--show-linear-break=|-U|
+ --unified=|--anchored=|--diff-algorithm=|--stat=|--dirstat=|--submodule=|
+ --color=|--color-moved=|--color-moved-ws=|--word-diff=|--word-diff-regex=|
+ --color-words=|--ws-error-highlight=|--abbrev=|-B|--break-rewrites=|-M|
+ --find-renames=|-C|--find-copies=|-l|--diff-filter=|-S|-G|--find-object=|
+ --relative=|-O|--relative=|--inter-hunk-context=|--ignore-submodules=|
+ --src-prefix=|--dst-prefix=|--line-prefix=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+
+ || (-h|--help|--follow|--decorate|--no-decorate|--source|--use-mailmap|--full-diff|
+ --log-size|--all-match|--invert-grep|-i|--regexp-ignore-case|--basic-regexp|
+ -E|--extended-regexp|-F|--fixed-strings|-P|--perl-regexp|--remove-empty|
+ --merges|--no-merges|--no-min-parents|--no-max-parents|--first-parent|
+ --not|--all|--branches|--tags|--remotes|--reflog|--single-worktree|
+ --ignore-missing|--bisect|--stdin|--cherry-mark|--cherry-pick|--left-only|
+ --right-only|--cherry|-g|--walk-reflogs|--merge|--boundary|--simplify-by-decoration|
+ --full-history|--dense|--sparse|--simplify-merges|--ancestry-path|--date-order|
+ --author-date-order|--topo-order|--reverse|--no-walk|--do-walk|--pretty|
+ --abbrev-commit|--no-abbrev-commit|--oneline|--expand-tabs|--no-expand-tabs|
+ --notes|--no-notes|--show-notes|--no-standard-notes|--show-signature|
+ --relative-date|--parents|--children|--left-right|--graph|--show-linear-break|
+ -c|--cc|-m|-r|-t|-p|-u|--patch|-s|--no-patch|--raw|--patch-with-raw|
+ --indent-heuristic|--no-indent-heuristic|--minimal|--patience|--histogram|
+ --stat|--compact-summary|--numstat|--shortstat|--dirstat|--summary|
+ --patch-with-stat|-z|--name-only|--name-status|--submodule|--color|--no-color|
+ --color-moved|--word-diff|--color-words|--no-renames|--check|--full-index|
+ --binary|--abbrev|--break-rewrites|--find-renames|
+ --find-copies|--find-copies-harder|-D|--irreversible-delete|
+ --pickaxe-all|--pickaxe-regex|-R|--relative|-a|--text|--ignore-cr-at-eol|
+ --ignore-space-at-eol|-b|--ignore-space-change|-w|--ignore-all-space|
+ --ignore-blank-lines|-W|--function-context|--ext-diff|--no-ext-diff|
+ --textconv|--no-textconv|--ignore-submodules|--no-prefix|
+ --ita-invisible-in-index)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ LOG_1_arg "NO-OP // ::chroma/-git-verify-rev-range-or-file"
+
+ ##
+ ## TAG
+ ##
+
+ subcmd:tag "TAG_D_0_opt^ // TAG_L_0_opt^ // TAG_V_0_opt^ // TAG_0_opt^"
+
+ "TAG_0_opt^" "
+ (-u|--local-user=|--cleanup=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || -m
+ <<>> NO-OP // ::chroma/-git-commit-msg-opt-action
+ <<>> NO-OP // ::chroma/-git-commit-msg-opt-ARG-action
+ || (-F|--file)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/-git-verify-file
+ || (-a|--annotate|-s|--sign|-f|-e|--edit)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || (-h|--help|-u|--local-user=|--cleanup=|-m|-F|--file|-a|--annotate|-s|--sign|
+ -f|-e|--edit):add
+ <<>> TAG_NEW_1_arg // COMMIT_2_arg // NO_MATCH_#_arg //
+ NO_MATCH_#_opt"
+
+ TAG_NEW_1_arg "NO-OP // ::chroma/-git-verify-correct-branch-name"
+
+ TAG_1_arg "NO-OP // ::chroma/-git-verify-tag-name"
+
+ "TAG_D_0_opt^" "
+ (-d)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || -d:add
+ <<>> TAG_#_arg // NO_MATCH_#_opt
+ || -d:del
+ <<>> TAG_0_opt // TAG_NEW_1_arg // COMMIT_2_arg"
+
+ "TAG_#_arg" "NO-OP // ::chroma/-git-verify-tag-name"
+
+ "TAG_L_0_opt^" "
+ (-l)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || -l:add
+ <<>> TAG_L_0_opt // TAG_PAT_#_arg // NO_MATCH_#_opt
+ || -l:del
+ <<>> TAG_0_opt // TAG_NEW_1_arg // COMMIT_2_arg"
+
+ TAG_L_0_opt "
+ (-n|--contains|--no-contains|--points-at|--column=|--sort=|--format=|
+ --color=)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action
+ || (--column|--no-column|--create-reflog|--merged|--no-merged|--color|-i)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
+
+ "TAG_PAT_#_arg" "NO-OP // ::chroma/main-chroma-std-verify-pattern"
+
+ "TAG_V_0_opt^" "
+ (-v)
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ || -v:add
+ <<>> TAG_V_0_opt // TAG_#_arg // NO_MATCH_#_opt
+ || -v:del
+ <<>> TAG_0_opt // TAG_NEW_1_arg // COMMIT_2_arg"
+
+ TAG_V_0_opt "
+ --format=
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-ARG-action"
+
+ ##
+ ## All remaining subcommands
+ ##
+ ## {{{
+
+ "subcmd:*" "CATCH_ALL_#_opt"
+ "CATCH_ALL_#_opt" "* <<>> NO-OP // ::chroma/main-chroma-std-aopt-SEMI-action"
+
+ ## }}}
+)
+
+# Called after entering just "git" on the command line
+chroma/-git-first-call() {
+ # Called for the first time - new command FAST_HIGHLIGHT is used because it survives between calls,
+ # and allows to use a single global hash only, instead of multiple global variables
+ FAST_HIGHLIGHT[chroma-git-counter]=0
+ FAST_HIGHLIGHT[chroma-git-got-subcommand]=0
+ FAST_HIGHLIGHT[chroma-git-subcommand]=""
+ FAST_HIGHLIGHT[chrome-git-got-msg1]=0
+ FAST_HIGHLIGHT[chrome-git-got-anymsg]=0
+ FAST_HIGHLIGHT[chrome-git-occurred-double-hyphen]=0
+ FAST_HIGHLIGHT[chroma-git-checkout-new]=0
+ FAST_HIGHLIGHT[chroma-git-fetch-multiple]=0
+ FAST_HIGHLIGHT[chroma-git-branch-change]=0
+ FAST_HIGHLIGHT[chroma-git-option-with-argument-active]=0
+ FAST_HIGHLIGHT[chroma-git-reset-etc-saw-commit]=0
+ FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=0
+ return 1
+}
+
+chroma/-git-check-if-alias() {
+ local _wrd="$1"
+ local -a _result
+
+ typeset -ga fsh__chroma__git__aliases
+ _result=( ${(M)fsh__chroma__git__aliases[@]:#${_wrd}[[:space:]]##*} )
+ chroma/main-chroma-print "Got is-alias-_result: $_result"
+ [[ -n "$_result" ]] && \
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]="${${${_result#* }## ##}%% *}"
+}
+
+# A hook that returns the list of git's
+# available subcommands in $reply
+chroma/-git-get-subcommands() {
+ local __svalue
+ integer __ivalue
+ LANG=C .fast-run-command "git help -a" chroma-${FAST_HIGHLIGHT[chroma-current]}-subcmd-list "" $(( 15 * 60 ))
+
+ if [[ "${__lines_list[1]}" = See* ]]; then
+ # (**)
+ # git >= v2.20, the aliases in the `git help -a' command
+ __lines_list=( ${${${${(M)__lines_list[@]:#([[:space:]](#c3,3)[a-zA-Z0-9_]*|Command aliases)}##[[:space:]]##}//(#s)Command\ aliases(#e)/Command_aliases}} )
+ __svalue="+${__lines_list[(I)Command_aliases]}"
+ __lines_list[1,__svalue-1]=( ${(@)__lines_list[1,__svalue-1]%%[[:space:]]##*} )
+ else
+ # (**)
+ # git < v2.20, add aliases through extra code
+ __lines_list=( ${(s: :)${(M)__lines_list[@]:# [a-z]*}} )
+ __svalue=${#__lines_list}
+ # This allows to check if the command is an alias - we want to
+ # highlight the aliased command just like the target command of the alias
+ .fast-run-command "+git config --get-regexp 'alias.*'" chroma-${FAST_HIGHLIGHT[chroma-current]}-alias-list "[[:space:]]#alias." $(( 15 * 60 ))
+ fi
+
+ __tmp=${#__lines_list}
+ typeset -ga fsh__chroma__git__aliases
+ fsh__chroma__git__aliases=( ${__lines_list[__svalue+1,__tmp]} )
+ [[ ${__lines_list[__svalue]} != "Command_aliases" ]] && (( ++ __svalue, __ivalue=0, 1 )) || (( __ivalue=1 ))
+ __lines_list[__svalue,__tmp]=( ${(@)__lines_list[__svalue+__ivalue,__tmp]%%[[:space:]]##*} )
+ reply=( "${__lines_list[@]}" )
+}
+
+# A generic handler
+chroma/-git-verify-remote() {
+ local _wrd="$4"
+ .fast-run-git-command "git remote" "chroma-git-remotes-$PWD" "" 10
+ [[ -n ${__lines_list[(r)$_wrd]} ]] && {
+ __style=${FAST_THEME_NAME}correct-subtle; return 0
+ } || {
+ [[ $_wrd != *:* ]] && { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
+ }
+}
+
+# A generic handler - checks if given ref is correct
+chroma/-git-verify-ref() {
+ local _wrd="$4"
+ _wrd="${_wrd%%:*}"
+ .fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-refs-$PWD" "refs/heads" 10
+ [[ -n ${__lines_list[(r)$_wrd]} ]] && \
+ { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
+ { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
+}
+
+# A generic handler - checks if given remote or group is correct
+chroma/-git-verify-remote-or-group() {
+ chroma/-git-verify-remote "$@" && return 0
+ # The check for a group is to follow below
+ integer _start="$2" _end="$3"
+ local _scmd="$1" _wrd="$4"
+}
+
+# A generic handler - checks whether the file exists
+chroma/-git-verify-file() {
+ integer _start="$2" _end="$3" __pos __start __end
+ local _wrd="$4" bg
+
+ [[ -f $_wrd ]] && {
+ (( __start=_start, __end=_end, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
+ bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]%bg=*}
+ ((1))
+ } || {
+ (( __start=_start, __end=_end, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]%bg=*}
+ }
+
+ [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} && \
+ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path]} != \
+ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}
+ ]] && \
+ for (( __pos = 1; __pos <= (_end-_start); __pos++ )) {
+ [[ ${_wrd[__pos]} == "/" ]] && {
+ [[ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} = *bg=* ]] && {
+ (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
+ reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}")
+ ((1))
+ } || {
+ (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
+ reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}${bg:+,$bg}")
+ }
+ }
+ }
+}
+
+# A generic handler - checks whether the file exists
+chroma/-git-verify-file-or-dir() {
+ integer _start="$2" _end="$3" __pos __start __end retval
+ local _wrd="$4" bg
+
+ __style=
+ [[ -f $_wrd || -d $_wrd ]] && {
+ (( __start=_start, __end=_end, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
+ bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]%bg=*}
+ ((1))
+ } || {
+ (( __start=_start, __end=_end, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]%bg=*}
+ retval=1
+ }
+
+ [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} && \
+ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path]} != \
+ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}
+ ]] && \
+ for (( __pos = 1; __pos <= (_end-_start); __pos++ )) {
+ [[ ${_wrd[__pos]} == "/" ]] && {
+ [[ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} = *bg=* ]] && {
+ (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
+ reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}")
+ ((1))
+ } || {
+ (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
+ reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}${bg:+,$bg}")
+ }
+ }
+ }
+ return $retval
+}
+
+chroma/-git-verify-branch() {
+ local _wrd="$4"
+ .fast-run-git-command "git for-each-ref --format='%(refname:short)'" "chroma-git-branches-$PWD" "refs/heads" 10
+ if [[ -n ${__lines_list[(r)$_wrd]} ]] {
+ __style=${FAST_THEME_NAME}correct-subtle; return 0
+ } elif [[ -n ${__lines_list[(r)origin/$_wrd]} ]] {
+ __style=${FAST_THEME_NAME}correct-subtle; return 0
+ } else {
+ __style=${FAST_THEME_NAME}incorrect-subtle; return 1
+ }
+}
+
+chroma/-git-verify-also-unfetched-ref() {
+ local _wrd="$4"
+ .fast-run-git-command "git config --get checkout.defaultRemote" "chroma-git-defaultRemote-$PWD" "" 10
+ local remote="${__lines_list[1]:-origin}"
+ .fast-run-git-command "git rev-list --count --no-walk --glob=\"refs/remotes/$remote/$_wrd\"" \
+ "chroma-git-unfetched-ref-$PWD" "" 10
+
+ (( __lines_list[1] )) && { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
+ { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
+}
+
+# A generic handler
+chroma/-git-file-or-ubranch-or-commit-verify() {
+ chroma/-git-verify-commit "$@" && return
+ chroma/-git-verify-file "$@" && return
+ chroma/-git-verify-branch "$@" && return
+ chroma/-git-verify-also-unfetched-ref "$@"
+}
+
+# A generic handler
+chroma/-git-file-or-dir-or-ubranch-or-commit-verify() {
+ chroma/-git-verify-commit "$@" && return
+ chroma/-git-verify-file-or-dir "$@" && return
+ chroma/-git-verify-branch "$@" && return
+ chroma/-git-verify-also-unfetched-ref "$@"
+}
+
+# A generic handler
+chroma/-git-verify-correct-branch-name() {
+ local _wrd="$4"
+ chroma/-git-verify-commit "$@" && { __style=${FAST_THEME_NAME}incorrect-subtle; return 0; }
+
+ chroma/-git-verify-remote "$@" && { __style=${FAST_THEME_NAME}incorrect-subtle; return 0; }
+
+ [[ "$_wrd" != ./* && "$_wrd" != *..* && "$_wrd" != *[~\^\ $'\t']* && \
+ "$_wrd" != */ && "$_wrd" != *.lock && "$_wrd" != *\\* ]] && \
+ { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
+ { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
+}
+
+# A generic handler that checks if given commit reference is correct
+chroma/-git-verify-commit() {
+ local _wrd="$4"
+ __lines_list=()
+ .fast-run-git-command --status "git rev-parse --verify --quiet \"$_wrd\"" \
+ "chroma-git-commits-$PWD-$_wrd" "" $(( 1.5 * 60 ))
+ if (( __lines_list[1] == 0 )); then
+ __style=${FAST_THEME_NAME}correct-subtle
+ return 0
+ fi
+ __style=${FAST_THEME_NAME}incorrect-subtle
+ return 1
+}
+
+# A generic handler that checks if given commit reference
+# is correct or if it's a file that exists
+chroma/-git-verify-commit-or-file() {
+ chroma/-git-verify-commit "$@" && return
+ chroma/-git-verify-file "$@"
+}
+
+# A generic handler that checks if given commit reference
+# is correct or if it's a file or directives that exists
+chroma/-git-verify-commit-or-file-or-dir() {
+ chroma/-git-verify-commit "$@" && return
+ chroma/-git-verify-file-or-dir "$@"
+}
+
+# A generic handler that checks if given revision range
+# is correct or if a file of that name exists
+chroma/-git-verify-rev-range-or-file() {
+ local _wrd="$4"
+ chroma/-git-verify-commit "$@" && return 0
+
+ if [[ "$_wrd" = *..* ]]; then
+ (( FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file] )) && {
+ chroma/-git-verify-file "$@" && return 0
+ __style=${FAST_THEME_NAME}unknown-token
+ return 1
+ }
+ __style=""
+ return 0
+ fi
+
+ chroma/-git-verify-file "$@" && { FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=1; return 0; }
+
+ __style=""
+ return 1
+}
+
+chroma/-git-verify-tag-name() {
+ local _wrd="$4"
+ .fast-run-git-command "git tag" "chroma-git-tags-$PWD" "" $(( 2*60 ))
+ [[ -n ${__lines_list[(r)$_wrd]} ]] && \
+ __style=${FAST_THEME_NAME}correct-subtle || __style=${FAST_THEME_NAME}incorrect-subtle
+}
+
+# A handler for the commit's -m/--message options.Currently
+# does the same what chroma/main-chroma-std-aopt-action does
+chroma/-git-commit-msg-opt-action() {
+ chroma/main-chroma-std-aopt-action "$@"
+}
+
+# A handler for the commit's -m/--message options' argument
+chroma/-git-commit-msg-opt-ARG-action() {
+ integer _start="$2" _end="$3"
+ local _scmd="$1" _wrd="$4"
+
+ (( __start >= 0 )) || return
+
+ # Match the message body in case of an --message= option
+ if [[ "$_wrd" = (#b)(--message=)(*) && -n "${match[2]}" ]]; then
+ _wrd="${(Q)${match[2]//\`/x}}"
+ # highlight --message=>>something<<
+ reply+=("$(( __start+10 )) $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-quoted-argument]}")
+ elif [[ "$_wrd" != --message ]]; then
+ # highlight the message's body
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-quoted-argument]}")
+ fi
+
+ integer length=${FAST_HIGHLIGHT[git-cmsg-len]:-70}
+
+ if (( ${#_wrd} > length )); then
+ for (( __idx1 = 1, __idx2 = 1; __idx1 <= length; ++ __idx1, ++ __idx2 )); do
+ # Use __arg from the fast-highlight-process's scope
+ while [[ "${__arg[__idx2]}" != "${_wrd[__idx1]}" ]]; do
+ (( ++ __idx2 ))
+ (( __idx2 > __asize )) && { __idx2=-1; break; }
+ done
+ (( __idx2 == -1 )) && break
+ done
+ if (( __idx2 != -1 )); then
+ if [[ -n "${match[1]}" ]]; then
+ reply+=("$(( __start+__idx2 )) $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ else
+ reply+=("$(( __start+__idx2-1 )) $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ fi
+ fi
+ fi
+}
+
+# A RESET handler
+# TODO: differentiate tree-ish from commit
+chroma/-git-RESET-verify-commit-or-file() {
+ chroma/-git-verify-commit "$@" && {
+ chroma/-git-verify-file "$@" && {
+ # TODO: with -p/--patch, the are optional,
+ # and this argument will be taken as a commit in a
+ # specific circumstances
+ FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=1
+ return 0
+ }
+
+ (( FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file] || FAST_HIGHLIGHT[chroma-git-reset-etc-saw-commit] )) && \
+ { __style=${FAST_THEME_NAME}unknown-token; return 1; }
+
+ FAST_HIGHLIGHT[chroma-git-reset-etc-saw-commit]=1
+ __style=${FAST_THEME_NAME}correct-subtle
+ return 0
+ }
+
+ chroma/-git-verify-file "$@" && { FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=1; return 0; }
+
+ return 1
+}
+
+return 0
diff --git "a/\342\206\222chroma/-grep.ch" b/chroma/-grep.ch
old mode 100644
new mode 100755
similarity index 95%
rename from "\342\206\222chroma/-grep.ch"
rename to chroma/-grep.ch
index 3713e43..e0b0433
--- "a/\342\206\222chroma/-grep.ch"
+++ b/chroma/-grep.ch
@@ -66,7 +66,7 @@ integer __idx1 __idx2
done
elif (( FAST_HIGHLIGHT[chroma-grep-counter] == 2 )); then
# Handle paths, etc. normally - just pass-through to the big
- # highlighter (the main FSH highlighter, used before chromas).
+ # highlighter (the main f-sy-h highlighter, used before chromas).
return 1
fi
fi
@@ -79,7 +79,7 @@ integer __idx1 __idx2
# to disable this code.
[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-# We aren't passing-through (no return 1 occured), do obligatory things ourselves.
+# We aren't passing-through (no return 1 occurred), do obligatory things ourselves.
(( this_word = next_word ))
_start_pos=$_end_pos
diff --git "a/\342\206\222chroma/-hub.ch" b/chroma/-hub.ch
old mode 100644
new mode 100755
similarity index 99%
rename from "\342\206\222chroma/-hub.ch"
rename to chroma/-hub.ch
index 84864c6..e9f720c
--- "a/\342\206\222chroma/-hub.ch"
+++ b/chroma/-hub.ch
@@ -1,5 +1,6 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
+# vim: ft=zsh sw=2 ts=2 et
+
(( next_word = 2 | 8192 ))
local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
@@ -50,5 +51,3 @@ if [[ "$__wrd" != -* ]] && (( FAST_HIGHLIGHT[chroma-git-got-subcommand] == 0 ));
fi
chroma/-git.ch $*
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-ionice.ch" b/chroma/-ionice.ch
old mode 100644
new mode 100755
similarity index 93%
rename from "\342\206\222chroma/-ionice.ch"
rename to chroma/-ionice.ch
index e78c7b0..4ed4a98
--- "a/\342\206\222chroma/-ionice.ch"
+++ b/chroma/-ionice.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2018 Sebastian Gniazdowski
@@ -29,7 +30,7 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
-setopt local_options extendedglob warn_create_global typeset_silent
+builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd local_options
# Keep chroma-takever state meaning: until ;, handle highlighting via chroma.
# So the below 8192 assignment takes care that next token will be routed to chroma.
@@ -102,10 +103,12 @@ local -a match mbegin mend
# This is a common place of adding such entry, but any above code can do
# it itself (and it does in other chromas) and skip setting __style to
# this way disable this code.
-[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+[[ -n "$__style" ]] && \
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
# We aren't passing-through, do obligatory things ourselves.
-# _start_pos=$_end_pos advainces pointers in command line buffer.
+# _start_pos=$_end_pos advances pointers in command line buffer.
#
# To pass through means to `return 1'. The highlighting of
# this single token is then done by fast-syntax-highlighting's
@@ -114,5 +117,3 @@ local -a match mbegin mend
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-lab.ch" b/chroma/-lab.ch
old mode 100644
new mode 100755
similarity index 99%
rename from "\342\206\222chroma/-lab.ch"
rename to chroma/-lab.ch
index 8dacad8..6e8cb79
--- "a/\342\206\222chroma/-lab.ch"
+++ b/chroma/-lab.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# The `lab' tool after which this chroma is modeled after:
# https://github.com/zaquestion/lab
@@ -57,5 +58,3 @@ if [[ "$__wrd" != -* ]] && (( FAST_HIGHLIGHT[chroma-git-got-subcommand] == 0 ));
fi
chroma/-git.ch $*
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-make.ch" b/chroma/-make.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-make.ch"
rename to chroma/-make.ch
diff --git "a/\342\206\222chroma/-nice.ch" b/chroma/-nice.ch
old mode 100644
new mode 100755
similarity index 97%
rename from "\342\206\222chroma/-nice.ch"
rename to chroma/-nice.ch
index 164c095..83de3d4
--- "a/\342\206\222chroma/-nice.ch"
+++ b/chroma/-nice.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2018 Sebastian Gniazdowski
@@ -29,7 +30,7 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
-setopt local_options extendedglob warn_create_global typeset_silent
+builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
# Keep chroma-takever state meaning: until ;, handle highlighting via chroma.
# So the below 8192 assignment takes care that next token will be routed to chroma.
@@ -126,7 +127,7 @@ local -a match mbegin mend
[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
# We aren't passing-through, do obligatory things ourselves.
-# _start_pos=$_end_pos advainces pointers in command line buffer.
+# _start_pos=$_end_pos advances pointers in command line buffer.
#
# To pass through means to `return 1'. The highlighting of
# this single token is then done by fast-syntax-highlighting's
@@ -135,5 +136,3 @@ local -a match mbegin mend
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git a/chroma/-nmcli.ch b/chroma/-nmcli.ch
new file mode 100755
index 0000000..cfd3ea7
--- /dev/null
+++ b/chroma/-nmcli.ch
@@ -0,0 +1,60 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+
+(( next_word = 2 | 8192 ))
+[[ "$__arg_type" = 3 ]] && return 2
+
+typeset -A subcommands
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4" subcommand
+subcommands=(
+ help "_"
+ general "help status hostname permissions logging _"
+ networking "help on off connectivity _"
+ radio "help all wifi wwan _"
+ connection "help show up down add modify clone edit delete monitor reload load import export _"
+ device "help status show set connect reapply modify disconnect delete monitor wifi lldp _"
+ agent "help secret polkit all _"
+ monitor "help _"
+ _ "_"
+)
+
+if (( __first_call )); then
+ FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]=""
+ FAST_HIGHLIGHT[chroma-nmcli-subcommand-b]=""
+ return 1
+elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+elif [[ "$2" = -* ]]; then
+ return 1
+elif [[ -z ${FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]} ]]; then
+ for subcommand in ${(@k)subcommands}; do
+ [[ $subcommand = $__wrd* ]] && break || subcommand="_"
+ done
+ if [[ $subcommand = _ ]]; then
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ else
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}subcommand]}")
+ fi
+ FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]="$subcommand"
+elif [[ -z ${FAST_HIGHLIGHT[chroma-nmcli-subcommand-b]} ]]; then
+ for subcommand in ${(s. .)subcommands[${FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]}]}; do
+ [[ "$subcommand" = $__wrd* ]] && break || subcommand="_"
+ done
+ if [[ $subcommand = _ ]]; then
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ else
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}subcommand]}")
+ fi
+ FAST_HIGHLIGHT[chroma-nmcli-subcommand-b]="$subcommand"
+else
+ return 1
+fi
+
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git "a/\342\206\222chroma/-node.ch" b/chroma/-node.ch
old mode 100644
new mode 100755
similarity index 99%
rename from "\342\206\222chroma/-node.ch"
rename to chroma/-node.ch
index f7d2f13..07d6f2a
--- "a/\342\206\222chroma/-node.ch"
+++ b/chroma/-node.ch
@@ -1,5 +1,6 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
+# vim: ft=zsh sw=2 ts=2 et
+
(( next_word = 2 | 8192 ))
[[ "$__arg_type" = 3 ]] && return 2
@@ -36,5 +37,3 @@ elif (( FAST_HIGHLIGHT[chroma-node-file] )); then
fi
return 1
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-ogit.ch" b/chroma/-ogit.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-ogit.ch"
rename to chroma/-ogit.ch
diff --git a/chroma/-perl.ch b/chroma/-perl.ch
new file mode 100755
index 0000000..139bd18
--- /dev/null
+++ b/chroma/-perl.ch
@@ -0,0 +1,78 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# Chroma function for command `perl'. It highlights code passed to perl
+# with -e option - does syntax check by calling `perl -ce', then highlights
+# as correct or incorrect code.
+#
+# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
+# $2 - the current token, also accessible by $__arg from the above scope -
+# basically a private copy of $__arg
+# $3 - a private copy of $_start_pos, i.e. the position of the token in the
+# command line buffer, used to add region_highlight entry (see man),
+# because Zsh colorizes by *ranges* in command line buffer
+# $4 - a private copy of $_end_pos from the above scope
+#
+
+(( next_word = 2 | 8192 ))
+
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
+local __style
+integer __idx1 __idx2
+
+(( __first_call )) && {
+ # Called for the first time - new command.
+ # FAST_HIGHLIGHT is used because it survives between calls, and
+ # allows to use a single global hash only, instead of multiple
+ # global variables.
+ FAST_HIGHLIGHT[chrome-perl-got-eswitch]=0
+ return 1
+} || {
+ # Following call, i.e. not the first one.
+
+ # Check if chroma should end – test if token is of type
+ # "starts new command", if so pass-through – chroma ends
+ [[ "$__arg_type" = 3 ]] && return 2
+
+ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+ fi
+
+ if [[ "$__wrd" = -* && ${FAST_HIGHLIGHT[chroma-perl-got-subcommand]} -eq 0 ]]; then
+ __style=${FAST_THEME_NAME}${${${__wrd:#--*}:+single-hyphen-option}:-double-hyphen-option}
+
+ if [[ "$__wrd" = "-e" || ("$__wrd" = -*e* && "$__wrd" != --*) ]]; then
+ FAST_HIGHLIGHT[chrome-perl-got-eswitch]=1
+ fi
+ else
+ __wrd="${__wrd//\`/x}"
+ __arg="${__arg//\`/x}"
+ __wrd="${(Q)__wrd}"
+ if (( FAST_HIGHLIGHT[chrome-perl-got-eswitch] == 1 )); then
+ FAST_HIGHLIGHT[chrome-perl-got-eswitch]=0
+ if perl -ce "$__wrd" >/dev/null 2>&1; then
+ # Add correct-subtle style
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
+ else
+ # Add incorrect-subtle style
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
+ fi
+ else
+ # Pass-through to the big-loop outside
+ return 1
+ fi
+ fi
+}
+
+# Add region_highlight entry (via `reply' array)
+#
+# This is a common place of adding such entry, but any above
+# code can do it itself (and it does) and skip setting __style
+# to disable this code.
+[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+
+# We aren't passing-through, do obligatory things ourselves
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git "a/\342\206\222chroma/-precommand.ch" b/chroma/-precommand.ch
old mode 100644
new mode 100755
similarity index 54%
rename from "\342\206\222chroma/-precommand.ch"
rename to chroma/-precommand.ch
index 0a9211d..449801e
--- "a/\342\206\222chroma/-precommand.ch"
+++ b/chroma/-precommand.ch
@@ -1,19 +1,19 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+
local __first_call="$1" __start_pos="$3" __end_pos="$4"
[[ "$__arg_type" = 3 ]] && return 2
(( __first_call )) && {
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}precommand]}")
- (( next_word = (next_word & ~2) | 4 | 1 ))
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}precommand]}")
+ (( next_word = (next_word & ~2) | 4 | 1 ))
} || {
- return 1
+ return 1
}
(( this_word = next_word ))
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-printf.ch" b/chroma/-printf.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-printf.ch"
rename to chroma/-printf.ch
diff --git "a/\342\206\222chroma/-ruby.ch" b/chroma/-ruby.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-ruby.ch"
rename to chroma/-ruby.ch
diff --git "a/\342\206\222chroma/-scp.ch" b/chroma/-scp.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-scp.ch"
rename to chroma/-scp.ch
diff --git "a/\342\206\222chroma/-sh.ch" b/chroma/-sh.ch
old mode 100644
new mode 100755
similarity index 100%
rename from "\342\206\222chroma/-sh.ch"
rename to chroma/-sh.ch
diff --git a/chroma/-source.ch b/chroma/-source.ch
new file mode 100755
index 0000000..ee7a529
--- /dev/null
+++ b/chroma/-source.ch
@@ -0,0 +1,72 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# Chroma for `source' builtin - verifies if file to be sourced compiles
+# correctly.
+#
+# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
+#
+# $2 - the current token, also accessible by $__arg from the above scope -
+# basically a private copy of $__arg; the token can be eg.: "grep"
+#
+# $3 - a private copy of $_start_pos, i.e. the position of the token in the
+# command line buffer, used to add region_highlight entry (see man),
+# because Zsh colorizes by *ranges* in command line buffer
+#
+# $4 - a private copy of $_end_pos from the above scope
+#
+
+(( next_word = 2 | 8192 ))
+
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
+local __style __chars __home=$FAST_WORK_DIR
+integer __idx1 __idx2
+
+# First call, i.e. command starts, i.e. "grep" token etc.
+(( __first_call )) && {
+ FAST_HIGHLIGHT[chroma-src-counter]=0
+ __style=${FAST_THEME_NAME}builtin
+
+ } || {
+
+ # Following call, i.e. not the first one.
+ # Check if chroma should end – test if token is of type
+ # "starts new command", if so pass-through – chroma ends
+ [[ "$__arg_type" = 3 ]] && return 2
+
+ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+ fi
+
+ if [[ "$__wrd" = -* ]]; then
+ # Detected option, add style for it.
+ [[ "$__wrd" = --* ]] && \
+ __style=${FAST_THEME_NAME}double-hyphen-option || __style=${FAST_THEME_NAME}single-hyphen-option
+ else
+ # Count non-option tokens.
+ (( FAST_HIGHLIGHT[chroma-src-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-src-counter] ))
+ if (( FAST_HIGHLIGHT[chroma-src-counter] == 1 )); then
+ command mkdir -p "$__home"
+ command cp -f "${__wrd}" "$__home" 2>/dev/null && {
+ zcompile "$__home"/"${__wrd:t}" 2>/dev/null 1>&2 && \
+ __style=${FAST_THEME_NAME}correct-subtle || __style=${FAST_THEME_NAME}incorrect-subtle
+ }
+ elif (( FAST_HIGHLIGHT[chroma-src-counter] == 2 )); then
+ # Handle paths, etc. normally - just pass-through to the big highlighter (the main f-sy-h highlighter, used before chromas).
+ return 1
+ fi
+ fi
+}
+
+# Add region_highlight entry (via `reply' array).
+#
+# This is a common place of adding such entry, but any above
+# code can do it itself (and it does) and skip setting __style
+# to disable this code.
+[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+
+# We aren't passing-through (no return 1 occurred), do obligatory things ourselves.
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git "a/\342\206\222chroma/-ssh.ch" b/chroma/-ssh.ch
old mode 100644
new mode 100755
similarity index 97%
rename from "\342\206\222chroma/-ssh.ch"
rename to chroma/-ssh.ch
index 6be459f..cec0d65
--- "a/\342\206\222chroma/-ssh.ch"
+++ b/chroma/-ssh.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# Copyright (C) 2019 by Philippe Troin (F-i-f on GitHub)
#
@@ -16,8 +17,8 @@
# $4 - a private copy of $_end_pos from the above scope
#
-emulate -LR zsh
-setopt extended_glob warn_create_global typeset_silent
+builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
+builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
# This chroma guards that port number isn't passed in hostname (no :{port} occurs).
@@ -155,5 +156,3 @@ local -a match mbegin mend completions_users completions_host
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-subcommand.ch" b/chroma/-subcommand.ch
old mode 100644
new mode 100755
similarity index 99%
rename from "\342\206\222chroma/-subcommand.ch"
rename to chroma/-subcommand.ch
index 2e64851..36602bb
--- "a/\342\206\222chroma/-subcommand.ch"
+++ b/chroma/-subcommand.ch
@@ -1,5 +1,6 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
+# vim: ft=zsh sw=2 ts=2 et
+
(( next_word = 2 | 8192 ))
[[ "$__arg_type" = 3 ]] && return 2
@@ -24,5 +25,3 @@ fi
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-subversion.ch" b/chroma/-subversion.ch
old mode 100644
new mode 100755
similarity index 91%
rename from "\342\206\222chroma/-subversion.ch"
rename to chroma/-subversion.ch
index fc5ee47..6f38de7
--- "a/\342\206\222chroma/-subversion.ch"
+++ b/chroma/-subversion.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2018 Sebastian Gniazdowski
@@ -29,8 +30,8 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
-→chroma/-subversion.ch/parse-revision() {
- setopt local_options extendedglob warn_create_global typeset_silent
+chroma/-subversion.ch/parse-revision() {
+ builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd local_options
local __wrd="$1" __start_pos="$2" __end_pos="$3" __style __start __end
case $__wrd in
(r|)[0-9]##) __style=${FAST_THEME_NAME}mathnum ;;
@@ -41,8 +42,8 @@
(( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
}
-→chroma/-subversion.ch/parse-target() {
- setopt local_options extendedglob warn_create_global typeset_silent
+chroma/-subversion.ch/parse-target() {
+ builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd local_options
local __wrd="$1" __start_pos="$2" __end_pos="$3" __style __start __end
if [[ $__wrd == *@[^/]# ]]
then
@@ -56,13 +57,13 @@
fi
(( __start=__start_pos-${#PREBUFFER}+$#place, __end=__end_pos-${#PREBUFFER}-$#rev, __start >= 0 )) \
&& reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}for-loop-separator]}")
- →chroma/-subversion.ch/parse-revision $rev $((__start_pos+$#place+1)) $__end_pos
+ chroma/-subversion.ch/parse-revision $rev $((__start_pos+$#place+1)) $__end_pos
else
return 1
fi
}
-setopt local_options extendedglob warn_create_global
+ builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd local_options
# Keep chroma-takever state meaning: until ;, handle highlighting via chroma.
# So the below 8192 assignment takes care that next token will be routed to chroma.
@@ -180,21 +181,21 @@ integer __idx1 __idx2
|| __style=${FAST_THEME_NAME}incorrect-subtle
;;
revision)
- →chroma/-subversion.ch/parse-revision $__wrd $__start_pos $__end_pos
+ chroma/-subversion.ch/parse-revision $__wrd $__start_pos $__end_pos
;;
revision-pair)
local -a match mbegin mend
if [[ $__wrd = (#b)(\{[^}]##\}|[^:]##)(:)(*) ]]; then
- →chroma/-subversion.ch/parse-revision $match[1] $__start_pos $(( __end_pos - ( mend[3]-mend[2] ) - 1 ))
- →chroma/-subversion.ch/parse-revision $match[3] $(( __start_pos + ( mbegin[3]-mbegin[1] ) )) $__end_pos
+ chroma/-subversion.ch/parse-revision $match[1] $__start_pos $(( __end_pos - ( mend[3]-mend[2] ) - 1 ))
+ chroma/-subversion.ch/parse-revision $match[3] $(( __start_pos + ( mbegin[3]-mbegin[1] ) )) $__end_pos
(( __start=__start_pos-${#PREBUFFER}+(mbegin[2]-mbegin[1]), __end=__end_pos-${#PREBUFFER}-(mend[3]-mend[2]), __start >= 0 )) \
&& reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}for-loop-separator]}")
else
- →chroma/-subversion.ch/parse-revision $__wrd $__start_pos $__end_pos
+ chroma/-subversion.ch/parse-revision $__wrd $__start_pos $__end_pos
fi
;;
target)
- →chroma/-subversion.ch/parse-target $__wrd $__start_pos $__end_pos || return $?
+ chroma/-subversion.ch/parse-target $__wrd $__start_pos $__end_pos || return $?
;;
cmd)
this_word=1
@@ -219,7 +220,7 @@ integer __idx1 __idx2
(( FAST_HIGHLIGHT[subversion-subcommand-arguments]+=1 ))
if [[ ( $FAST_HIGHLIGHT[subversion-subcommand] == (checkout|co|export|log|merge|switch|sw) && $FAST_HIGHLIGHT[subversion-subcommand-arguments] -eq 1 ) \
|| $FAST_HIGHLIGHT[subversion-subcommand] == (blame|praise|annotate|ann|cat|copy|cp|diff|info|list|ls|mergeinfo) ]]; then
- →chroma/-subversion.ch/parse-target $__wrd $__start_pos $__end_pos || return $?
+ chroma/-subversion.ch/parse-target $__wrd $__start_pos $__end_pos || return $?
else
return 1
fi
@@ -238,7 +239,7 @@ integer __idx1 __idx2
[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
# We aren't passing-through, do obligatory things ourselves.
-# _start_pos=$_end_pos advainces pointers in command line buffer.
+# _start_pos=$_end_pos advances pointers in command line buffer.
#
# To pass through means to `return 1'. The highlighting of
# this single token is then done by fast-syntax-highlighting's
@@ -247,5 +248,3 @@ integer __idx1 __idx2
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-vim.ch" b/chroma/-vim.ch
old mode 100644
new mode 100755
similarity index 95%
rename from "\342\206\222chroma/-vim.ch"
rename to chroma/-vim.ch
index 9627043..134fa03
--- "a/\342\206\222chroma/-vim.ch"
+++ b/chroma/-vim.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# Chroma for vim, shows last opened files under prompt.
#
@@ -41,10 +42,8 @@ local -a __viminfo
# skip setting __style to disable this code.
[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-# We aren't passing-through (no return 1 occured), do obligatory things ourselves.
+# We aren't passing-through (no return 1 occurred), do obligatory things ourselves.
(( this_word = next_word ))
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-whatis.ch" b/chroma/-whatis.ch
old mode 100644
new mode 100755
similarity index 91%
rename from "\342\206\222chroma/-whatis.ch"
rename to chroma/-whatis.ch
index bfe7363..e2795a3
--- "a/\342\206\222chroma/-whatis.ch"
+++ b/chroma/-whatis.ch
@@ -1,27 +1,28 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
+# vim: ft=zsh sw=2 ts=2 et
+
(( next_word = 2 | 8192 ))
local THEFD check __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
local __style
(( ! ${+FAST_HIGHLIGHT[whatis_chroma_callback_was_ran]} )) && \
- FAST_HIGHLIGHT[whatis_chroma_callback_was_ran]=0
+ FAST_HIGHLIGHT[whatis_chroma_callback_was_ran]=0
(( ! ${+FAST_HIGHLIGHT[whatis_chroma_zle_-F_have_-w_opt]} )) && {
- is-at-least 5.0.6 && local __res=1 || local __res=0
- FAST_HIGHLIGHT[whatis_chroma_zle_-F_have_-w_opt]="$__res"
+ is-at-least 5.0.6 && local __res=1 || local __res=0
+ FAST_HIGHLIGHT[whatis_chroma_zle_-F_have_-w_opt]="$__res"
}
-fast-whatis-chroma-callback() {
- emulate -L zsh
- setopt extendedglob warncreateglobal typesetsilent
+ builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+ builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
- local THEFD="$1" input check=2 nl=$'\n' __wrd __style
+ local THEFD="$1" input check=2 nl=$'\n' __wrd __style
- .fast-zts-read-all "$THEFD" input
+ .fast-zts-read-all "$THEFD" input
- zle -F "$THEFD"
- exec {THEFD}<&-
+ zle -F "$THEFD"
+ exec {THEFD}<&-
__wrd="${${input#[^$nl]#$nl}%%$nl*}"
if [[ "$input" = test* ]]; then
@@ -133,5 +134,3 @@ fi
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-which.ch" b/chroma/-which.ch
old mode 100644
new mode 100755
similarity index 99%
rename from "\342\206\222chroma/-which.ch"
rename to chroma/-which.ch
index a7209c0..b0dc082
--- "a/\342\206\222chroma/-which.ch"
+++ b/chroma/-which.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# Outputs (under prompt) result of query done with `which', `type -w',
# `whence -v', `whereis', `whatis'.
@@ -91,5 +92,3 @@ local -a __results
_start_pos=$_end_pos
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-zi.ch" b/chroma/-zi.ch
old mode 100644
new mode 100755
similarity index 82%
rename from "\342\206\222chroma/-zi.ch"
rename to chroma/-zi.ch
index 4af0adb..7019664
--- "a/\342\206\222chroma/-zi.ch"
+++ b/chroma/-zi.ch
@@ -1,4 +1,5 @@
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
#
# Chroma function for command `zi'. It colorizes the part of command line that holds `zi' invocation.
@@ -15,7 +16,7 @@ fsh__zi__chroma__def=(
subcmd:NULL "NULL_0_opt"
NULL_0_opt "(-help|--help|-h)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
"subcommands" "(help|subcmds|icemods|analytics|man|self-update|times|zstatus|load|light|unload|snippet|ls|ice||update|status|report|delete|loaded|list|cd|create|edit|glance|stress|changes|recently|clist|completions|cclear|cdisable|cenable|creinstall|cuninstall|csearch|compinit|dtrace|dstart|dstop|dunload|dreport|dclear|compile|uncompile|compiled|cdlist|cdreplay|cdclear|srv|recall|env-whitelist|bindkeys|module|add-fpath|run)"
## }}}
@@ -32,7 +33,7 @@ fsh__zi__chroma__def=(
subcmd:ice "ICE_#_arg // NO_MATCH_#_opt"
- "ICE_#_arg" "NO-OP // ::→chroma/-zi-check-ice-mod"
+ "ICE_#_arg" "NO-OP // ::chroma/-zi-check-ice-mod"
##
## `snippet'
@@ -42,9 +43,9 @@ fsh__zi__chroma__def=(
subcmd:snippet "SNIPPET_0_opt // SNIPPET_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
SNIPPET_0_opt "(-h|--help|-f|--force|--command|-x)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
- SNIPPET_1_arg "NO-OP // ::→chroma/-zi-verify-snippet"
+ SNIPPET_1_arg "NO-OP // ::chroma/-zi-verify-snippet"
## }}}
@@ -55,9 +56,9 @@ fsh__zi__chroma__def=(
"subcmd:load" "LOAD_1_arg // LOAD_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
- LOAD_1_arg "NO-OP // ::→chroma/-zi-verify-plugin"
+ LOAD_1_arg "NO-OP // ::chroma/-zi-verify-plugin"
- LOAD_2_arg "NO-OP // ::→chroma/-zi-verify-plugin"
+ LOAD_2_arg "NO-OP // ::chroma/-zi-verify-plugin"
## }}}
@@ -69,9 +70,9 @@ fsh__zi__chroma__def=(
"subcmd:(compile|uncompile|stress|edit|glance|recall|status|cd|changes)"
"PLGSNP_1_arg // PLGSNP_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
- PLGSNP_1_arg "NO-OP // ::→chroma/-zi-verify-plugin-or-snippet"
+ PLGSNP_1_arg "NO-OP // ::chroma/-zi-verify-plugin-or-snippet"
- PLGSNP_2_arg "NO-OP // ::→chroma/-zi-verify-plugin-or-snippet"
+ PLGSNP_2_arg "NO-OP // ::chroma/-zi-verify-plugin-or-snippet"
## }}}
@@ -84,7 +85,7 @@ fsh__zi__chroma__def=(
UPDATE_0_opt "
(-L|--plugins|-s|--snippets|-p|--parallel|-a|--all|-q|--quiet|-r|--reset|-u|--urge|-n|--no-pager|-v|--verbose|-h|--help)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
## }}}
@@ -96,7 +97,7 @@ fsh__zi__chroma__def=(
subcmd:light "LIGHT_0_opt // LOAD_1_arg // LOAD_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
LIGHT_0_opt "-h|--help|-b
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
## }}}
@@ -108,11 +109,11 @@ fsh__zi__chroma__def=(
subcmd:unload "UNLOAD_0_opt // UNLOAD_1_arg // UNLOAD_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
UNLOAD_0_opt "-h|--help|-q|--quiet
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
- UNLOAD_1_arg "NO-OP // ::→chroma/-zi-verify-loaded-plugin"
+ UNLOAD_1_arg "NO-OP // ::chroma/-zi-verify-loaded-plugin"
- UNLOAD_2_arg "NO-OP // ::→chroma/-zi-verify-loaded-plugin"
+ UNLOAD_2_arg "NO-OP // ::chroma/-zi-verify-loaded-plugin"
## }}}
@@ -125,7 +126,7 @@ fsh__zi__chroma__def=(
NO_MATCH_#_arg"
REPORT_0_opt "--all
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
## }}}
@@ -139,7 +140,7 @@ fsh__zi__chroma__def=(
DELETE_0_opt "
(-a|--all|-c|--clean|-y|--yes|-q|--quiet|-h|--help)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
+ <<>> NO-OP // ::chroma/main-chroma-std-aopt-action"
## }}}
@@ -150,7 +151,7 @@ fsh__zi__chroma__def=(
subcmd:cenable "COMPLETION_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
- COMPLETION_1_arg "NO-OP // ::→chroma/-zi-verify-disabled-completion"
+ COMPLETION_1_arg "NO-OP // ::chroma/-zi-verify-disabled-completion"
## }}}
@@ -161,7 +162,7 @@ fsh__zi__chroma__def=(
subcmd:cdisable "DISCOMPLETION_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
- DISCOMPLETION_1_arg "NO-OP // ::→chroma/-zi-verify-completion"
+ DISCOMPLETION_1_arg "NO-OP // ::chroma/-zi-verify-completion"
## }}}
@@ -173,7 +174,7 @@ fsh__zi__chroma__def=(
subcmd:uncompile "UNCOMPILE_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
- UNCOMPILE_1_arg "NO-OP // ::→chroma/-zi-verify-compiled-plugin"
+ UNCOMPILE_1_arg "NO-OP // ::chroma/-zi-verify-compiled-plugin"
## }}}
@@ -183,17 +184,17 @@ fsh__zi__chroma__def=(
## {{{
"subcmd:*" "CATCH_ALL_#_opt"
- "CATCH_ALL_#_opt" "* <<>> NO-OP // ::→chroma/main-chroma-std-aopt-SEMI-action"
+ "CATCH_ALL_#_opt" "* <<>> NO-OP // ::chroma/main-chroma-std-aopt-SEMI-action"
## }}}
)
-#→chroma/-zi-first-call() {
+#chroma/-zi-first-call() {
# This is being done in the proper place - in -fast-highlight-process
#FAST_HIGHLIGHT[chroma-zi-ice-elements-svn]=0
#}
-→chroma/-zi-verify-plugin() {
+chroma/-zi-verify-plugin() {
local _scmd="$1" _wrd="$4"
[[ -d "$_wrd" ]] && { __style=${FAST_THEME_NAME}correct-subtle; return 0; }
@@ -209,12 +210,12 @@ fsh__zi__chroma__def=(
return 0
}
-→chroma/-zi-verify-plugin-or-snippet() {
- →chroma/-zi-verify-plugin "$1" "" "" "$4" || →chroma/-zi-verify-snippet "$1" "" "" "$4"
+chroma/-zi-verify-plugin-or-snippet() {
+ chroma/-zi-verify-plugin "$1" "" "" "$4" || chroma/-zi-verify-snippet "$1" "" "" "$4"
return $?
}
-→chroma/-zi-verify-loaded-plugin() {
+chroma/-zi-verify-loaded-plugin() {
local _scmd="$1" _wrd="$4"
typeset -a plugins absolute1 absolute2 absolute3 normal
plugins=( "${ZI_REGISTERED_PLUGINS[@]:#_local/zi}" )
@@ -234,7 +235,7 @@ fsh__zi__chroma__def=(
return 0
}
-→chroma/-zi-verify-completion() {
+chroma/-zi-verify-completion() {
local _scmd="$1" _wrd="$4"
# Find enabled completions
typeset -a completions
@@ -248,7 +249,7 @@ fsh__zi__chroma__def=(
return 0
}
-→chroma/-zi-verify-disabled-completion() {
+chroma/-zi-verify-disabled-completion() {
local _scmd="$1" _wrd="$4"
# Find enabled completions
typeset -a completions
@@ -261,7 +262,7 @@ fsh__zi__chroma__def=(
return 0
}
-→chroma/-zi-verify-compiled-plugin() {
+chroma/-zi-verify-compiled-plugin() {
local _scmd="$1" _wrd="$4"
typeset -a plugins
@@ -283,7 +284,7 @@ fsh__zi__chroma__def=(
return 1
}
-→chroma/-zi-verify-snippet() {
+chroma/-zi-verify-snippet() {
local _scmd="$1" url="$4" dirname local_dir
url="${${url#"${url%%[! $'\t']*}"}%/}"
id_as="${FAST_HIGHLIGHT[chroma-zi-ice-elements-id-as]:-${ZI_ICE[id-as]:-$url}}"
@@ -307,7 +308,7 @@ fsh__zi__chroma__def=(
}
}
-→chroma/-zi-check-ice-mod() {
+chroma/-zi-check-ice-mod() {
local _scmd="$1" _wrd="$4"
[[ "$_wrd" = (svn(\'|\")*|svn) ]] && FAST_HIGHLIGHT[chroma-zi-ice-elements-svn]=1
[[ "$_wrd" = (#b)(id-as(:|)(\'|\")(*)(\'|\")|id-as:(*)|id-as(*)) ]] && \
@@ -346,5 +347,3 @@ fsh__zi__chroma__def=(
}
return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git a/chroma/main-chroma.ch b/chroma/main-chroma.ch
new file mode 100755
index 0000000..90da55d
--- /dev/null
+++ b/chroma/main-chroma.ch
@@ -0,0 +1,439 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# Main chroma function. It allows to create the command-dedicated chromas
+# (like -git.ch) through a definition provided by `chroma_def' array (read
+# from the upper scope).
+#
+# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
+# $2 - the current token, also accessible by $__arg from the above scope -
+# basically a private copy of $__arg
+# $3 - a private copy of $_start_pos, i.e. the position of the token in the
+# command line buffer, used to add region_highlight entry (see man),
+# because Zsh colorizes by *ranges* in command line buffer
+# $4 - a private copy of $_end_pos from the above scope
+#
+
+(( next_word = 2 | 8192 ))
+
+chroma/main-chroma-print() {
+ (( FAST_HIGHLIGHT[DEBUG] )) && print "$@" >> /tmp/fsh-dbg
+}
+
+local __chroma_name="${1#\%}" __first_call="$2" __wrd="$3" __start_pos="$4" __end_pos="$5"
+
+# Not a well formed chroma name
+[[ -z "$__chroma_name" ]] && return 1
+
+# Load the fsh_{name-of-the-chroma}_chroma_def array
+(( !FAST_HIGHLIGHT[-${__chroma_name}.ch-chroma-def] )) && chroma/-${__chroma_name}.ch
+
+chroma/main-chroma-print -r -- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+chroma/main-chroma-print -r -- @@@@@@@ local __chroma_name="${1#\%}" __first_call="$2" __wrd="$3" __start_pos="$4" __end_pos="$5" @@@@@@@
+local __style __entry __value __action __handler __tmp __svalue __hspaces=$'\t ' __nl=$'\n' __ch_def_name
+integer __idx1 __idx2 __start __end __ivalue __have_value=0
+local -a __lines_list __avalue
+local -A map
+map=( "#" "_H" "^" "_D" "*" "_S" )
+
+(( __start=_start_pos-__PBUFLEN, __end=_end_pos-__PBUFLEN ))
+
+# Handler that highlights the options
+chroma/main-chroma-std-aopt-action() {
+ integer _start="$2" _end="$3"
+ local _scmd="$1" _wrd="$4"
+
+ [[ "$_wrd" = (#b)(--[a-zA-Z0-9_-]##)=(*) ]] && {
+ reply+=("$_start $(( _end - mend[2] + mbegin[2] - 1 )) ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-hyphen-option]}")
+ } || {
+[[ "$_wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
+ __style=${FAST_THEME_NAME}single-hyphen-option
+ }
+}
+
+# Handler that highlights the options' arguments
+chroma/main-chroma-std-aopt-ARG-action() {
+ integer _start="$2" _end="$3"
+ local _scmd="$1" _wrd="$4"
+
+ [[ "$_wrd" = (#b)(--[a-zA-Z0-9_-]##)=(*) ]] && {
+ reply+=("$(( _start + 1 + mend[1] )) $_end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}optarg-${${${(M)match[2]:#<->}:+number}:-string}]}")
+ } || __style=${FAST_THEME_NAME}optarg-${${${(M)_wrd:#(-|)<->}:+number}:-string}
+}
+
+# This handler also highlights explicit arguments, i.e. --opt=the-explicit-arg
+chroma/main-chroma-std-aopt-SEMI-action() {
+ integer _start="$2" _end="$3"
+ local _scmd="$1" _wrd="$4"
+
+ [[ "$_wrd" = (#b)(--[a-zA-Z0-9_-]##)=(*) ]] && {
+ reply+=("$_start $(( _end - mend[2] + mbegin[2] - 1 )) ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-hyphen-option]}")
+ reply+=("$(( _start + 1 + mend[1] )) $_end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}optarg-${${${(M)match[2]:#<->}:+number}:-string}]}")
+ } || {
+ [[ "$_wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
+ __style=${FAST_THEME_NAME}single-hyphen-option
+ }
+}
+
+# A handler which verifies the token as an GIT url
+chroma/main-chroma-std-verify-url() {
+ setopt localoptions extendedglob
+ local _wrd="$4"
+ integer url_correct=0
+ # Correct matches
+ # Correct matches
+ if [[ "$_wrd" = (#b)(git|http|https|ftp|ftps|file)://([a-zA-Z0-9._~-]##)(:[0-9]##)(#c0,1)(/([a-zA-Z0-9./_~:-]##))(#c0,1) ]]; then
+ url_correct=1
+ elif [[ "$_wrd" = (#b)rsync://([a-zA-Z0-9._~-]##)(/([a-zA-Z0-9./_~:-]##))(#c0,1) ]]; then
+ url_correct=1
+ elif [[ "$_wrd" = (#b)ssh://([a-zA-Z0-9._~-]##@)(#c0,1)([a-zA-Z0-9._~-]##)(:[0-9]##)(#c0,1)(/([a-zA-Z0-9./_~:-]##))(#c0,1) ]]; then
+ url_correct=1
+ elif [[ "$_wrd" = (#b)([a-zA-Z0-9._~-]##@)(#c0,1)([a-zA-Z0-9._~-]##):([a-zA-Z0-9./_~:-](#c0,1)[a-zA-Z0-9._~:-][a-zA-Z0-9./_~:-]#)(#c0,1) ]]; then
+ url_correct=1
+ elif [[ "$_wrd" = (#b)[[:alnum:]/_~:.-]## ]]; then
+ url_correct=1
+ fi
+
+ (( url_correct )) && \
+ { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
+ { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
+}
+
+# A handler which verifies the token as a shell wildcard
+chroma/main-chroma-std-verify-pattern() {
+ setopt localoptions extendedglob
+ local _wrd="$4"
+ __style=${FAST_THEME_NAME}globbing-ext
+}
+
+# Creates a hash table for given option set (an *_opt field in the chroma def.)
+chroma/main-create-OPTION-hash.ch() {
+ local __subcmd="$1" __option_set_id="$2" __the_hash_name="$3" __ __e __el __the_hash_name __var_name
+ local -a __split __sp __s
+
+ chroma/main-chroma-print -rl "======================" " **## STARTING ##** chroma/main-##CREATE##-option-HASH.ch // subcmd:$__subcmd // option_set_id:$__option_set_id // h-nam:$__the_hash_name"
+ chroma/main-chroma-print "[D] Got option-set: ${(j:,:)__option_set_id}"
+ typeset -gA "$__the_hash_name"
+ chroma/main-chroma-print "[E] __the_hash_name ${__the_hash_name}:[$__option_set_id]"
+
+ # Split on ||
+ __ch_def_name="fsh__${__chroma_name}__chroma__def[${__option_set_id}]"
+ __split=( "${(P@s:||:)__ch_def_name}" )
+ [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
+ # Remove only leading and trailing whitespace
+ __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+
+ chroma/main-chroma-print -rl "[F] Got ||-__split: _________" ${${(@)${${__split[@]##[[:space:]]##}[@]//[${__hspaces}]##/ }[@]//[${__nl}]##/$__nl}[@]//(#s)/:::} "_________"
+ for __el in $__split; do
+ __sp=( "${(@s:<<>>:)__el}" )
+ [[ ${#__sp} -eq 1 && -z "${__sp[1]}" ]] && __sp=()
+ __sp=( "${__sp[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ chroma/main-chroma-print -l -- "Processing an ||-part - got <<>>-split: _________" "${${__sp[@]}[@]/(#s)/-\\t}" "_________"
+ __e="${__sp[1]}"
+ local __e1=${${__e#\(}%\)(:add|:del|)}
+ local __e2=${(M)__e##\(*\)(:add|:del)}
+ # Split on | with the ( and ) and :add/:del stripped and then append
+ # the :add or :del depending on what's on the input line
+ __s=()
+ for __ in ${(@s:|:)__e1}; do
+ __s+=( $__${__e2:+${(M)__e%(:add|:del)}} )
+ done
+ [[ ${#__s} -eq 1 && -z "${__s[1]}" ]] && __s=()
+ __s=( "${__s[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ shift __sp
+ for __ in $__s; do
+ __=${__%\^}
+ [[ "$__" = -*:(add|del) ]] && __var_name="${__the_hash_name}[${__}-directive]" || __var_name="${__the_hash_name}[${__}-opt-action]"
+ chroma/main-chroma-print "${(r:70:: :):-${__var_name}} := >>${__sp[1]}${${${#__sp}:#(0|1)}:+ +}<<"
+ : ${(P)__var_name::=${__sp[1]}${${${#__sp}:#(0|1)}:+ +}}
+ if (( ${#__sp} >= 2 )); then
+ __var_name="${__the_hash_name}[${__}-opt-arg-action]"
+ chroma/main-chroma-print "${(r:70:: :):-${__var_name}} := >>${__sp[2]}<<}"
+ : ${(P)__var_name::=$__sp[2]}
+ fi
+ done
+ done
+}
+
+# Processes given token
+chroma/main-process-token.ch() {
+ local __subcmd="$1" __wrd="$2" __val __var_name __main_hash_name __the_hash_name __i __size
+ local -a __splitted __split __added
+
+ chroma/main-chroma-print "\n******************* Starting chroma/main-process-token <<$__wrd>>// subcmd:${(qq)__subcmd}"
+ __main_hash_name="fsh__chroma__main__${${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}//(#b)([\#\^\*])/${map[${match[1]}]}}"
+ __var_name="${__main_hash_name}[subcmd:$__subcmd]"
+ __splitted=( "${(@s://:P)__var_name}" )
+ [[ ${#__splitted} -eq 1 && -z "${__splitted[1]}" ]] && __splitted=()
+ __splitted=( "${__splitted[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+
+ chroma/main-chroma-print -rl -- "[B] MAIN-PROCESS-TOKEN: got [OPTION/ARG-**S-E-T-S**] //-splitted from subcmd:$__subcmd: ${${(j:, :)__splitted}:-EMPTY-SET!}" "----- __splitted\\Deleted: -----" ${${(j:, :)${__splitted[@]:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}}:-EMPTY-SET (deleted)!} "----- Added\\Deleted: -----" ${${(j:, :)${${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}}:-EMPTY-SET (added)!} -----\ Deleted:\ ----- ${(j:, :)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}} >> /tmp/reply
+
+ (( ! ${#__splitted} )) && {
+ __var_name="${__main_hash_name}[subcmd:*]"
+ __splitted=( "${(@s://:P)__var_name}" )
+ [[ ${#__splitted} -eq 1 && -z "${__splitted[1]}" ]] && __splitted=()
+ __splitted=( "${__splitted[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ (( ! ${#__splitted} )) && return 1
+ }
+
+ chroma/main-chroma-print -rl -- "---NO-HASH-CREATE-FROM-NOW-ON---"
+
+ if [[ -z "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}" ]]; then
+ chroma/main-chroma-print -rl -- "-z OPT-WITH-ARG-ACTIVE == true"
+ if [[ "$__wrd" = -* ]]; then
+ chroma/main-chroma-print "1st-PATH (-z opt-with-arg-active, non-opt-arg branch, i.e. OPTION BRANCH) [#${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}]"
+ for __val in ${__splitted[@]:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})} ${${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}; do
+ [[ "${__val}" != "${__val%%_([0-9]##|\#)##*}"_${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}_opt(\*|\^|) && "${__val}" != "${__val%%_([0-9]##|\#)*}"_"#"_opt(\*|\^|) ]] && { chroma/main-chroma-print "DIDN'T MATCH $__val / arg counter:${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}" ; continue; } || chroma/main-chroma-print "Got candidate: $__val"
+ # Create the hash cache-parameter if needed
+ __the_hash_name="fsh__chroma__${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}__${__subcmd//[^a-zA-Z0-9_]/_}__${${__val//(#b)([\#\^\*])/${map[${match[1]}]}}//[^a-zA-Z0-9_]/_}"
+ [[ "$__val" = *_opt(\*|\^|) && "${(P)+__the_hash_name}" -eq 0 ]] && chroma/main-create-OPTION-hash.ch "$__subcmd" "$__val" "$__the_hash_name" || chroma/main-chroma-print "Not creating, the hash already exists..."
+ # Try dedicated-entry for the option
+ __var_name="${__the_hash_name}[${${${${(M)__wrd#?*=}:+${__wrd%=*}=}:-$__wrd}}-opt-action]"
+ __split=( "${(@s://:P)__var_name}" )
+ [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
+ # If no result, then try with catch-all entry
+ (( ! ${#__split} )) && {
+ chroma/main-chroma-print "% no ${(q-)${${${(M)__wrd#?*=}:+${__wrd%=*}=}:-$__wrd}}-opt-action, retrying with *-opt-action" "|__var_name|:$__var_name"
+ __var_name="${__the_hash_name}[*-opt-action]"
+ __split=( "${(@s://:P)__var_name}" )
+ [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
+ }
+ __svalue="$__var_name"
+ # Remove whitespace
+ __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ chroma/main-chroma-print -l -- "\`$__val' // ${#__split} // $__wrd: (ch.run #${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]}), deref. of \`$__var_name'"
+ if (( ${#__split} )); then
+ chroma/main-chroma-print -l -- "Got split of {\$#__split:$#__split} ${__wrd}-opt-action or *-opt-action" "${${(q-)__split[@]}[@]/(#s)/->\\t}"
+ if [[ "${__split[2]}" = *[[:blank:]]+ ]]; then
+ chroma/main-chroma-print "YES handling the value (the OPT.ARGUMENT)! [${__split[2]}]"
+ if [[ "$__wrd" = *=* ]]; then
+ chroma/main-chroma-print "The-immediate Arg-Acquiring, of option"
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]="${__svalue%-opt-action\]}-opt-arg-action]"
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-arg]="${__wrd#*=}"
+ __have_value=2
+ else
+ chroma/main-chroma-print "Enable Arg-Awaiting, of option"
+ chroma/main-chroma-print "FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]=\"${__svalue%-opt-action\]}-opt-arg-action]\""
+ __have_value=0
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]="${__svalue%-opt-action\]}-opt-arg-action]"
+ fi
+ fi
+ __action="${__split[1]}"
+ __handler="${__split[2]%[[:blank:]]+}"
+ # Check for directives (like :add)
+ if [[ "$__val" = *_opt\^ ]]; then
+ __var_name="${__the_hash_name}[${${${${(M)__wrd#?*=}:+${__wrd%=*}=}:-$__wrd}}:add-directive]"
+ (( ${(P)+__var_name} )) && __split=( "${(@s://:P)__var_name}" ) || __split=()
+ [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split[1]=()
+ __ivalue=${#__split}
+ __var_name="${__var_name%:add-*}:del-directive]"
+ (( ${(P)+__var_name} )) && __split+=( "${(@s://:P)__var_name}" )
+ [[ ${#__split} -eq $(( __ivalue + 1 )) && -z "${__split[__ivalue+1]}" ]] && __split[__ivalue+1]=()
+ __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ __tmp=${#__split}
+ # First: del-directive
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]+="${(j: :)__split[__ivalue+1,__tmp]} "
+ chroma/main-chroma-print -rl ":add / :del directives: __ivalue:$__ivalue, THE __SPLIT[#$__tmp]: " "${__split[@]}" "//" "The FAST_HIGHLIGHT[chroma-*deleted-nodes]: " ${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]} >> /tmp/reply
+ # Second: add-directive
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]+="${(j: :)__split[1,__ivalue]} "
+ fi
+ [[ "$__handler" = ::[^[:space:]]* ]] && __handler="${__handler#::}" || __handler=""
+ [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && { chroma/main-chroma-print -rl -- "Running handler(1): $__handler" ; "$__handler" "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}" "$__start" "$__end" "$__wrd"; }
+ [[ "$__have_value" -ne 2 && -n "$__action" && "$__action" != "NO-OP" ]] && { chroma/main-chroma-print -rl "Running action (1): $__action" ; eval "() { $__action; }"; }
+ [[ "$__val" != *\* ]] && break
+ else
+ chroma/main-chroma-print -rl -- "NO-MATCH ROUTE TAKEN"
+ fi
+ done
+ else
+ chroma/main-chroma-print "1st-PATH-B (-z opt-with-arg-active, non-opt-arg branch, ARGUMENT BRANCH [#${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}]) //// added-nodes: ${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}"
+ for __val in ${__splitted[@]:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})} ${${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}; do
+ [[ "${__val}" != "${__val%%_([0-9]##|\#)*}"_"${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}"_arg(\*|\^|) && "${__val}" != "${__val%%_([0-9]##|\#)*}"_"#"_arg(\*|\^|) ]] && { chroma/main-chroma-print "Continuing for $__val / arg counter ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}" ; continue }
+ # Create the hash cache-parameter if needed
+ __the_hash_name="fsh__chroma__${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}__${__subcmd//[^a-zA-Z0-9_]/_}__${${__val//\#/H}//[^a-zA-Z0-9_]/_}"
+ __action="" __handler=""
+ chroma/main-chroma-print "A hit, chosen __val:$__val!"
+ __ch_def_name="fsh__${__chroma_name}__chroma__def[$__val]"
+ __split=( "${(P@s:<<>>:)__ch_def_name}" )
+ __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ __sp=( "${(@s://:)__split[1]}" )
+ __sp=( "${__sp[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ __action="${__sp[1]#*::::: ##}"
+ # Verify if it's the expected argument
+ [[ "${__sp[1]}" = *:::::* && "$__wrd" != ${~${__sp[1]%% ##:::::*}} ]] && \
+ { chroma/main-chroma-print -r "mismatch ${__sp[1]%% ##:::::*} != $__wrd, continuing" ; continue; }
+ chroma/main-chroma-print -l -- "Got action record for $__val, i.e. the split:" "${__sp[@]//(#s)/-\t}" "_________"
+ [[ "${__sp[2]}" = ::[^[:space:]]* ]] && __handler="${__sp[2]#::}" || { [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && chroma/main-chroma-print "=== Error === In chroma definition: a handler entry ${(q)__sp[2]} without leading \`::'" ; }
+ [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && { chroma/main-chroma-print -rl -- "Running handler(3): $__handler" ; "$__handler" "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}" "$__start" "$__end" "$__wrd"; }
+ [[ -n "$__action" && "$__action" != "NO-OP" ]] && { chroma/main-chroma-print -rl -- "Running action(3): $__action" ; eval "() { $__action; } \"${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}\" \"$__start\" \"$__end\" \"$__wrd\""; }
+ # Check for argument directives (like :add)
+ if (( ${#__split} >= 2 )); then
+ for __ in "${(@)__split[2,-1]}"; do
+ __splitted=( "${(@s://:)__}" )
+ if [[ "${__splitted[1]}" = add:* ]]; then
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]+="${__splitted[1]#add:} ${(j: :)__splitted[2,-1]} "
+ elif [[ "${__splitted[1]}" = del:* ]]; then
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]+="${__splitted[1]#del:} ${(j: :)__splitted[2,-1]} "
+ fi
+ done
+ chroma/main-chroma-print -l "ARGUMENT :add / :del directives: THE __SPLIT[#${#__split}]: " "${__split[@]//(#s)/-\\t}" "//" "The FAST_HIGHLIGHT[chroma-*deleted-nodes]: " ${(@)${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}//(#s)/-\\t} "The FAST_HIGHLIGHT[chroma-*added-nodes]: " ${(@)${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}//(#s)/-\\t}
+ fi
+ [[ "$__val" != *\* ]] && break
+ done
+ fi
+ else
+ chroma/main-chroma-print -- "2nd-PATH (-n opt-with-arg-active) NON-EMPTY arg-active:\nThe actual opt-val <<< \$__wrd:$__wrd >>> store (after the \`Arg-Awaiting' in the chroma-run: #$(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]-1 )) [current: #$(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr] ))])"
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-arg]="$__wrd"
+ __have_value=1
+ fi
+ # Execute the action if not during simulated opt-argument (--opt=...)
+ chroma/main-chroma-print "** BEFORE: \`if (( __have_value ))'"
+ if (( __have_value )); then
+ chroma/main-chroma-print "In the \`if (( __have_value ))' [have_value: $__have_value]"
+ # Split
+ __var_name="${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}"
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]=""
+ __split=( "${(@s://:P)__var_name}" )
+ [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && { chroma/main-chroma-print -rl "NULL at __var_name:$__var_name" ; __split=(); }
+ __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ # Remember 1st level action
+ (( __have_value == 2 )) && __value="$__action" || __value=""
+ if (( ${#__split} )); then
+ chroma/main-chroma-print -l -- "Got //-split (3, for opt-ARG-action, from [$__var_name]):" "${${(q-)__split[@]}[@]/(#s)/+\\t}"
+ __action="${__split[1]}"
+ __handler="${__split[2]}"
+ [[ "$__handler" = ::[^[:space:]]* ]] && __handler="${__handler#::}"
+ [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && \
+ {chroma/main-chroma-print -rl -- "Running handler(2): $__handler" ; "$__handler" "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}" "$__start" "$__end" "$__wrd"; }
+ [[ -n "$__action" && "$__action" != "NO-OP" ]] && \
+ { chroma/main-chroma-print -rl -- "Running action(2): $__action" ; eval "$__action"; }
+ chroma/main-chroma-print -rl -- "The __action value: [$__value]"
+ [[ "$__have_value" -eq 2 && -n "$__value" && "$__value" != "NO-OP" ]] && \
+ { chroma/main-chroma-print -rl "Running action (of 1, at 2): $__value" ; eval "$__value"; }
+ fi
+ fi
+ chroma/main-chroma-print -- "_________ Exiting chroma/main-process-token.ch $__subcmd / $__wrd _________"
+}
+
+# Iterates over the chroma def. fields and creates initial
+# fields in the fsh__${__chroma_name}__chroma__def hash
+chroma/-pre_process_chroma_def.ch() {
+ local __key __value __ke _val __the_hash_name="$1" __var_name
+ local -a __split
+
+ chroma/main-chroma-print -rl -- "Starting PRE_PROCESS for __the_hash_name:$__the_hash_name"
+
+ __ch_def_name="fsh__${__chroma_name}__chroma__def[subcommands]"
+ local __subcmds="${(P)__ch_def_name}"
+ if [[ "$__subcmds" = "::"* ]]; then
+ ${__subcmds#::}
+ __var_name="${__the_hash_name}[subcommands]"
+ : ${(P)__var_name::=(${(j:|:)reply})}
+ else
+ __var_name="${__the_hash_name}[subcommands]"
+ : ${(P)__var_name::=$__subcmds}
+ fi
+ chroma/main-chroma-print "Got SUBCOMMANDS: ${(P)__var_name}"
+
+ __ch_def_name="fsh__${__chroma_name}__chroma__def[subcmd-hook]"
+ local __subcmd_hook="${(P)__ch_def_name}"
+ if [[ -n "$__subcmd_hook" ]]; then
+ __var_name="${__the_hash_name}[subcmd-hook]"
+ : ${(P)__var_name::=$__subcmd_hook}
+ fi
+
+ __ch_def_name="fsh__${__chroma_name}__chroma__def[(I)subcmd:*]"
+ for __key in "${(P@)__ch_def_name}"; do
+ __split=( "${(@s:|:)${${__key##subcmd:\((#c0,1)}%\)}}" )
+ [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
+ __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
+ for __ke in "${__split[@]}"; do
+ __var_name="${__the_hash_name}[subcmd:$__ke]"
+ __ch_def_name="fsh__${__chroma_name}__chroma__def[$__key]"
+ : ${(P)__var_name::=${(P)__ch_def_name}}
+ chroma/main-chroma-print -rl -- "Stored ${__var_name}=chroma_def[$__key], i.e. = ${(P)__ch_def_name}"
+ done
+ done
+}
+
+if (( __first_call )); then
+ chroma/-${__chroma_name}-first-call
+ FAST_HIGHLIGHT[chroma-current]="$__wrd"
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]=0
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-got-subcommand]=0
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]=""
+ FAST_HIGHLIGHT[chrome-${FAST_HIGHLIGHT[chroma-current]}-occurred-double-hyphen]=0
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]=""
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-arg]=""
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]=1
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]=""
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]=""
+ __the_hash_name="fsh__chroma__main__${${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}//(#b)([\#\^])/${map[${match[1]}]}}"
+ (( 0 == ${(P)+__the_hash_name} )) && {
+ typeset -gA "$__the_hash_name"
+ chroma/-pre_process_chroma_def.ch "$__the_hash_name"
+ } || chroma/main-chroma-print "...No... [\${+$__the_hash_name} ${(P)+__the_hash_name}]"
+ return 1
+else
+ (( ++ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr] ))
+ # Following call, i.e. not the first one
+ # Check if chroma should end – test if token is of type
+ # "starts new command", if so pass-through – chroma ends
+ [[ "$__arg_type" = 3 ]] && return 2
+ chroma/main-chroma-print "== @@ Starting @@ #${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]} Main-Chroma-call == // << __WORD:$__wrd >> ## Subcommand: ${${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}:-NULL} //@@// -n option-with-arg-active:${(q-)FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}"
+ if [[ "$__wrd" = -* || -n "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}"
+ ]]; then
+ chroma/main-chroma-print "## The \`if -*' i.e. \`IF OPTION' MAIN branch"
+ chroma/main-process-token.ch "${${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}:-NULL}" "$__wrd"
+ else
+ # If at e.g. '>' or destination/source spec (of the redirection)
+ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+ elif (( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-got-subcommand] == 0 )) {
+ __the_hash_name="fsh__chroma__main__${${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}//(#b)([\#\^])/${map[${match[1]}]}}"
+ __var_name="${__the_hash_name}[subcommands]"
+ if [[ "$__wrd" = ${(P)~__var_name} ]]; then
+ chroma/main-chroma-print "GOT-SUBCOMMAND := $__wrd, subcmd verification / OK"
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-got-subcommand]=1
+ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]="$__wrd"
+ __var_name="${__the_hash_name}[subcmd-hook]"
+ (( ${(P)+__var_name} )) && { chroma/main-chroma-print -r -- "Running subcmd-hook: ${(P)__var_name}" ; "${(P)__var_name}" "$__wrd"; }
+ __style="${FAST_THEME_NAME}subcommand"
+ else
+ chroma/main-chroma-print "subcmd verif / NOT OK; Incrementing the COUNTER-ARG ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]} -> $(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] + 1 ))" >> /tmp/fsh-dbg
+ (( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] += 1 ))
+ chroma/main-chroma-print "UNRECOGNIZED ARGUMENT ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}"
+ chroma/main-process-token.ch "${${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}:-NULL}" "$__wrd"
+ fi
+ } else {
+ __wrd="${__wrd//\`/x}"
+ __arg="${__arg//\`/x}"
+ __wrd="${(Q)__wrd}"
+ local __tmp_def_name="fsh__${__chroma_name}__chroma__def[subcommands-blacklist]"
+ if [[ ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]} = \
+ (${(~j:|:)${(@s:,:)${(PA)__tmp_def_name}}})
+ ]] {
+ return 1
+ }
+ chroma/main-chroma-print "Incrementing the COUNTER-ARG ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]} -> $(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] + 1 ))"
+ (( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] += 1 ))
+ chroma/main-chroma-print "ARGUMENT ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}"
+ chroma/main-chroma-print "ELSE *-got-subcommand == 1 is TRUE"
+ chroma/main-process-token.ch "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}" "$__wrd"
+ }
+ fi
+fi
+
+
+# Add region_highlight entry (via `reply' array)
+if [[ -n "$__style" ]]; then
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+fi
+
+# We aren't passing-through, do obligatory things ourselves
+(( this_word = next_word ))
+_start_pos=$_end_pos
+
+return 0
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 6274b14..474c1cb 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -2,7 +2,7 @@
## 2018-08-09
-Added ideal string highlighting – FSH now handles any legal quoting and combination of `"`,`'` and `\` when
+Added ideal string highlighting – f-sy-h now handles any legal quoting and combination of `"`,`'` and `\` when
highlighting program arguments. See the introduction for an example (item #14).
## 2018-08-02
@@ -28,8 +28,8 @@ set_fast_theme() {
```
If you have set theme before an update of styles (e.g. recent addition of bracket highlighting)
-then please repeat `fast-theme {theme}` call to regenerate theme files. (**2018-08-09**: FSH
-now has full user-theme support, refer to [appropriate section of README](#customization)).
+then please repeat `fast-theme {theme}` call to regenerate theme files. (**2018-08-09**: f-sy-h
+now has full user-theme support, refer to [appropriate section of README](README.md#customization)).
## 2018-07-30
@@ -46,7 +46,7 @@ will be invoked everything will work as expected (Git chroma will be ran).
## 2018-07-11
-There were problems with Ctrl-C not working when using FSH. After many days I've found a fix
+There were problems with Ctrl-C not working when using f-sy-h. After many days I've found a fix
for this, it's pushed to main.
Second, asynchronous path checking (useful on e.g. slow network drives, or when there are many files in directory)
@@ -61,7 +61,7 @@ it shows functionality of `awk` – compiling of code and NOT running it. Perl c
## 2018-06-06
-FSH gained a new architecture – "chroma functions". They are similar to "completion functions", i.e. they
+f-sy-h gained a new architecture – "chroma functions". They are similar to "completion functions", i.e. they
are defined **per-command**, but instead of completing that command, they colorize it. Two chroma exist,
for `Git` ([video](https://asciinema.org/a/185707), [video](https://asciinema.org/a/185811)) and for `grep`
([video](https://asciinema.org/a/185942)). Checkout
@@ -91,7 +91,7 @@ For-loop is highlighted, it has separate settings in [theme file](https://github
## 2018-05-27
-Added support for 256-color themes. There are six themes shipped with FSH. The command to
+Added support for 256-color themes. There are six themes shipped with f-sy-h. The command to
switch theme is `fast-theme {theme-name}`, it has a completion which lists available themes
and options. Checkout [asciinema recording](https://asciinema.org/a/183814) that presents
the themes.
@@ -137,7 +137,7 @@ Assignments are no more one-colour default-white. When used in assignment, highl
Math mode is highlighted – expressions `(( ... ))` and `$(( ... ))`. Empty variables are colorized as red.
There are 3 style names (fields of
-[FAST_HIGHLIGHT_STYLES](https://github.com/zdharma/fast-syntax-highlighting/blob/main/fast-highlight#L34)
+[FAST_HIGHLIGHT_STYLES](https://github.com/zdharma/fast-syntax-highlighting/blob/main/functions/fast-highlight#L34)
hash) for math-variable, number and empty variable (error): `mathvar`, `mathnum`, `matherr`. You can set
them (like the animation below shows) to change colors.
diff --git a/docs/CHROMA_GUIDE.adoc b/docs/CHROMA_GUIDE.adoc
index efb3614..0d2757e 100644
--- a/docs/CHROMA_GUIDE.adoc
+++ b/docs/CHROMA_GUIDE.adoc
@@ -134,7 +134,7 @@ integer __idx1 __idx2
# Colorize 1..2 as builtin, 3.. as glob
if (( FAST_HIGHLIGHT[chroma-example-counter] <= 2 )); then
if [[ "$__wrd" = \"* ]]; then
- # Pass through, fsh main code will do the highlight!
+ # Pass through, f-sy-h main code will do the highlight!
return 1
else
__style=${FAST_THEME_NAME}builtin
diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md
deleted file mode 100644
index 8b9cefc..0000000
--- a/docs/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,132 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-We as members, contributors, and leaders pledge to make participation in our
-community a harassment-free experience for everyone, regardless of age, body
-size, visible or invisible disability, ethnicity, sex characteristics, gender
-identity and expression, level of experience, education, socio-economic status,
-nationality, personal appearance, race, caste, color, religion, or sexual identity
-and orientation.
-
-We pledge to act and interact in ways that contribute to an open, welcoming,
-diverse, inclusive, and healthy community.
-
-## Our Standards
-
-Examples of behavior that contributes to a positive environment for our
-community include:
-
-- Demonstrating empathy and kindness toward other people
-- Being respectful of differing opinions, viewpoints, and experiences
-- Giving and gracefully accepting constructive feedback
-- Accepting responsibility and apologizing to those affected by our mistakes,
- and learning from the experience
-- Focusing on what is best not just for us as individuals, but for the
- overall community
-
-Examples of unacceptable behavior include:
-
-- The use of sexualized language or imagery, and sexual attention or
- advances of any kind
-- Trolling, insulting or derogatory comments, and personal or political attacks
-- Public or private harassment
-- Publishing others' private information, such as a physical or email
- address, without their explicit permission
-- Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Enforcement Responsibilities
-
-Community leaders are responsible for clarifying and enforcing our standards of
-acceptable behavior and will take appropriate and fair corrective action in
-response to any behavior that they deem inappropriate, threatening, offensive,
-or harmful.
-
-Community leaders have the right and responsibility to remove, edit, or reject
-comments, commits, code, wiki edits, issues, and other contributions that are
-not aligned to this Code of Conduct, and will communicate reasons for moderation
-decisions when appropriate.
-
-## Scope
-
-This Code of Conduct applies within all community spaces, and also applies when
-an individual is officially representing the community in public spaces.
-Examples of representing our community include using an official e-mail address,
-posting via an official social media account, or acting as an appointed
-representative at an online or offline event.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported to the community leaders responsible for enforcement at
-*team@zshell.dev*.
-All complaints will be reviewed and investigated promptly and fairly.
-
-All community leaders are obligated to respect the privacy and security of the
-reporter of any incident.
-
-## Enforcement Guidelines
-
-Community leaders will follow these Community Impact Guidelines in determining
-the consequences for any action they deem in violation of this Code of Conduct:
-
-### 1. Correction
-
-**Community Impact**: Use of inappropriate language or other behavior deemed
-unprofessional or unwelcome in the community.
-
-**Consequence**: A private, written warning from community leaders, providing
-clarity around the nature of the violation and an explanation of why the
-behavior was inappropriate. A public apology may be requested.
-
-### 2. Warning
-
-**Community Impact**: A violation through a single incident or series
-of actions.
-
-**Consequence**: A warning with consequences for continued behavior. No
-interaction with the people involved, including unsolicited interaction with
-those enforcing the Code of Conduct, for a specified period of time. This
-includes avoiding interactions in community spaces as well as external channels
-like social media. Violating these terms may lead to a temporary or
-permanent ban.
-
-### 3. Temporary Ban
-
-**Community Impact**: A serious violation of community standards, including
-sustained inappropriate behavior.
-
-**Consequence**: A temporary ban from any sort of interaction or public
-communication with the community for a specified period of time. No public or
-private interaction with the people involved, including unsolicited interaction
-with those enforcing the Code of Conduct, is allowed during this period.
-Violating these terms may lead to a permanent ban.
-
-### 4. Permanent Ban
-
-**Community Impact**: Demonstrating a pattern of violation of community
-standards, including sustained inappropriate behavior, harassment of an
-individual, or aggression toward or disparagement of classes of individuals.
-
-**Consequence**: A permanent ban from any sort of public interaction within
-the community.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage],
-version 2.1, available at
-[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
-
-Community Impact Guidelines were inspired by
-[Mozilla's code of conduct enforcement ladder][mozilla coc].
-
-For answers to common questions about this code of conduct, see the FAQ at
-[https://www.contributor-covenant.org/faq][faq]. Translations are available
-at [https://www.contributor-covenant.org/translations][translations].
-
-[homepage]: https://www.contributor-covenant.org
-[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
-[mozilla coc]: https://github.com/mozilla/diversity
-[faq]: https://www.contributor-covenant.org/faq
-[translations]: https://www.contributor-covenant.org/translations
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
deleted file mode 100644
index 87ad095..0000000
--- a/docs/CONTRIBUTING.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Contributing
-
-This Project welcomes contributions, suggestions, and feedback. All contributions, suggestions, and feedback you submitted are accepted under the [Project's license](../LICENSE).
-
-You represent that if you do not own copyright in the code that you have the authority to submit it under the [Project's license](../LICENSE). All feedback, suggestions, or contributions are not confidential.
-
-[Should be further filled in by the project - including defining the requirements to reach maintainer status]
-
-The Project abides by the Organization's [code of conduct](CODE-OF-CONDUCT.md) and [trademark policy](TRADEMARKS.md).
-
-## Community membership
-
-### New contributors
-
-New contributors should be welcomed to the community by existing members, helped with PR workflow, and directed to relevant documentation and communication channels.
-
-### Member
-
-Members are continuously active contributors in the community. They can have issues and PRs assigned to them, and pre-submit tests are automatically run for their PRs. Members are expected to remain active contributors to the community.
-
-### Established community members
-
-Established community members are expected to demonstrate their adherence to the principles in this document.
-Familiarity with project organization, roles, policies, procedures, conventions, etc., and technical and/or writing ability.
-Role-specific expectations, responsibilities.
-
----
-
-Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/).
diff --git a/docs/GOVERNANCE.md b/docs/GOVERNANCE.md
deleted file mode 100644
index 2a57933..0000000
--- a/docs/GOVERNANCE.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# Governance Policy
-
-This document provides the governance policy for the Project. Maintainers agree to this policy and to abide by all Project polices, including the [code of conduct](CODE-OF-CONDUCT.md), [trademark policy](TRADEMARKS.md), and [antitrust policy](ANTITRUST.md) by adding their name to the [maintainers.md file](MAINTAINERS.md).
-
-## 1. Roles
-
-This project may include the following roles. Additional roles may be adopted and documented by the Project.
-
-**1.1. Maintainers**. Maintainers are responsible for organizing activities around developing, maintaining, and updating the Project. Maintainers are also responsible for determining consensus. This Project may add or remove Maintainers with the approval of the current Maintainers.
-
-**1.2. Contributors**. Contributors are those that have made contributions to the Project.
-
-## 2. Decisions
-
-**2.1. Consensus-Based Decision Making**. Projects make decisions through consensus of the Maintainers. While explicit agreement of all Maintainers is preferred, it is not required for consensus. Rather, the Maintainers will determine consensus based on their good faith consideration of a number of factors, including the dominant view of the Contributors and nature of support and objections. The Maintainers will document evidence of consensus in accordance with these requirements.
-
-**2.2. Appeal Process**. Decisions may be appealed by opening an issue and that appeal will be considered by the Maintainers in good faith, who will respond in writing within a reasonable time. If the Maintainers deny the appeal, the appeal my be brought before the Organization Steering Committee, who will also respond in writing in a reasonable time.
-
-## 3. How We Work
-
-**3.1. Openness**. Participation is open to anyone who is directly and materially affected by the activity in question. There shall be no undue financial barriers to participation.
-
-**3.2. Balance**. The development process should balance the interests of Contributors and other stakeholders. Contributors from diverse interest categories shall be sought with the objective of achieving balance.
-
-**3.3. Coordination and Harmonization**. Good faith efforts shall be made to resolve potential conflicts or incompatibility between releases in this Project.
-
-**3.4. Consideration of Views and Objections**. Prompt consideration shall be given to the written views and objections of all Contributors.
-
-**3.5. Written procedures**. This governance document and other materials documenting this project's development process shall be available to any interested person.
-
-## 4. No Confidentiality
-
-Information disclosed in connection with any Project activity, including but not limited to meetings, contributions, and submissions, is not confidential, regardless of any markings or statements to the contrary.
-
-## 5. Trademarks
-
-Any names, trademarks, logos, or goodwill developed by and associated with the Project (the "Marks") are controlled by the Organization. Maintainers may only use these Marks in accordance with the Organization's trademark policy. If a Maintainer resigns or is removed, any rights the Maintainer may have in the Marks revert to the Organization.
-
-## 6. Amendments
-
-Amendments to this governance policy may be made by affirmative vote of 2/3 of all Maintainers, with approval by the Organization's Steering Committee.
-
----
-
-Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/).
diff --git a/docs/MAINTAINERS.md b/docs/MAINTAINERS.md
deleted file mode 100644
index e1642bc..0000000
--- a/docs/MAINTAINERS.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Maintainers
-
-This document lists the Maintainers of the Project. Maintainers may be added once approved by the existing maintainers as described in the [Governance document](GOVERNANCE.md). By adding your name to this list you are agreeing to abide by the Project governance documents and to abide by all of the Organization's polices, including the [code of conduct](https://github.com/z-shell/.github/blob/main/governance/organization/CODE-OF-CONDUCT.md), [trademark policy](https://github.com/z-shell/.github/blob/main/governance/organization/TRADEMARKS.md), and [antitrust policy](https://github.com/z-shell/.github/blob/main/governance/organization/ANTITRUST.md). If you are participating because of your affiliation with another organization (designated below), you represent that you have the authority to bind that organization to these policies.
-
-| **NAME** | **Organization** |
-| :---------------- | :--------------: |
-| Salvydas Lukosius | Z-Shell |
-
----
-
-Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/).
diff --git a/docs/README.md b/docs/README.md
index 6056232..0c347f5 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,33 +1,35 @@
-
- ❮ Zi ❯ - F-Sy-H
-
+
+ ❮ Zi ❯ - F-Sy-H
Feature-rich Syntax Highlighting for Zsh
- 《❔》Ask a Question
- 《💡》Search Wiki
-《💜》Join
-《🌐》Localize
+ 《❔ Ask a Question 》
+ 《💡 Search Wiki 》
+ 《💜 Join 》
+ 《🌐 Localize 》
+
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
Related
- License
@@ -41,11 +43,11 @@ src="https://raw.githubusercontent.com/z-shell/.github/main/metrics/plugin/metri
Clone the Repository.
-
git clone https://github.com/z-shell/F-Sy-H ~/path/to/fsh
+git clone https://github.com/z-shell/F-Sy-H ~/path/to/f-sy-h
And add the following to your `zshrc` file.
-source ~/path/to/fsh/F-Sy-H.plugin.zsh
+source ~/path/to/f-sy-h/F-Sy-H.plugin.zsh
Zi
@@ -340,7 +342,7 @@ alt="image could not be loaded"
style="color: red; background-color: black; font-weight: bold" />
-The chromas that are enabled by default can be found here.
+The chromas that are enabled by default can be found here.
Math-mode highlighting
@@ -392,16 +394,16 @@ style="color: red; background-color: black; font-weight: bold" />
Credits
-
+
+
-
+
+
-
+
+
-
+
+
diff --git a/docs/THEME_GUIDE.md b/docs/THEME_GUIDE.md
index d411e14..a1b4c19 100644
--- a/docs/THEME_GUIDE.md
+++ b/docs/THEME_GUIDE.md
@@ -25,14 +25,15 @@ File name `overlay.ini` is treated specially.
When specifing path, following short-hands can be used:
-```
-XDG: = ~/.config/fsh (respects $XDG_CONFIG_HOME env var)
-LOCAL: = /usr/local/share/fsh/
-HOME: = ~/.fsh/
-OPT: = /opt/local/share/fsh/
+```ini
+CONFIG: = ~/.config/f-sy-h (respects $XDG_CONFIG_HOME env var)
+CACHE: = ~/.cache/zi/f-sy-h (respects $XDG_CACHE_HOME env var)
+LOCAL: = /usr/local/share/f-sy-h/
+HOME: = ~/.f-sy-h/
+OPT: = /opt/local/share/f-sy-h/
```
-So for example, issue `fast-theme XDG:overlay` to load `~/.config/fsh/overlay.ini` as overlay. The `.ini`
+So for example, issue `fast-theme CONFIG:overlay` to load `~/.config/f-sy-h/overlay.ini` as overlay. The `.ini`
extension is optional.
## Secondary Theme
@@ -71,6 +72,6 @@ load, in Zsh format, not INI) kept under specified location. This is handy if e.
Fast-Syntax-Highlighting system-wide (e.g. from AUR on ArchLinux) and want to have per-user
theme setup.
-You can use "~" in the path, e.g. `FAST_WORK_DIR=~/.fsh` and also the `XDG:`, `LOCAL:`, `OPT:`,
-etc. short-hands, so e.g. `FAST_WORK_DIR=XDG` or `FAST_WORK_DIR=XDG:` is allowed (in this case
-it will be changed to `$HOME/.config/fsh` by default by F-Sy-H loader).
+You can use "~" in the path, e.g. `FAST_WORK_DIR=~/.f-sy-h` and also the `CONFIG:`, `CACHE:`, `LOCAL:`, `OPT:`,
+etc. short-hands, so e.g. `FAST_WORK_DIR=CONFIG` or `FAST_WORK_DIR=CONFIG:` is allowed (in this case
+it will be changed to `$HOME/.config/f-sy-h` by default by F-Sy-H loader).
diff --git a/docs/images/array-assign.png b/docs/images/array-assign.png
index 9d35e90..bae5cff 100644
Binary files a/docs/images/array-assign.png and b/docs/images/array-assign.png differ
diff --git a/docs/images/assign.png b/docs/images/assign.png
index 41fed43..2bb2472 100644
Binary files a/docs/images/assign.png and b/docs/images/assign.png differ
diff --git a/docs/images/cmdsubst.png b/docs/images/cmdsubst.png
index 66e5641..71b9553 100644
Binary files a/docs/images/cmdsubst.png and b/docs/images/cmdsubst.png differ
diff --git a/docs/images/cplx_cond.png b/docs/images/cplx_cond.png
index 3c0d3ce..575629c 100644
Binary files a/docs/images/cplx_cond.png and b/docs/images/cplx_cond.png differ
diff --git a/docs/images/eval_cmp.png b/docs/images/eval_cmp.png
index 77138fc..a6239cf 100644
Binary files a/docs/images/eval_cmp.png and b/docs/images/eval_cmp.png differ
diff --git a/docs/images/execfd.png b/docs/images/execfd.png
index f9a1d65..3fff671 100644
Binary files a/docs/images/execfd.png and b/docs/images/execfd.png differ
diff --git a/docs/images/execfd_cmp.png b/docs/images/execfd_cmp.png
index 628f46a..f2d13d7 100644
Binary files a/docs/images/execfd_cmp.png and b/docs/images/execfd_cmp.png differ
diff --git a/docs/images/for-loop-cmp.png b/docs/images/for-loop-cmp.png
index f0284b8..8ebc259 100644
Binary files a/docs/images/for-loop-cmp.png and b/docs/images/for-loop-cmp.png differ
diff --git a/docs/images/for-loop.png b/docs/images/for-loop.png
index 7f779ac..0b661e5 100644
Binary files a/docs/images/for-loop.png and b/docs/images/for-loop.png differ
diff --git a/docs/images/function.png b/docs/images/function.png
index f09a08b..b46b509 100644
Binary files a/docs/images/function.png and b/docs/images/function.png differ
diff --git a/docs/images/git_chroma.png b/docs/images/git_chroma.png
index a3bbba5..d084c1f 100644
Binary files a/docs/images/git_chroma.png and b/docs/images/git_chroma.png differ
diff --git a/docs/images/global-alias.png b/docs/images/global-alias.png
index 8722681..6c6c597 100644
Binary files a/docs/images/global-alias.png and b/docs/images/global-alias.png differ
diff --git a/docs/images/heredoc.png b/docs/images/heredoc.png
index d88d55b..7ab3b8e 100644
Binary files a/docs/images/heredoc.png and b/docs/images/heredoc.png differ
diff --git a/docs/images/herestring.png b/docs/images/herestring.png
index 4cd8716..5db8cab 100644
Binary files a/docs/images/herestring.png and b/docs/images/herestring.png differ
diff --git a/docs/images/highlight-less.png b/docs/images/highlight-less.png
index 54bad72..9a638a7 100644
Binary files a/docs/images/highlight-less.png and b/docs/images/highlight-less.png differ
diff --git a/docs/images/highlight-much.png b/docs/images/highlight-much.png
index 73d483f..0c93596 100644
Binary files a/docs/images/highlight-much.png and b/docs/images/highlight-much.png differ
diff --git a/docs/images/ideal-string.png b/docs/images/ideal-string.png
index d7d526d..f643986 100644
Binary files a/docs/images/ideal-string.png and b/docs/images/ideal-string.png differ
diff --git a/docs/images/in_string.png b/docs/images/in_string.png
index c6ae217..c923173 100644
Binary files a/docs/images/in_string.png and b/docs/images/in_string.png differ
diff --git a/docs/images/parameter.png b/docs/images/parameter.png
index 47f0bb5..d473e48 100644
Binary files a/docs/images/parameter.png and b/docs/images/parameter.png differ
diff --git a/docs/images/theme.png b/docs/images/theme.png
index 285e4e4..5b2012c 100644
Binary files a/docs/images/theme.png and b/docs/images/theme.png differ
diff --git a/docs/images/typeset.png b/docs/images/typeset.png
index 06881fc..6c1745d 100644
Binary files a/docs/images/typeset.png and b/docs/images/typeset.png differ
diff --git a/docs/images/zcalc.png b/docs/images/zcalc.png
index d2c286d..6136eb8 100644
Binary files a/docs/images/zcalc.png and b/docs/images/zcalc.png differ
diff --git a/fast-string-highlight b/fast-string-highlight
deleted file mode 100644
index ca579e0..0000000
--- a/fast-string-highlight
+++ /dev/null
@@ -1,80 +0,0 @@
-#----------------------------------------------------------------------------------------------------------------------
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-# vim: ft=zsh sw=2 ts=2 et
-#----------------------------------------------------------------------------------------------------------------------
-#
-# $1 - PREBUFFER
-# $2 - BUFFER
-#
-function -fast-highlight-string-process {
-emulate -L zsh
-setopt extended_glob warn_create_global typeset_silent \
- no_short_loops rc_quotes no_auto_pushd
-
- local -A pos_to_level level_to_pos pair_map final_pairs
- local input=$1$2 _mybuf=$1$2 __style __quoting
- integer __idx=0 __pair_idx __level=0 __start __end
- local -a match mbegin mend
-
- pair_map=( "(" ")" "{" "}" "[" "]" )
-
- while [[ $_mybuf = (#b)([^"{}()[]\\\"'"]#)((["({[]})\"'"])|[\\](*))(*) ]]; do
- if [[ -n ${match[4]} ]] {
- __idx+=${mbegin[2]}
-
- [[ $__quoting = \' ]] && _mybuf=${match[4]} || { _mybuf=${match[4]:1}; (( ++ __idx )); }
- } else {
- __idx+=${mbegin[2]}
- [[ -z $__quoting && -z ${_FAST_COMPLEX_BRACKETS[(r)$((__idx-${#PREBUFFER}-1))]} ]] && {
- if [[ ${match[2]} = ["({["] ]]; then
- pos_to_level[$__idx]=$(( ++__level ))
- level_to_pos[$__level]=$__idx
- elif [[ ${match[2]} = ["]})"] ]]; then
- if (( __level > 0 )); then
- __pair_idx=${level_to_pos[$__level]}
- pos_to_level[$__idx]=$(( __level -- ))
- [[ ${pair_map[${input[__pair_idx]}]} = ${input[__idx]} ]] && {
- final_pairs[$__idx]=$__pair_idx
- final_pairs[$__pair_idx]=$__idx
- }
- else
- pos_to_level[$__idx]=-1
- fi
- fi
- }
-
- if [[ ${match[2]} = \" && $__quoting != \' ]] {
- [[ $__quoting = '"' ]] && __quoting="" || __quoting='"';
- }
- if [[ ${match[2]} = \' && $__quoting != \" ]] {
- if [[ $__quoting = ("'"|"$'") ]] {
- __quoting=""
- } else {
- if [[ $match[1] = *\$ ]] {
- __quoting="\$'";
- } else {
- __quoting="'";
- }
- }
- }
- _mybuf=${match[5]}
- }
- done
-
- for __idx in ${(k)pos_to_level}; do
- (( ${+final_pairs[$__idx]} )) && __style=${FAST_THEME_NAME}bracket-level-$(( ( (pos_to_level[$__idx]-1) % 3 ) + 1 )) || __style=${FAST_THEME_NAME}unknown-token
- (( __start=__idx-${#PREBUFFER}-1, __end=__idx-${#PREBUFFER}, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
- done
-
- # If cursor is on a bracket, then highlight corresponding bracket, if any.
- if [[ $WIDGET != zle-line-finish ]]; then
- __idx=$(( CURSOR + 1 ))
- if (( ${+pos_to_level[$__idx]} )) && (( ${+final_pairs[$__idx]} )); then
- (( __start=final_pairs[$__idx]-${#PREBUFFER}-1, __end=final_pairs[$__idx]-${#PREBUFFER}, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}paired-bracket]}") && \
- reply+=("$CURSOR $__idx ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}paired-bracket]}")
- fi
- fi
- return 0
-}
diff --git a/functions/.fast-make-targets b/functions/.fast-make-targets
old mode 100644
new mode 100755
index e2cbd32..934c80b
--- a/functions/.fast-make-targets
+++ b/functions/.fast-make-targets
@@ -1,4 +1,6 @@
-# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
# Almost all code borrowed from Zshell's _make function
#
# Copyright (c) 2018 Sebastian Gniazdowski
@@ -6,93 +8,90 @@
local -a TARGETS
.make-expandVars() {
- local open close var val front='' rest=$1
+ local open close var val front='' rest=$1
- while [[ $rest == (#b)[^$]#($)* ]]; do
- front=$front${rest[1,$mbegin[1]-1]}
- rest=${rest[$mbegin[1],-1]}
+ while [[ $rest == (#b)[^$]#($)* ]]; do
+ front=$front${rest[1,$mbegin[1]-1]}
+ rest=${rest[$mbegin[1],-1]}
+ case $rest[2] in
+ ($) # '$$'. may not appear in target and variable's value
+ front=$front\$\$
+ rest=${rest[3,-1]}
+ continue
+ ;;
+ (\() # Variable of the form $(foobar)
+ open='('
+ close=')'
+ ;;
+ ({) # ${foobar}
+ open='{'
+ close='}'
+ ;;
+ ([[:alpha:]]) # $foobar. This is exactly $(f)oobar.
+ open=''
+ close=''
+ var=$rest[2]
+ ;;
+ (*) # bad parameter name
+ print -- $front$rest
+ return 1
+ ;;
+ esac
- case $rest[2] in
- ($) # '$$'. may not appear in target and variable's value
- front=$front\$\$
- rest=${rest[3,-1]}
- continue
- ;;
- (\() # Variable of the form $(foobar)
- open='('
- close=')'
- ;;
- ({) # ${foobar}
- open='{'
- close='}'
- ;;
- ([[:alpha:]]) # $foobar. This is exactly $(f)oobar.
- open=''
- close=''
- var=$rest[2]
- ;;
- (*) # bad parameter name
- print -- $front$rest
- return 1
- ;;
- esac
+ if [[ -n $open ]]; then
+ if [[ $rest == \$$open(#b)([[:alnum:]_]##)(#B)$close* ]]; then
+ var=$match
+ else # unmatched () or {}, or bad parameter name
+ print -- $front$rest
+ return 1
+ fi
+ fi
- if [[ -n $open ]]; then
- if [[ $rest == \$$open(#b)([[:alnum:]_]##)(#B)$close* ]]; then
- var=$match
- else # unmatched () or {}, or bad parameter name
- print -- $front$rest
- return 1
- fi
+ val=''
+ if [[ -n ${VAR_ARGS[(i)$var]} ]]; then
+ val=${VAR_ARGS[$var]}
+ else
+ if [[ -n $opt_args[(I)(-e|--environment-overrides)] ]]; then
+ if [[ $parameters[$var] == scalar-export* ]]; then
+ val=${(P)var}
+ elif [[ -n ${VARIABLES[(i)$var]} ]]; then
+ val=${VARIABLES[$var]}
fi
-
- val=''
- if [[ -n ${VAR_ARGS[(i)$var]} ]]; then
- val=${VAR_ARGS[$var]}
- else
- if [[ -n $opt_args[(I)(-e|--environment-overrides)] ]]; then
- if [[ $parameters[$var] == scalar-export* ]]; then
- val=${(P)var}
- elif [[ -n ${VARIABLES[(i)$var]} ]]; then
- val=${VARIABLES[$var]}
- fi
- else
- if [[ -n ${VARIABLES[(i)$var]} ]]; then
- val=${VARIABLES[$var]}
- elif [[ $parameters[$var] == scalar-export* ]]; then
- val=${(P)var}
- fi
- fi
+ else
+ if [[ -n ${VARIABLES[(i)$var]} ]]; then
+ val=${VARIABLES[$var]}
+ elif [[ $parameters[$var] == scalar-export* ]]; then
+ val=${(P)var}
fi
- rest=${rest//\$$open$var$close/$val}
- done
+ fi
+ fi
+ rest=${rest//\$$open$var$close/$val}
+ done
- print -- ${front}${rest}
+ print -- ${front}${rest}
}
.make-parseMakefile () {
- local input var val target dep TAB=$'\t' tmp IFS=
+ local input var val target dep TAB=$'\t' tmp IFS=
- while read input
- do
- case "$input " in
- # TARGET: dependencies
- # TARGET1 TARGET2 TARGET3: dependencies
- ([[*?[:alnum:]$][^$TAB:=%]#:[^=]*)
- target=$(.make-expandVars ${input%%:*})
- TARGETS+=( ${(z)target} )
- ;;
- esac
- done
+ while read input
+ do
+ case "$input " in
+ # TARGET: dependencies
+ # TARGET1 TARGET2 TARGET3: dependencies
+ ([[*?[:alnum:]$][^$TAB:=%]#:[^=]*)
+ target=$(.make-expandVars ${input%%:*})
+ TARGETS+=( ${(z)target} )
+ ;;
+ esac
+ done
}
if [[ -z "${FAST_HIGHLIGHT[chroma-make-cache]}" || $(( EPOCHSECONDS - FAST_HIGHLIGHT[chroma-make-cache-born-at] )) -gt 7 ]]; then
- .make-parseMakefile
- FAST_HIGHLIGHT[chroma-make-cache-born-at]="$EPOCHSECONDS"
- FAST_HIGHLIGHT[chroma-make-cache]="${(j:;:)TARGETS}"
+ .make-parseMakefile
+ FAST_HIGHLIGHT[chroma-make-cache-born-at]="$EPOCHSECONDS"
+ FAST_HIGHLIGHT[chroma-make-cache]="${(j:;:)TARGETS}"
fi
reply2=( "${(s:;:)FAST_HIGHLIGHT[chroma-make-cache]}" )
-
-# vim:ft=zsh:et
diff --git a/functions/.fast-read-ini-file b/functions/.fast-read-ini-file
old mode 100644
new mode 100755
index 2e57d10..71b6c23
--- a/functions/.fast-read-ini-file
+++ b/functions/.fast-read-ini-file
@@ -1,3 +1,6 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
# Copyright (c) 2018 Sebastian Gniazdowski
#
# $1 - path to the ini file to parse
@@ -14,17 +17,15 @@ local -a match mbegin mend
[[ ! -r "$__ini_file" ]] && { builtin print -r "fast-syntax-highlighting: an ini file is unreadable ($__ini_file)"; return 1; }
while read -r -t 1 __line; do
- if [[ "$__line" = [[:blank:]]#\;* ]]; then
- continue
- elif [[ "$__line" = (#b)[[:blank:]]#\[([^\]]##)\][[:blank:]]# ]]; then
- __cur_section="${match[1]}"
- elif [[ "$__line" = (#b)[[:blank:]]#([^[:blank:]=]##)[[:blank:]]#[=][[:blank:]]#(*) ]]; then
- match[2]="${match[2]%"${match[2]##*[! $'\t']}"}" # remove trailing whitespace
- __access_string="${__out_hash}[${__key_prefix}<$__cur_section>_${match[1]}]"
- : "${(P)__access_string::=${match[2]}}"
- fi
+ if [[ "$__line" = [[:blank:]]#\;* ]]; then
+ continue
+ elif [[ "$__line" = (#b)[[:blank:]]#\[([^\]]##)\][[:blank:]]# ]]; then
+ __cur_section="${match[1]}"
+ elif [[ "$__line" = (#b)[[:blank:]]#([^[:blank:]=]##)[[:blank:]]#[=][[:blank:]]#(*) ]]; then
+ match[2]="${match[2]%"${match[2]##*[! $'\t']}"}" # remove trailing whitespace
+ __access_string="${__out_hash}[${__key_prefix}<$__cur_section>_${match[1]}]"
+ : "${(P)__access_string::=${match[2]}}"
+ fi
done < "$__ini_file"
return 0
-
-# vim:ft=zsh:sw=4:sts=4:et
diff --git a/functions/.fast-run-command b/functions/.fast-run-command
old mode 100644
new mode 100755
index e251bcc..6539ba4
--- a/functions/.fast-run-command
+++ b/functions/.fast-run-command
@@ -1,4 +1,6 @@
-# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
# Copyright (c) 2018 Sebastian Gniazdowski
#
# FAST_HIGHLIGHT hash serves as container for variables that
@@ -21,17 +23,14 @@ typeset -ga __lines_list
local -a __response
if [[ -z "${FAST_HIGHLIGHT[$2-cache]}" || $(( EPOCHSECONDS - FAST_HIGHLIGHT[$2-cache-born-at] )) -gt ${4:-5} ]]; then
- FAST_HIGHLIGHT[$2-cache-born-at]="$EPOCHSECONDS"
- __response=( ${${(f)"$(command ${(Qz)1#+} 2>/dev/null)"}#${~3}} )
- [[ "$1" = "+"* ]] && __lines_list+=( "${__response[@]}" ) || __lines_list=( "${__response[@]}" )
- FAST_HIGHLIGHT[$2-cache]="${(j:;:)__response}"
+ FAST_HIGHLIGHT[$2-cache-born-at]="$EPOCHSECONDS"
+ __response=( ${${(f)"$(command ${(Qz)1#+} 2>/dev/null)"}#${~3}} )
+ [[ "$1" = "+"* ]] && __lines_list+=( "${__response[@]}" ) || __lines_list=( "${__response[@]}" )
+ FAST_HIGHLIGHT[$2-cache]="${(j:;:)__response}"
else
- # Quoted (s:;:) flag without @ will skip empty elements. It
- # still produces array output, interesingly. All this is for
- # the trailing ";" above, to skip last, empty element.
- [[ "$1" = "+"* ]] && \
- __lines_list+=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" ) || \
- __lines_list=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" )
+ # Quoted (s:;:) flag without @ will skip empty elements. It
+ # still produces array output, interestingly. All this is for
+ # the trailing ";" above, to skip last, empty element.
+ [[ "$1" = "+"* ]] && \
+ __lines_list+=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" ) || __lines_list=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" )
fi
-
-# vim:ft=zsh:et:sw=4
diff --git a/functions/.fast-run-git-command b/functions/.fast-run-git-command
old mode 100644
new mode 100755
index 4a42b97..92bc060
--- a/functions/.fast-run-git-command
+++ b/functions/.fast-run-git-command
@@ -1,4 +1,6 @@
-# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
# Copyright (c) 2018 Sebastian Gniazdowski
#
# It runs given command, which in general will be a git command,
@@ -27,34 +29,32 @@ typeset -ga __lines_list
local -a __response
if [[ $1 == --status ]] {
- integer __status=1
- shift
+ integer __status=1
+ shift
}
if [[ -z ${FAST_HIGHLIGHT[$2-cache]} || $(( EPOCHSECONDS - FAST_HIGHLIGHT[$2-cache-born-at] )) -gt ${4:-5} ]]; then
- FAST_HIGHLIGHT[$2-cache-born-at]=$EPOCHSECONDS
- if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = true ]]; then
- __response=( ${${(f)"$(command ${(Qz)${1#+}} 2>/dev/null)"}#$3} )
- integer retval=$?
- if (( __status )) {
- __response=( $retval )
- __lines_list=( $retval )
- } else {
- [[ "$1" = "+"* ]] && \
- __lines_list+=( "${__response[@]}" ) || \
- __lines_list=( "${__response[@]}" )
- }
- else
- __lines_list=()
- fi
- FAST_HIGHLIGHT[$2-cache]="${(j:;:)__response}"
+ FAST_HIGHLIGHT[$2-cache-born-at]=$EPOCHSECONDS
+ if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = true ]]; then
+ __response=( ${${(f)"$(command ${(Qz)${1#+}} 2>/dev/null)"}#$3} )
+ integer retval=$?
+ if (( __status )) {
+ __response=( $retval )
+ __lines_list=( $retval )
+ } else {
+ [[ "$1" = "+"* ]] && \
+ __lines_list+=( "${__response[@]}" ) || __lines_list=( "${__response[@]}" )
+ }
+ else
+ __lines_list=()
+ fi
+ FAST_HIGHLIGHT[$2-cache]="${(j:;:)__response}"
else
- # Quoted (s:;:) flag without @ will skip empty elements. It
- # still produces array output, interesingly. All this is for
- # the trailing ";" above, to skip last, empty element.
- [[ "$1" = "+"* ]] && \
- __lines_list+=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" ) || \
- __lines_list=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" )
+ # Quoted (s:;:) flag without @ will skip empty elements. It
+ # still produces array output, interestingly. All this is for
+ # the trailing ";" above, to skip last, empty element.
+ [[ "$1" = "+"* ]] && __lines_list+=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" ) || \
+ __lines_list=( "${(@s:;:)FAST_HIGHLIGHT[$2-cache]}" )
fi
-# vim:ft=zsh:et:sw=4
+return 0
diff --git a/functions/.fast-zts-read-all b/functions/.fast-zts-read-all
old mode 100644
new mode 100755
index 96c52ab..1b1fd53
--- a/functions/.fast-zts-read-all
+++ b/functions/.fast-zts-read-all
@@ -1,3 +1,6 @@
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
# $1 - file-descriptor to be read from
# $2 - name of output variable (default: REPLY)
@@ -6,12 +9,10 @@ local -a __tmp
integer __ret=1 __repeat=10 __tmp_size=0
while sysread -s 65535 -i "$__in_fd" '__tmp[__tmp_size + 1]'; do
- (( ( __ret=$? ) == 0 )) && (( ++ __tmp_size ))
- (( __ret == 5 )) && { __ret=0; (( --__repeat == 0 )) && break; }
+ (( ( __ret=$? ) == 0 )) && (( ++ __tmp_size ))
+ (( __ret == 5 )) && { __ret=0; (( --__repeat == 0 )) && break; }
done
: ${(P)__out_var::="${(j::)__tmp}"}
return __ret
-
-# vim: ft=zsh:et:sw=4:sts=4
diff --git a/_fast-theme b/functions/_fast-theme
old mode 100644
new mode 100755
similarity index 71%
rename from _fast-theme
rename to functions/_fast-theme
index 14f2d08..208a07a
--- a/_fast-theme
+++ b/functions/_fast-theme
@@ -9,35 +9,35 @@
#
# Completion for theme-switching function, fast-theme,
# part of z-shell/F-Sy-H, zdharma/fast-syntax-highlighting.
-#
-integer ret=1
-local -a arguments
+builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+builtin setopt extended_glob local_options typeset_silent no_short_loops rc_quotes no_auto_pushd
+
+typeset -a themes themes2 arguments expl
arguments=(
- {-h,--help}'[display help text]'
- {-l,--list}'[list available themes]'
- {-r,--reset}'[unset any theme (revert to default highlighting)]'
+ {-w,--workdir}'[cd into $FAST_WORK_DIR (if not set, then into the plugin directory)]'
{-R,--ov-reset}'[unset overlay, use styles only from main-theme (requires restart)]'
- {-q,--quiet}'[no default messages]'
+ {-p,--palette}'[just print all 256 colors and exit (useful when creating a theme)]'
+ {-r,--reset}'[unset any theme (revert to default highlighting)]'
+ {-t,--test}'[test theme after setting it (show example code)]'
{-s,--show}'[get and display the theme currently being set]'
{-v,--verbose}'[more messages during operation]'
- {-t,--test}'[test theme after setting it (show example code)]'
- {-p,--palette}'[just print all 256 colors and exit (useful when creating a theme)]'
- {-w,--workdir}'[cd into $FAST_WORK_DIR (if not set, then into the plugin directory)]'
+ {-i,--info}'[additional information]'
+ {-l,--list}'[list available themes]'
+ {-q,--quiet}'[no default messages]'
+ {-h,--help}'[display help text]'
)
-typeset -a themes
-themes=( "$FAST_WORK_DIR"/themes/*.ini(:t:r) )
+integer ret=1
+themes=( "$FAST_BASE_DIR"/themes/*.ini(:t:r) )
-if [[ -d ${XDG_CONFIG_HOME:-$HOME/.config}/fsh ]]; then
- typeset -a themes2
- themes2=( "${XDG_CONFIG_HOME:-$HOME/.config}"/fsh/*.ini(:t:r) )
- themes+=( XDG:${^themes2[@]} )
+if [[ -d ${XDG_CONFIG_HOME:-$HOME/.config}/f-sy-h ]]; then
+ themes2=( "${XDG_CONFIG_HOME:-$HOME/.config}"/f-sy-h/*.ini(:t:r) )
+ themes+=( CONFIG:${^themes2[@]} )
fi
-
-_wanted themes expl "Themes" compadd "$@" -a - themes && ret=0
+_wanted themes expl "themes" compadd "$@" -a - themes && ret=0
_arguments -s $arguments && ret=0
return $ret
diff --git a/fast-highlight b/functions/fast-highlight
old mode 100644
new mode 100755
similarity index 73%
rename from fast-highlight
rename to functions/fast-highlight
index fb5a0dc..ddfb29f
--- a/fast-highlight
+++ b/functions/fast-highlight
@@ -33,20 +33,22 @@
typeset -gA __fast_highlight_main__command_type_cache FAST_BLIST_PATTERNS
typeset -g FAST_WORK_DIR
+
: ${FAST_WORK_DIR:=$FAST_BASE_DIR}
FAST_WORK_DIR=${~FAST_WORK_DIR}
+
() {
- # emulate -L zsh -o extendedglob
- # Zsh < v5.0 do not support -o
- emulate -L zsh
- setopt extendedglob
+ # Emulate zsh options in the current shell.
+ builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+ builtin setopt extended_glob no_short_loops rc_quotes no_auto_pushd
local -A map
- map=( "XDG:" "${XDG_CONFIG_HOME:-$HOME/.config}/fsh/"
- "LOCAL:" "/usr/local/share/fsh/"
- "HOME:" "$HOME/.fsh/"
- "OPT:" "/opt/local/share/fsh/"
+ map=( "CONFIG:" "${XDG_CONFIG_HOME:-$HOME/.config}/f-sy-h/"
+ "CACHE:" "${XDG_CACHE_HOME:-$HOME/.cache}/zi/f-sy-h/"
+ "LOCAL:" "/usr/local/share/f-sy-h/"
+ "HOME:" "$HOME/.f-sy-h/"
+ "OPT:" "/opt/local/share/f-sy-h/"
)
- FAST_WORK_DIR=${${FAST_WORK_DIR/(#m)(#s)(XDG|LOCAL|HOME|OPT):(#c0,1)/${map[${MATCH%:}:]}}%/}
+ FAST_WORK_DIR=${${FAST_WORK_DIR/(#m)(#s)(CONFIG|CACHE|LOCAL|HOME|OPT):(#c0,1)/${map[${MATCH%:}:]}}%/}
}
# Define default styles. You can set this after loading the plugin in
@@ -170,109 +172,109 @@ typeset -gA FAST_HIGHLIGHT
# Brackets highlighter active by default
: ${FAST_HIGHLIGHT[use_brackets]:=1}
FAST_HIGHLIGHT+=(
- chroma-fast-theme →chroma/-fast-theme.ch
- chroma-alias →chroma/-alias.ch
- chroma-autoload →chroma/-autoload.ch
- chroma-autorandr →chroma/-autorandr.ch
- chroma-docker →chroma/-docker.ch
- chroma-example →chroma/-example.ch
- chroma-ionice →chroma/-ionice.ch
- chroma-make →chroma/-make.ch
- chroma-nice →chroma/-nice.ch
- chroma-nmcli →chroma/-nmcli.ch
- chroma-node →chroma/-node.ch
- chroma-perl →chroma/-perl.ch
- chroma-printf →chroma/-printf.ch
- chroma-ruby →chroma/-ruby.ch
- chroma-scp →chroma/-scp.ch
- chroma-ssh →chroma/-ssh.ch
-
- chroma-git →chroma/main-chroma.ch%git
- chroma-hub →chroma/-hub.ch
- chroma-lab →chroma/-lab.ch
- chroma-svn →chroma/-subversion.ch
- chroma-svnadmin →chroma/-subversion.ch
- chroma-svndumpfilter →chroma/-subversion.ch
-
- chroma-egrep →chroma/-grep.ch
- chroma-fgrep →chroma/-grep.ch
- chroma-grep →chroma/-grep.ch
-
- chroma-awk →chroma/-awk.ch
- chroma-gawk →chroma/-awk.ch
- chroma-mawk →chroma/-awk.ch
-
- chroma-source →chroma/-source.ch
- chroma-. →chroma/-source.ch
-
- chroma-bash →chroma/-sh.ch
- chroma-fish →chroma/-sh.ch
- chroma-sh →chroma/-sh.ch
- chroma-zsh →chroma/-sh.ch
-
- chroma-whatis →chroma/-whatis.ch
- chroma-man →chroma/-whatis.ch
-
- chroma-- →chroma/-precommand.ch
- chroma-xargs →chroma/-precommand.ch
- chroma-nohup →chroma/-precommand.ch
- chroma-strace →chroma/-precommand.ch
- chroma-ltrace →chroma/-precommand.ch
-
- chroma-hg →chroma/-subcommand.ch
- chroma-cvs →chroma/-subcommand.ch
- chroma-pip →chroma/-subcommand.ch
- chroma-pip2 →chroma/-subcommand.ch
- chroma-pip3 →chroma/-subcommand.ch
- chroma-gem →chroma/-subcommand.ch
- chroma-bundle →chroma/-subcommand.ch
- chroma-yard →chroma/-subcommand.ch
- chroma-cabal →chroma/-subcommand.ch
- chroma-npm →chroma/-subcommand.ch
- chroma-pnpm →chroma/-subcommand.ch
- chroma-nvm →chroma/-subcommand.ch
- chroma-yarn →chroma/-subcommand.ch
- chroma-brew →chroma/-subcommand.ch
- chroma-port →chroma/-subcommand.ch
- chroma-yum →chroma/-subcommand.ch
- chroma-dnf →chroma/-subcommand.ch
- chroma-tmux →chroma/-subcommand.ch
- chroma-pass →chroma/-subcommand.ch
- chroma-aws →chroma/-subcommand.ch
- chroma-apt →chroma/-subcommand.ch
- chroma-apt-get →chroma/-subcommand.ch
- chroma-apt-cache →chroma/-subcommand.ch
- chroma-aptitude →chroma/-subcommand.ch
- chroma-keyctl →chroma/-subcommand.ch
- chroma-systemctl →chroma/-subcommand.ch
- chroma-asciinema →chroma/-subcommand.ch
- chroma-ipfs →chroma/-subcommand.ch
- chroma-zi →chroma/main-chroma.ch%zi
- chroma-zinit →chroma/-zinit.ch
- chroma-aspell →chroma/-subcommand.ch
- chroma-bspc →chroma/-subcommand.ch
- chroma-cryptsetup →chroma/-subcommand.ch
- chroma-diskutil →chroma/-subcommand.ch
- chroma-exercism →chroma/-subcommand.ch
- chroma-gulp →chroma/-subcommand.ch
- chroma-i3-msg →chroma/-subcommand.ch
- chroma-openssl →chroma/-subcommand.ch
- chroma-solargraph →chroma/-subcommand.ch
- chroma-subliminal →chroma/-subcommand.ch
- chroma-svnadmin →chroma/-subcommand.ch
- chroma-travis →chroma/-subcommand.ch
- chroma-udisksctl →chroma/-subcommand.ch
- chroma-xdotool →chroma/-subcommand.ch
- chroma-zmanage →chroma/-subcommand.ch
- chroma-zsystem →chroma/-subcommand.ch
- chroma-zypper →chroma/-subcommand.ch
-
- chroma-fpath+=\( →chroma/-fpath_peq.ch
- chroma-fpath=\( →chroma/-fpath_peq.ch
- chroma-FPATH+= →chroma/-fpath_peq.ch
- chroma-FPATH= →chroma/-fpath_peq.ch
- #chroma-which →chroma/-which.ch
- #chroma-vim →chroma/-vim.ch
+ chroma-fast-theme chroma/-fast-theme.ch
+ chroma-alias chroma/-alias.ch
+ chroma-autoload chroma/-autoload.ch
+ chroma-autorandr chroma/-autorandr.ch
+ chroma-docker chroma/-docker.ch
+ chroma-example chroma/-example.ch
+ chroma-ionice chroma/-ionice.ch
+ chroma-make chroma/-make.ch
+ chroma-nice chroma/-nice.ch
+ chroma-nmcli chroma/-nmcli.ch
+ chroma-node chroma/-node.ch
+ chroma-perl chroma/-perl.ch
+ chroma-printf chroma/-printf.ch
+ chroma-ruby chroma/-ruby.ch
+ chroma-scp chroma/-scp.ch
+ chroma-ssh chroma/-ssh.ch
+
+ chroma-git chroma/main-chroma.ch%git
+ chroma-hub chroma/-hub.ch
+ chroma-lab chroma/-lab.ch
+ chroma-svn chroma/-subversion.ch
+ chroma-svnadmin chroma/-subversion.ch
+ chroma-svndumpfilter chroma/-subversion.ch
+
+ chroma-egrep chroma/-grep.ch
+ chroma-fgrep chroma/-grep.ch
+ chroma-grep chroma/-grep.ch
+
+ chroma-awk chroma/-awk.ch
+ chroma-gawk chroma/-awk.ch
+ chroma-mawk chroma/-awk.ch
+
+ chroma-source chroma/-source.ch
+ chroma-. chroma/-source.ch
+
+ chroma-bash chroma/-sh.ch
+ chroma-fish chroma/-sh.ch
+ chroma-sh chroma/-sh.ch
+ chroma-zsh chroma/-sh.ch
+
+ chroma-whatis chroma/-whatis.ch
+ chroma-man chroma/-whatis.ch
+
+ chroma-- chroma/-precommand.ch
+ chroma-xargs chroma/-precommand.ch
+ chroma-nohup chroma/-precommand.ch
+ chroma-strace chroma/-precommand.ch
+ chroma-ltrace chroma/-precommand.ch
+
+ chroma-hg chroma/-subcommand.ch
+ chroma-cvs chroma/-subcommand.ch
+ chroma-pip chroma/-subcommand.ch
+ chroma-pip2 chroma/-subcommand.ch
+ chroma-pip3 chroma/-subcommand.ch
+ chroma-gem chroma/-subcommand.ch
+ chroma-bundle chroma/-subcommand.ch
+ chroma-yard chroma/-subcommand.ch
+ chroma-cabal chroma/-subcommand.ch
+ chroma-npm chroma/-subcommand.ch
+ chroma-pnpm chroma/-subcommand.ch
+ chroma-nvm chroma/-subcommand.ch
+ chroma-yarn chroma/-subcommand.ch
+ chroma-brew chroma/-subcommand.ch
+ chroma-port chroma/-subcommand.ch
+ chroma-yum chroma/-subcommand.ch
+ chroma-dnf chroma/-subcommand.ch
+ chroma-tmux chroma/-subcommand.ch
+ chroma-pass chroma/-subcommand.ch
+ chroma-aws chroma/-subcommand.ch
+ chroma-apt chroma/-subcommand.ch
+ chroma-apt-get chroma/-subcommand.ch
+ chroma-apt-cache chroma/-subcommand.ch
+ chroma-aptitude chroma/-subcommand.ch
+ chroma-keyctl chroma/-subcommand.ch
+ chroma-systemctl chroma/-subcommand.ch
+ chroma-asciinema chroma/-subcommand.ch
+ chroma-ipfs chroma/-subcommand.ch
+ chroma-aspell chroma/-subcommand.ch
+ chroma-bspc chroma/-subcommand.ch
+ chroma-cryptsetup chroma/-subcommand.ch
+ chroma-diskutil chroma/-subcommand.ch
+ chroma-exercism chroma/-subcommand.ch
+ chroma-gulp chroma/-subcommand.ch
+ chroma-i3-msg chroma/-subcommand.ch
+ chroma-openssl chroma/-subcommand.ch
+ chroma-solargraph chroma/-subcommand.ch
+ chroma-subliminal chroma/-subcommand.ch
+ chroma-svnadmin chroma/-subcommand.ch
+ chroma-travis chroma/-subcommand.ch
+ chroma-udisksctl chroma/-subcommand.ch
+ chroma-xdotool chroma/-subcommand.ch
+ chroma-zmanage chroma/-subcommand.ch
+ chroma-zsystem chroma/-subcommand.ch
+ chroma-zypper chroma/-subcommand.ch
+
+ chroma-zi chroma/main-chroma.ch%zi
+
+ chroma-fpath+=\( chroma/-fpath_peq.ch
+ chroma-fpath=\( chroma/-fpath_peq.ch
+ chroma-FPATH+= chroma/-fpath_peq.ch
+ chroma-FPATH= chroma/-fpath_peq.ch
+ #chroma-which chroma/-which.ch
+ #chroma-vim chroma/-vim.ch
)
if [[ $OSTYPE == darwin* ]] {
@@ -297,47 +299,42 @@ typeset -ga ZLAST_COMMANDS
-fast-highlight-main-type() {
REPLY=$__fast_highlight_main__command_type_cache[(e)$1]
[[ -z $REPLY ]] && {
-
- if zmodload -e zsh/parameter; then
- if (( $+aliases[(e)$1] )); then
- REPLY=alias
- elif (( ${+galiases[(e)$1]} )); then
- REPLY="global alias"
- elif (( $+functions[(e)$1] )); then
- REPLY=function
- elif (( $+builtins[(e)$1] )); then
- REPLY=builtin
- elif (( $+commands[(e)$1] )); then
- REPLY=command
- elif (( $+saliases[(e)${1##*.}] )); then
- REPLY='suffix alias'
- elif (( $reswords[(Ie)$1] )); then
- REPLY=reserved
- # zsh 5.2 and older have a bug whereby running 'type -w ./sudo' implicitly
- # runs 'hash ./sudo=/usr/local/bin/./sudo' (assuming /usr/local/bin/sudo
- # exists and is in $PATH). Avoid triggering the bug, at the expense of
- # falling through to the $() below, incurring a fork. (Issue #354.)
- #
- # The second disjunct mimics the isrelative() C call from the zsh bug.
- elif [[ $1 != */* || ${+ZSH_ARGZERO} = "1" ]] && ! builtin type -w -- $1 >/dev/null 2>&1; then
- REPLY=none
+ if zmodload -e zsh/parameter; then
+ if (( $+aliases[(e)$1] )); then
+ REPLY=alias
+ elif (( ${+galiases[(e)${(Q)1}]} )); then
+ REPLY="global alias"
+ elif (( $+functions[(e)$1] )); then
+ REPLY=function
+ elif (( $+builtins[(e)$1] )); then
+ REPLY=builtin
+ elif (( $+commands[(e)$1] )); then
+ REPLY=command
+ elif (( $+saliases[(e)${1##*.}] )); then
+ REPLY='suffix alias'
+ elif (( $reswords[(Ie)$1] )); then
+ REPLY=reserved
+ # zsh 5.2 and older have a bug whereby running 'type -w ./sudo' implicitly
+ # runs 'hash ./sudo=/usr/local/bin/./sudo' (assuming /usr/local/bin/sudo
+ # exists and is in $PATH). Avoid triggering the bug, at the expense of
+ # falling through to the $() below, incurring a fork. (Issue #354.)
+ #
+ # The second disjunct mimics the isrelative() C call from the zsh bug.
+ elif [[ $1 != */* || ${+ZSH_ARGZERO} = "1" ]] && ! builtin type -w -- $1 >/dev/null 2>&1; then
+ REPLY=none
+ fi
fi
- fi
-
- [[ -z $REPLY ]] && REPLY="${$(LC_ALL=C builtin type -w -- $1 2>/dev/null)##*: }"
-
- [[ $REPLY = "none" ]] && {
- [[ -n ${FAST_BLIST_PATTERNS[(k)${${(M)1:#/*}:-$PWD/$1}]} ]] || {
- [[ -d $1 ]] && REPLY="dirpath" || {
- for cdpath_dir in $cdpath; do
- [[ -d $cdpath_dir/$1 ]] && { REPLY="dirpath"; break; }
- done
+ [[ -z $REPLY ]] && REPLY="${$(LC_ALL=C builtin type -w -- $1 2>/dev/null)##*: }"
+ [[ $REPLY = "none" ]] && {
+ [[ -n ${FAST_BLIST_PATTERNS[(k)${${(M)1:#/*}:-$PWD/$1}]} ]] || {
+ [[ -d $1 ]] && REPLY="dirpath" || {
+ for cdpath_dir in $cdpath; do
+ [[ -d $cdpath_dir/$1 ]] && { REPLY="dirpath"; break; }
+ done
+ }
}
}
- }
-
- __fast_highlight_main__command_type_cache[(e)$1]=$REPLY
-
+ __fast_highlight_main__command_type_cache[(e)$1]=$REPLY
}
}
@@ -369,11 +366,12 @@ typeset -ga ZLAST_COMMANDS
fi
}
+
+
# Main syntax highlighting function.
--fast-highlight-process()
-{
- emulate -L zsh
- setopt extendedglob bareglobqual nonomatch typesetsilent
+-fast-highlight-process() {
+ builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+ builtin setopt extended_glob bare_glob_qual no_nomatch typeset_silent
[[ $CONTEXT == "select" ]] && return 0
@@ -423,7 +421,7 @@ typeset -ga ZLAST_COMMANDS
# word delimiters (an improvised array); [[ $x == *:foo:* ]] and x=${x//:foo:/}
# will DTRT regardless of how many elements or repetitions $x has..
#
- # Handling of redirections: upon seeing a redirection token, we must stall
+ # Handling of redirection: upon seeing a redirection token, we must stall
# the current state --- that is, the value of $this_word --- for two iterations
# (one for the redirection operator, one for the word following it representing
# the redirection target). Therefore, we set $in_redirection to 2 upon seeing a
@@ -459,8 +457,7 @@ typeset -ga ZLAST_COMMANDS
# Processing buffer
local proc_buf=$__buf needle
- for __arg in ${interactive_comments-${(z)__buf}} \
- ${interactive_comments+${(zZ+c+)__buf}}; do
+ for __arg in ${interactive_comments-${(z)__buf}} ${interactive_comments+${(zZ+c+)__buf}}; do
# Initialize $next_word to its default value?
(( in_redirection = in_redirection > 0 ? in_redirection - 1 : in_redirection ));
@@ -606,215 +603,201 @@ typeset -ga ZLAST_COMMANDS
${${FAST_HIGHLIGHT[chroma-${__list[1]}]}%\%*} ${(M)FAST_HIGHLIGHT[chroma-${__list[1]}]%\%*} 1 "$__arg" $_start_pos $_end_pos 2>/dev/null && continue
fi
} || (( 1 ))
- }
+ }
- expanded_path=""
+ expanded_path=""
- # The Great Fork: is this a command word? Is this a non-command word?
- if (( this_word & 16 )) && [[ $__arg == 'always' ]]; then
- # try-always construct
- __style=${FAST_THEME_NAME}reserved-word # de facto a reserved word, although not de jure
- (( next_word = 1 | (this_word & BIT_case_code) ))
- elif (( (this_word & 1) && (in_redirection == 0) )) || [[ $braces_stack = T* ]]; then # T - typedef, etc.
- if (( __arg_type == 1 )); then
+ # The Great Fork: is this a command word? Is this a non-command word?
+ if (( this_word & 16 )) && [[ $__arg == 'always' ]]; then
+ # try-always construct
+ __style=${FAST_THEME_NAME}reserved-word # de facto a reserved word, although not de jure
+ (( next_word = 1 | (this_word & BIT_case_code) ))
+ elif (( (this_word & 1) && (in_redirection == 0) )) || [[ $braces_stack = T* ]]; then # T - typedef, etc.
+ if (( __arg_type == 1 )); then
__style=${FAST_THEME_NAME}precommand
[[ $__arg = "command" || $__arg = "exec" ]] && (( next_word = next_word | 64 ))
- elif [[ $__arg = (sudo|doas) ]]; then
+ elif [[ $__arg = (sudo|doas) ]]; then
__style=${FAST_THEME_NAME}precommand
(( next_word = (next_word & ~2) | 4 | 1 ))
- else
- _mybuf=${${(Q)__arg}#\"}
- if (( ${+parameters} )) && \
+ else
+ _mybuf=${${(Q)__arg}#\"}
+ if (( ${+parameters} )) && \
[[ $_mybuf = (#b)(*)(*)\$([a-zA-Z_][a-zA-Z0-9_]#|[0-9]##)(*) || \
- $_mybuf = (#b)(*)(*)\$\{([a-zA-Z_][a-zA-Z0-9_:-]#|[0-9]##)(*) ]] && \
- (( ${+parameters[${match[3]%%:-*}]} ))
- then
- -fast-highlight-main-type ${match[1]}${match[2]}${(P)match[3]%%:-*}${match[4]#\}}
- elif [[ $braces_stack = T* ]]; then # T - typedef, etc.
- REPLY=none
- else
- : ${expanded_path::=${~_mybuf}}
- -fast-highlight-main-type $expanded_path
- fi
+ $_mybuf = (#b)(*)(*)\$\{([a-zA-Z_][a-zA-Z0-9_:-]#|[0-9]##)(*) ]] && \
+ (( ${+parameters[${match[3]%%:-*}]} ))
+ then
+ -fast-highlight-main-type ${match[1]}${match[2]}${(P)match[3]%%:-*}${match[4]#\}}
+ elif [[ $braces_stack = T* ]]; then # T - typedef, etc.
+ REPLY=none
+ else
+ : ${expanded_path::=${~_mybuf}}
+ -fast-highlight-main-type $expanded_path
+ fi
case $REPLY in
reserved) # reserved word
- [[ $__arg = "[[" ]] && __style=${FAST_THEME_NAME}double-sq-bracket || __style=${FAST_THEME_NAME}reserved-word
- if [[ $__arg == $'\x7b' ]]; then # Y - '{'
- braces_stack='Y'$braces_stack
-
- elif [[ $__arg == $'\x7d' && $braces_stack = Y* ]]; then # Y - '}'
- # We're at command word, so no need to check right_brace_is_recognised_everywhere
- braces_stack=${braces_stack#Y}
- __style=${FAST_THEME_NAME}reserved-word
- (( next_word = next_word | 16 ))
-
- elif [[ $__arg == "[[" ]]; then # A - [[
- braces_stack='A'$braces_stack
-
- # Counting complex brackets (for brackets-highlighter): 1. [[ as command
- _FAST_COMPLEX_BRACKETS+=( $(( _start_pos-__PBUFLEN )) $(( _start_pos-__PBUFLEN + 1 )) )
- elif [[ $__arg == "for" ]]; then
- (( next_word = next_word | 32 )) # BIT_for
-
- elif [[ $__arg == "case" ]]; then
- (( next_word = BIT_case_preamble ))
-
- elif [[ $__arg = (typeset|declare|local|float|integer|export|readonly) ]]; then
- braces_stack='T'$braces_stack
- fi
- ;;
+ [[ $__arg = "[[" ]] && __style=${FAST_THEME_NAME}double-sq-bracket || __style=${FAST_THEME_NAME}reserved-word
+ if [[ $__arg == $'\x7b' ]]; then # Y - '{'
+ braces_stack='Y'$braces_stack
+
+ elif [[ $__arg == $'\x7d' && $braces_stack = Y* ]]; then # Y - '}'
+ # We're at command word, so no need to check right_brace_is_recognised_everywhere
+ braces_stack=${braces_stack#Y}
+ __style=${FAST_THEME_NAME}reserved-word
+ (( next_word = next_word | 16 ))
+
+ elif [[ $__arg == "[[" ]]; then # A - [[
+ braces_stack='A'$braces_stack
+
+ # Counting complex brackets (for brackets-highlighter): 1. [[ as command
+ _FAST_COMPLEX_BRACKETS+=( $(( _start_pos-__PBUFLEN )) $(( _start_pos-__PBUFLEN + 1 )) )
+ elif [[ $__arg == "for" ]]; then
+ (( next_word = next_word | 32 )) # BIT_for
+
+ elif [[ $__arg == "case" ]]; then
+ (( next_word = BIT_case_preamble ))
+
+ elif [[ $__arg = (typeset|declare|local|float|integer|export|readonly) ]]; then
+ braces_stack='T'$braces_stack
+ fi
+ ;;
'suffix alias') __style=${FAST_THEME_NAME}suffix-alias;;
'global alias') __style=${FAST_THEME_NAME}global-alias;;
-
alias)
- if [[ $__arg = ?*'='* ]]; then
- # The so called (by old code) "insane_alias"
- __style=${FAST_THEME_NAME}unknown-token
- else
- __style=${FAST_THEME_NAME}alias
- (( ${+aliases} )) && alias_target=${aliases[$__arg]} || alias_target="${"$(alias -- $__arg)"#*=}"
- [[ ${__FAST_HIGHLIGHT_TOKEN_TYPES[$alias_target]} = "1" && $__arg_type != "1" ]] && __FAST_HIGHLIGHT_TOKEN_TYPES[$__arg]="1"
- fi
- ;;
-
- builtin) [[ $__arg = "[" ]] && {
- __style=${FAST_THEME_NAME}single-sq-bracket
- _FAST_COMPLEX_BRACKETS+=( $(( _start_pos-__PBUFLEN )) )
- } || __style=${FAST_THEME_NAME}builtin
- # T - typeset, etc. mode
- [[ $__arg = (typeset|declare|local|float|integer|export|readonly) ]] && braces_stack='T'$braces_stack
- [[ $__arg = eval ]] && (( next_word = next_word | 256 ))
- ;;
-
+ if [[ $__arg = ?*'='* ]]; then
+ # The so called (by old code) "insane_alias"
+ __style=${FAST_THEME_NAME}unknown-token
+ else
+ __style=${FAST_THEME_NAME}alias
+ (( ${+aliases} )) && alias_target=${aliases[$__arg]} || alias_target="${"$(alias -- $__arg)"#*=}"
+ [[ ${__FAST_HIGHLIGHT_TOKEN_TYPES[$alias_target]} = "1" && $__arg_type != "1" ]] && __FAST_HIGHLIGHT_TOKEN_TYPES[$__arg]="1"
+ fi
+ ;;
+ builtin)
+ [[ $__arg = "[" ]] && {
+ __style=${FAST_THEME_NAME}single-sq-bracket
+ _FAST_COMPLEX_BRACKETS+=( $(( _start_pos-__PBUFLEN )) )
+ } || __style=${FAST_THEME_NAME}builtin
+ # T - typeset, etc. mode
+ [[ $__arg = (typeset|declare|local|float|integer|export|readonly) ]] && braces_stack='T'$braces_stack
+ [[ $__arg = eval ]] && (( next_word = next_word | 256 ))
+ ;;
function) __style=${FAST_THEME_NAME}function;;
-
command) __style=${FAST_THEME_NAME}command;;
-
hashed) __style=${FAST_THEME_NAME}hashed-command;;
-
dirpath) __style=${FAST_THEME_NAME}path-to-dir;;
-
none) # Assign?
- if [[ $__arg == [a-zA-Z_][a-zA-Z0-9_]#(|\[[^\]]#\])(|[^\]]#\])(|[+])=* || $__arg == [0-9]##(|[+])=* || ( $braces_stack = T* && ${__arg_type} != 3 ) ]] {
- __style=${FAST_THEME_NAME}assign
- FAST_ASSIGNS_SEEN[${__arg%%=*}]=1
-
- # Handle array assignment
- [[ $__arg = (#b)*=(\()*(\))* || $__arg = (#b)*=(\()* ]] && {
- (( __start=_start_pos-__PBUFLEN+${mbegin[1]}-1, __end=__start+1, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}assign-array-bracket]}")
- # Counting complex brackets (for brackets-highlighter): 2. ( in array assign
- _FAST_COMPLEX_BRACKETS+=( $__start )
- (( mbegin[2] >= 1 )) && {
- (( __start=_start_pos-__PBUFLEN+${mbegin[2]}-1, __end=__start+1, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}assign-array-bracket]}")
- # Counting complex brackets (for brackets-highlighter): 3a. ) in array assign
- _FAST_COMPLEX_BRACKETS+=( $__start )
- } || in_array_assignment=1
- } || { [[ ${braces_stack[1]} != 'T' ]] && (( next_word = (next_word | 1) & ~2 )); }
-
- # Handle no-string highlight, string "/' highlight, math mode highlight
- local ctmp="\"" dtmp="'"
- itmp=${__arg[(i)$ctmp]}-1 iitmp=${__arg[(i)$dtmp]}-1
- integer jtmp=${__arg[(b:itmp+2:i)$ctmp]} jjtmp=${__arg[(b:iitmp+2:i)$dtmp]}
- (( itmp < iitmp && itmp <= __asize - 1 )) && (( jtmp > __asize && (jtmp = __asize), 1 > 0 )) && \
- (( __start=_start_pos-__PBUFLEN+itmp, __end=_start_pos-__PBUFLEN+jtmp, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-quoted-argument]}") && \
- { itmp=${__arg[(i)=]}; __arg=${__arg[itmp,__asize]}; (( _start_pos += itmp - 1 ));
- -fast-highlight-string; (( _start_pos = _start_pos - itmp + 1, 1 > 0 )); } || \
- {
- (( iitmp <= __asize - 1 )) && (( jjtmp > __asize && (jjtmp = __asize), 1 > 0 )) && \
- (( __start=_start_pos-__PBUFLEN+iitmp, __end=_start_pos-__PBUFLEN+jjtmp, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}single-quoted-argument]}")
- } || \
- {
- itmp=${__arg[(i)=]}; __arg=${__arg[itmp,__asize]}; (( _start_pos += itmp - 1 ));
- [[ ${__arg[2,4]} = '$((' ]] && { -fast-highlight-math-string;
- (( __start=_start_pos-__PBUFLEN+2, __end=__start+2, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
- # Counting complex brackets (for brackets-highlighter): 4. $(( in assign argument
- _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
- (( jtmp = ${__arg[(I)\)\)]}-1, jtmp > 0 )) && {
- (( __start=_start_pos-__PBUFLEN+jtmp, __end=__start+2, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
- # Counting complex brackets (for brackets-highlighter): 5. )) in assign argument
- _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
- }
- } || -fast-highlight-string;
- (( _start_pos = _start_pos - itmp + 1, 1 > 0 ))
- }
-
- } elif [[ $__arg = ${histchars[1]}* && -n ${__arg[2]} ]] {
- __style=${FAST_THEME_NAME}history-expansion
-
- } elif [[ $__arg == ${histchars[2]}* ]] {
- __style=${FAST_THEME_NAME}history-expansion
-
- } elif (( __arg_type == 3 )) {
- # This highlights empty commands (semicolon follows nothing) as an error.
- # Zsh accepts them, though.
- (( this_word & 3 )) && __style=${FAST_THEME_NAME}commandseparator
-
- } elif [[ $__arg[1,2] == '((' ]] {
- # Arithmetic evaluation.
- #
- # Note: prior to zsh-5.1.1-52-g4bed2cf (workers/36669), the ${(z)...}
- # splitter would only output the '((' token if the matching '))' had
- # been typed. Therefore, under those versions of zsh, BUFFER="(( 42"
- # would be highlighted as an error until the matching "))" are typed.
- #
- # We highlight just the opening parentheses, as a reserved word; this
- # is how [[ ... ]] is highlighted, too.
-
- # ADD
- (( __start=_start_pos-__PBUFLEN, __end=__start+2, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
- already_added=1
-
- # Counting complex brackets (for brackets-highlighter): 6. (( as command
- _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
-
- -fast-highlight-math-string
-
- # ADD
- [[ $__arg[-2,-1] == '))' ]] && {
- (( __start=_end_pos-__PBUFLEN-2, __end=__start+2, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
- (( __delimited = __delimited ? 2 : __delimited ))
-
- # Counting complex brackets (for brackets-highlighter): 7. )) for as-command ((
- _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
- }
-
- } elif [[ $__arg == '()' ]] {
- _FAST_COMPLEX_BRACKETS+=( $(( _start_pos-__PBUFLEN )) $(( _start_pos-__PBUFLEN + 1 )) )
- # anonymous function
- __style=${FAST_THEME_NAME}reserved-word
- } elif [[ $__arg == $'\x28' ]] {
- # subshell '(', stack: letter 'R'
- __style=${FAST_THEME_NAME}reserved-word
- braces_stack='R'$braces_stack
-
- } elif [[ $__arg == $'\x29' ]] {
- # ')', stack: letter 'R' for subshell
- [[ $braces_stack = R* ]] && { braces_stack=${braces_stack#R}; __style=${FAST_THEME_NAME}reserved-word; }
-
- } elif (( this_word & 14 )) {
- __style=${FAST_THEME_NAME}default
-
- } elif [[ $__arg = (';;'|';&'|';|') ]] && (( this_word & BIT_case_code )) {
- (( next_word = (next_word | BIT_case_item) & ~(BIT_case_code+3) ))
- __style=${FAST_THEME_NAME}default
-
- } elif [[ $__arg = \$\([^\(]* ]] {
- already_added=1
- }
- ;;
+ if [[ $__arg == [a-zA-Z_][a-zA-Z0-9_]#(|\[[^\]]#\])(|[^\]]#\])(|[+])=* || $__arg == [0-9]##(|[+])=* || ( $braces_stack = T* && ${__arg_type} != 3 ) ]] {
+ __style=${FAST_THEME_NAME}assign
+ FAST_ASSIGNS_SEEN[${__arg%%=*}]=1
+
+ # Handle array assignment
+ [[ $__arg = (#b)*=(\()*(\))* || $__arg = (#b)*=(\()* ]] && {
+ (( __start=_start_pos-__PBUFLEN+${mbegin[1]}-1, __end=__start+1, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}assign-array-bracket]}")
+ # Counting complex brackets (for brackets-highlighter): 2. ( in array assign
+ _FAST_COMPLEX_BRACKETS+=( $__start )
+ (( mbegin[2] >= 1 )) && {
+ (( __start=_start_pos-__PBUFLEN+${mbegin[2]}-1, __end=__start+1, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}assign-array-bracket]}")
+ # Counting complex brackets (for brackets-highlighter): 3a. ) in array assign
+ _FAST_COMPLEX_BRACKETS+=( $__start )
+ } || in_array_assignment=1
+ } || { [[ ${braces_stack[1]} != 'T' ]] && (( next_word = (next_word | 1) & ~2 )); }
+
+ # Handle no-string highlight, string "/' highlight, math mode highlight
+ local ctmp="\"" dtmp="'"
+ itmp=${__arg[(i)$ctmp]}-1 iitmp=${__arg[(i)$dtmp]}-1
+ integer jtmp=${__arg[(b:itmp+2:i)$ctmp]} jjtmp=${__arg[(b:iitmp+2:i)$dtmp]}
+ (( itmp < iitmp && itmp <= __asize - 1 )) && (( jtmp > __asize && (jtmp = __asize), 1 > 0 )) && \
+ (( __start=_start_pos-__PBUFLEN+itmp, __end=_start_pos-__PBUFLEN+jtmp, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-quoted-argument]}") && \
+ { itmp=${__arg[(i)=]}; __arg=${__arg[itmp,__asize]}; (( _start_pos += itmp - 1 )); -fast-highlight-string; \
+ (( _start_pos = _start_pos - itmp + 1, 1 > 0 )); } || \
+ { (( iitmp <= __asize - 1 )) && (( jjtmp > __asize && (jjtmp = __asize), 1 > 0 )) && \
+ (( __start=_start_pos-__PBUFLEN+iitmp, __end=_start_pos-__PBUFLEN+jjtmp, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}single-quoted-argument]}")
+ } || {
+ itmp=${__arg[(i)=]}; __arg=${__arg[itmp,__asize]}; (( _start_pos += itmp - 1 ));
+ [[ ${__arg[2,4]} = '$((' ]] && {
+ -fast-highlight-math-string; (( __start=_start_pos-__PBUFLEN+2, __end=__start+2, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
+ # Counting complex brackets (for brackets-highlighter): 4. $(( in assign argument
+ _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
+ (( jtmp = ${__arg[(I)\)\)]}-1, jtmp > 0 )) && {
+ (( __start=_start_pos-__PBUFLEN+jtmp, __end=__start+2, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
+ # Counting complex brackets (for brackets-highlighter): 5. )) in assign argument
+ _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
+ }
+ } || -fast-highlight-string; (( _start_pos = _start_pos - itmp + 1, 1 > 0 ))
+ }
+ } elif [[ $__arg = ${histchars[1]}* && -n ${__arg[2]} ]] {
+ __style=${FAST_THEME_NAME}history-expansion
+
+ } elif [[ $__arg == ${histchars[2]}* ]] {
+ __style=${FAST_THEME_NAME}history-expansion
+
+ } elif (( __arg_type == 3 )) {
+ # This highlights empty commands (semicolon follows nothing) as an error.
+ # Zsh accepts them, though.
+ (( this_word & 3 )) && __style=${FAST_THEME_NAME}commandseparator
+
+ } elif [[ $__arg[1,2] == '((' ]] {
+ # Arithmetic evaluation.
+ #
+ # Note: prior to zsh-5.1.1-52-g4bed2cf (workers/36669), the ${(z)...}
+ # splitter would only output the '((' token if the matching '))' had
+ # been typed. Therefore, under those versions of zsh, BUFFER="(( 42"
+ # would be highlighted as an error until the matching "))" are typed.
+ #
+ # We highlight just the opening parentheses, as a reserved word; this
+ # is how [[ ... ]] is highlighted, too.
+
+ # ADD
+ (( __start=_start_pos-__PBUFLEN, __end=__start+2, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
+ already_added=1
+
+ # Counting complex brackets (for brackets-highlighter): 6. (( as command
+ _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
+ -fast-highlight-math-string
+
+ # ADD
+ [[ $__arg[-2,-1] == '))' ]] && {
+ (( __start=_end_pos-__PBUFLEN-2, __end=__start+2, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-paren]}")
+ (( __delimited = __delimited ? 2 : __delimited ))
+ # Counting complex brackets (for brackets-highlighter): 7. )) for as-command ((
+ _FAST_COMPLEX_BRACKETS+=( $__start $(( __start + 1 )) )
+ }
+ } elif [[ $__arg == '()' ]] {
+ _FAST_COMPLEX_BRACKETS+=( $(( _start_pos-__PBUFLEN )) $(( _start_pos-__PBUFLEN + 1 )) )
+ # anonymous function
+ __style=${FAST_THEME_NAME}reserved-word
+ } elif [[ $__arg == $'\x28' ]] {
+ # subshell '(', stack: letter 'R'
+ __style=${FAST_THEME_NAME}reserved-word
+ braces_stack='R'$braces_stack
+ } elif [[ $__arg == $'\x29' ]] {
+ # ')', stack: letter 'R' for subshell
+ [[ $braces_stack = R* ]] && { braces_stack=${braces_stack#R}; __style=${FAST_THEME_NAME}reserved-word; }
+ } elif (( this_word & 14 )) {
+ __style=${FAST_THEME_NAME}default
+ } elif [[ $__arg = (';;'|';&'|';|') ]] && (( this_word & BIT_case_code )) {
+ (( next_word = (next_word | BIT_case_item) & ~(BIT_case_code+3) ))
+ __style=${FAST_THEME_NAME}default
+ } elif [[ $__arg = \$\([^\(]* ]] {
+ already_added=1
+ }
+ ;;
*)
- # ADD
- # (( __start=_start_pos-__PBUFLEN, __end=_end_pos-__PBUFLEN, __start >= 0 )) && reply+=("$__start $__end commandtypefromthefuture-$REPLY")
- already_added=1
- ;;
+ # ADD
+ # (( __start=_start_pos-__PBUFLEN, __end=_end_pos-__PBUFLEN, __start >= 0 )) && reply+=("$__start $__end commandtypefromthefuture-$REPLY")
+ already_added=1
+ ;;
esac
- fi
- # in_redirection || BIT_regular || BIT_sudo_opt || BIT_sudo_arg
- elif (( in_redirection + this_word & 14 ))
- then # $__arg is a non-command word
+ fi
+ # in_redirection || BIT_regular || BIT_sudo_opt || BIT_sudo_arg
+ elif (( in_redirection + this_word & 14 ))
+ then # $__arg is a non-command word
case $__arg in
']]')
# A - [[
@@ -894,7 +877,7 @@ typeset -ga ZLAST_COMMANDS
if [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]} ]]; then
__idx=1
_mybuf=$FAST_THEME_NAME
- FAST_THEME_NAME=${${${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]}:t:r}#(XDG|LOCAL|HOME|OPT):}
+ FAST_THEME_NAME=${${${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]}:t:r}#(CONFIG|CACHE|LOCAL|HOME|OPT):}
(( ${+FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}default]} )) || source $FAST_WORK_DIR/secondary_theme.zsh
else
__idx=0
@@ -973,7 +956,7 @@ typeset -ga ZLAST_COMMANDS
if [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]} ]]; then
__idx=1
_mybuf=$FAST_THEME_NAME
- FAST_THEME_NAME=${${${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]}:t:r}#(XDG|LOCAL|HOME|OPT):}
+ FAST_THEME_NAME=${${${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]}:t:r}#(CONFIG|CACHE|LOCAL|HOME|OPT):}
(( ${+FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}default]} )) || source $FAST_WORK_DIR/secondary_theme.zsh
else
__idx=0
@@ -1068,7 +1051,7 @@ typeset -ga ZLAST_COMMANDS
__style=${FAST_THEME_NAME}commandseparator
elif (( in_redirection == 2 )); then
__style=${FAST_THEME_NAME}redirection
- elif (( ${+galiases[(e)$__arg]} )); then
+ elif (( ${+galiases[(e)${(Q)__arg}]} )); then
__style=${FAST_THEME_NAME}global-alias
else
if [[ ${FAST_HIGHLIGHT[no_check_paths]} != 1 ]]; then
@@ -1246,7 +1229,7 @@ typeset -ga ZLAST_COMMANDS
if [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]} ]]; then
__idx=1
__tmp=$FAST_THEME_NAME
- FAST_THEME_NAME=${${${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]}:t:r}#(XDG|LOCAL|HOME|OPT):}
+ FAST_THEME_NAME=${${${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}secondary]}:t:r}#(CONFIG|CACHE|LOCAL|HOME|OPT):}
(( ${+FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}default]} )) || source $FAST_WORK_DIR/secondary_theme.zsh
else
__idx=0
@@ -1264,8 +1247,7 @@ typeset -ga ZLAST_COMMANDS
return 0
}
--fast-highlight-check-path()
-{
+-fast-highlight-check-path() {
(( _start_pos-__PBUFLEN >= 0 )) || \
{ [[ $1 != "noasync" ]] && print -r -- "- $_start_pos $_end_pos"; return 1; }
[[ $1 != "noasync" ]] && {
@@ -1335,11 +1317,10 @@ zle -N -- fast-highlight-check-path-handler -fast-highlight-check-path-handler
# - E matches \*
#
# and the first condition -n ${match[7] uses D to continue searching when
-# backslash-something (not ['"$]) is occured.
+# backslash-something (not ['"$]) is occurred.
#
# $1 - additional style to glue-in to added style
--fast-highlight-string()
-{
+-fast-highlight-string() {
(( _start_pos-__PBUFLEN >= 0 )) || return 0
_mybuf=$__arg
__idx=_start_pos
@@ -1374,13 +1355,11 @@ zle -N -- fast-highlight-check-path-handler -fast-highlight-check-path-handler
# - D matches words [a-zA-Z]## (variables)
#
# Parameters used: _mybuf, __idx, _end_idx, __style
--fast-highlight-math-string()
-{
+-fast-highlight-math-string() {
(( _start_pos-__PBUFLEN >= 0 )) || return 0
_mybuf=$__arg
__idx=_start_pos
- # 7
while [[ $_mybuf = (#b)[^\$_a-zA-Z0-9]#((\$(#B)(+|)(#B)([a-zA-Z_:][a-zA-Z0-9_:]#|[0-9]##)(#b)(\[[^\]]##\])(#c0,1))|(\$[{](#B)(+|)(#b)(\([a-zA-Z0-9_:@%#]##\))(#c0,1)[a-zA-Z0-9_:#]##(\[[^\]]##\])(#c0,1)[}])|\$|[a-zA-Z_][a-zA-Z0-9_]#|[0-9]##)(*) ]]; do
__idx+=${mbegin[1]}-1
_end_idx=__idx+${mend[1]}-${mbegin[1]}+1
@@ -1412,8 +1391,7 @@ zle -N -- fast-highlight-check-path-handler -fast-highlight-check-path-handler
}
# Highlight special chars inside dollar-quoted strings
--fast-highlight-dollar-string()
-{
+-fast-highlight-dollar-string() {
(( _start_pos-__PBUFLEN >= 0 )) || return 0
local i j k __style
local AA
@@ -1435,7 +1413,7 @@ zle -N -- fast-highlight-check-path-handler -fast-highlight-check-path-handler
|| "$AA" == (#m)(#s)[0-7](#c1,3)
|| "$AA" == (#m)(#s)u[0-9a-fA-F](#c1,4)
|| "$AA" == (#m)(#s)U[0-9a-fA-F](#c1,8)
- ]]; then
+ ]]; then
(( k += MEND ))
(( i += MEND ))
else
@@ -1462,7 +1440,7 @@ zle -N -- fast-highlight-check-path-handler -fast-highlight-check-path-handler
typeset -ga FSH_LIST
-fsh_sy_h_shappend() {
- FSH_LIST+=( "$(( $1 - 1 ));;$(( $2 ))" )
+ FSH_LIST+=( "$(( $1 - 1 ));;$(( $2 ))" )
}
functions -M fsh_sy_h_append 2 2 -fsh_sy_h_shappend 2>/dev/null
diff --git a/functions/fast-string-highlight b/functions/fast-string-highlight
new file mode 100755
index 0000000..0e63219
--- /dev/null
+++ b/functions/fast-string-highlight
@@ -0,0 +1,79 @@
+#----------------------------------------------------------------------------------------------------------------------
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#----------------------------------------------------------------------------------------------------------------------
+#
+# $1 - PREBUFFER
+# $2 - BUFFER
+#
+-fast-highlight-string-process() {
+ builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+ builtin setopt extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd
+
+ local -A pos_to_level level_to_pos pair_map final_pairs
+ local input=$1$2 _mybuf=$1$2 __style __quoting
+ integer __idx=0 __pair_idx __level=0 __start __end
+ local -a match mbegin mend
+
+ pair_map=( "(" ")" "{" "}" "[" "]" )
+
+ while [[ $_mybuf = (#b)([^"{}()[]\\\"'"]#)((["({[]})\"'"])|[\\](*))(*) ]]; do
+ if [[ -n ${match[4]} ]] {
+ __idx+=${mbegin[2]}
+ [[ $__quoting = \' ]] && _mybuf=${match[4]} || { _mybuf=${match[4]:1}; (( ++ __idx )); }
+ } else {
+ __idx+=${mbegin[2]}
+ [[ -z $__quoting && -z ${_FAST_COMPLEX_BRACKETS[(r)$((__idx-${#PREBUFFER}-1))]} ]] && {
+ if [[ ${match[2]} = ["({["] ]]; then
+ pos_to_level[$__idx]=$(( ++__level ))
+ level_to_pos[$__level]=$__idx
+ elif [[ ${match[2]} = ["]})"] ]]; then
+ if (( __level > 0 )); then
+ __pair_idx=${level_to_pos[$__level]}
+ pos_to_level[$__idx]=$(( __level -- ))
+ [[ ${pair_map[${input[__pair_idx]}]} = ${input[__idx]} ]] && {
+ final_pairs[$__idx]=$__pair_idx
+ final_pairs[$__pair_idx]=$__idx
+ }
+ else
+ pos_to_level[$__idx]=-1
+ fi
+ fi
+ }
+ if [[ ${match[2]} = \" && $__quoting != \' ]] {
+ [[ $__quoting = '"' ]] && __quoting="" || __quoting='"';
+ }
+ if [[ ${match[2]} = \' && $__quoting != \" ]] {
+ if [[ $__quoting = ("'"|"$'") ]] {
+ __quoting=""
+ } else {
+ if [[ $match[1] = *\$ ]] {
+ __quoting="\$'";
+ } else {
+ __quoting="'";
+ }
+ }
+ }
+ _mybuf=${match[5]}
+ }
+ done
+
+ for __idx in ${(k)pos_to_level}; do
+ (( ${+final_pairs[$__idx]} )) && \
+ __style=${FAST_THEME_NAME}bracket-level-$(( ( (pos_to_level[$__idx]-1) % 3 ) + 1 )) || \
+ __style=${FAST_THEME_NAME}unknown-token
+ (( __start=__idx-${#PREBUFFER}-1, __end=__idx-${#PREBUFFER}, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+ done
+
+ # If cursor is on a bracket, then highlight corresponding bracket, if any.
+ if [[ $WIDGET != zle-line-finish ]]; then
+ __idx=$(( CURSOR + 1 ))
+ if (( ${+pos_to_level[$__idx]} )) && (( ${+final_pairs[$__idx]} )); then
+ (( __start=final_pairs[$__idx]-${#PREBUFFER}-1, __end=final_pairs[$__idx]-${#PREBUFFER}, __start >= 0 )) && \
+ reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}paired-bracket]}") && \
+ reply+=("$CURSOR $__idx ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}paired-bracket]}")
+ fi
+ fi
+ return 0
+}
diff --git a/functions/fast-theme b/functions/fast-theme
old mode 100644
new mode 100755
index af5c2ec..5cc9f5e
--- a/functions/fast-theme
+++ b/functions/fast-theme
@@ -11,9 +11,10 @@
zmodload zsh/zutil 2>/dev/null
# Standard Recommended Options
-# https://z.digitalclouds.dev/community/zsh_plugin_standard/#standard-recommended-options
-emulate -L zsh
-setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
+# https://wiki.zshell.dev/community/zsh_plugin_standard/#standard-recommended-options
+
+builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
+builtin setopt extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd
autoload colors; colors
typeset -g FAST_WORK_DIR
@@ -21,22 +22,23 @@ typeset -g FAST_WORK_DIR
FAST_WORK_DIR=${~FAST_WORK_DIR}
local -A map
-map=( "XDG:" "${XDG_CONFIG_HOME:-$HOME/.config}/fsh/"
- "LOCAL:" "/usr/local/share/fsh/"
- "HOME:" "$HOME/.fsh/"
- "OPT:" "/opt/local/share/fsh/"
+map=( "CONFIG:" "${XDG_CONFIG_HOME:-$HOME/.config}/f-sy-h/"
+ "CACHE:" "${XDG_CACHE_HOME:-$HOME/.cache}/f-sy-h/"
+ "LOCAL:" "/usr/local/share/f-sy-h/"
+ "HOME:" "$HOME/.f-sy-h/"
+ "OPT:" "/opt/local/share/f-sy-h/"
)
-FAST_WORK_DIR=${${FAST_WORK_DIR/(#m)(#s)(XDG|LOCAL|HOME|OPT):(#c0,1)/${map[${MATCH%:}:]}}%/}
+FAST_WORK_DIR=${${FAST_WORK_DIR/(#m)(#s)(CONFIG|CACHE|LOCAL|HOME|OPT):(#c0,1)/${map[${MATCH%:}:]}}%/}
-local OPT_HELP OPT_VERBOSE OPT_QUIET OPT_RESET OPT_LIST OPT_TEST OPT_SECONDARY OPT_SHOW OPT_COPY OPT_OV_RESET
+local OPT_HELP OPT_INFO OPT_VERBOSE OPT_QUIET OPT_RESET OPT_LIST OPT_TEST OPT_SECONDARY OPT_SHOW OPT_COPY OPT_OV_RESET
local OPT_PALETTE OPT_CDWD OPT_XCHG OPT_OV_XCHG
local -A opthash
-zparseopts -E -D -A opthash h -help v -verbose q -quiet r -reset l -list t -test -secondary \
-s -show -copy-shipped-theme: R -ov-reset p -palette w -workdir x -xchg y -ov-xchg || \
-{ echo "Improper options given, see help (-h/--help)"; return 1; }
+zparseopts -E -D -A opthash h -help v -verbose q -quiet i -info r -reset l -list t -test -secondary s -show \
+-copy-shipped-theme: R -ov-reset p -palette w -workdir x -xchg y -ov-xchg || return 1
(( ${+opthash[-h]} + ${+opthash[--help]} )) && OPT_HELP="-h"
+(( ${+opthash[-i]} + ${+opthash[--info]} )) && OPT_INFO="-i"
(( ${+opthash[-v]} + ${+opthash[--verbose]} )) && OPT_VERBOSE="-v"
(( ${+opthash[-q]} + ${+opthash[--quiet]} )) && OPT_QUIET="-q"
(( ${+opthash[-r]} + ${+opthash[--reset]} )) && OPT_RESET="-r"
@@ -54,12 +56,37 @@ s -show -copy-shipped-theme: R -ov-reset p -palette w -workdir x -xchg y -ov-xch
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
-[[ -n "$OPT_CDWD" ]] && {
+if [[ -n "$OPT_CDWD" ]]; then
builtin cd $FAST_WORK_DIR
return 0
-}
+fi
+
+if [[ -n "$OPT_INFO" ]]; then
+ print -r -- "The default ${fg[green]}fast-theme$reset_color command can be used to switch current and future sessions to a new different theme."
+ print -r -- ""
+ print -r -- "The theme path can use one of the shorthands below to point ~/.config/f-sy-h/.ini."
+ print -r -- "If the INI file pointed in the path is \"*overlay*\", then it is not a full theme,"
+ print -r -- "but an additional theme-snippet that overwrites only selected styles of the main theme."
+ print -r -- ""
+ print -r -- "${fg[yellow]}Shorthands$reset_color:"
+ print -r -- ""
+ print -r -- "CONFIG: = ${XDG_CONFIG_HOME:-$HOME/.config}/f-sy-h/"
+ print -r -- "CACHE: = ${XDG_CACHE_HOME:-$HOME/.cache}/f-sy-h/"
+ print -r -- "LOCAL: = /usr/local/share/f-sy-h/"
+ print -r -- "HOME: = $HOME/.f-sy-h/"
+ print -r -- "OPT: = /opt/local/share/f-sy-h/"
+ print -r -- ""
+ print -r -- "${fg[yellow]}Example$reset_color:"
+ print -r -- ""
+ print -r -- "${fg[green]}fast-theme ${fg[cyan]}-w$reset_color"
+ print -r -- "${fg[green]}fast-theme ${fg[cyan]}--copy-shipped-theme$reset_color clean z-shell"
+ print -r -- ""
+ print -r -- "This allows easy copying of one of the shipped themes into set directory."
+ print -r -- "The shipped themes are located in ${fg_bold[green]}$FAST_BASE_DIR/themes$reset_color."
+ return 0
+fi
-[[ -n "$OPT_PALETTE" ]] && {
+if [[ -n "$OPT_PALETTE" ]]; then
local n
local -a __colors
for n in {000..255}
@@ -68,71 +95,60 @@ local MATCH; integer MBEGIN MEND
done
print -cP $__colors
return
-}
+fi
-[[ -n "$OPT_SHOW" ]] && {
- print -r -- "Currently active theme: ${fg_bold[yellow]}$FAST_THEME_NAME$reset_color"
- ( source "$FAST_WORK_DIR"/current_theme.zsh 2>/dev/null && print "Main theme (loaded at startup of a session): ${fg_bold[yellow]}$FAST_THEME_NAME$reset_color" || print "No main theme is set"; )
+if [[ -n "$OPT_SHOW" ]]; then
+ print -r -- "Currently active theme: ${fg_bold[green]}$FAST_THEME_NAME$reset_color"
+ ( source "$FAST_WORK_DIR"/current_theme.zsh 2>/dev/null && print -r -- "Main theme (session startup): ${fg_bold[green]}$FAST_THEME_NAME$reset_color" || print "No main theme is set"; )
return 0
-}
-
-[[ -n "$OPT_COPY" ]] && {
- [[ ! -f "$FAST_BASE_DIR"/themes/"${OPT_COPY%.ini}.ini" ]] && { print "Theme \`$OPT_COPY' doesn't exist in FSH plugin dir ($FAST_BASE_DIR/themes)"; return 1; }
- [[ ! -r "$FAST_BASE_DIR"/themes/"${OPT_COPY%.ini}.ini" ]] && { print "Theme \`$OPT_COPY' isn't readable in FSH plugin dir ($FAST_BASE_DIR/themes)"; return 1; }
- [[ -n "$1" ]] && {
- [[ ! -e "$1" && ! -e ${1:h} ]] && { print "Destination path doesn't exist, aborting"; return 1; }
- }
- command cp -vf "$FAST_BASE_DIR"/themes/"${OPT_COPY%.ini}.ini" "${${1:-.}%.ini}.ini" || return 1
- return 0
-}
-
-[[ -n "$OPT_RESET" ]] && { command rm -f "$FAST_WORK_DIR"/{current_theme.zsh,secondary_theme.zsh}; [[ -z "$OPT_QUIET" ]] && print "Reset done (no theme is now set, restart is required)"; return 0; }
+fi
-[[ -n "$OPT_OV_RESET" ]] && { command rm -f "$FAST_WORK_DIR"/theme_overlay.zsh; [[ -z "$OPT_QUIET" ]] && print "Overlay-reset done, it is inactive (restart is required)"; return 0; }
+if [[ -n "$OPT_COPY" ]]; then
+ [[ ! -f "$FAST_BASE_DIR"/themes/"${OPT_COPY%.ini}.ini" ]] && { print -r -- "Theme ${fg_bold[green]}\`$OPT_COPY'$reset_color doesn't exist in F-Sy-H plugin dir ($FAST_BASE_DIR/themes)"; return 1; }
+ [[ ! -r "$FAST_BASE_DIR"/themes/"${OPT_COPY%.ini}.ini" ]] && { print -r -- "Theme ${fg_bold[green]}\`$OPT_COPY'$reset_color isn't readable in F-Sy-H plugin dir ($FAST_BASE_DIR/themes)"; return 1; }
+ [[ -n "$1" ]] && {
+ [[ ! -e "$1" && ! -e ${1:h} ]] && { print "Destination path doesn't exist, aborting"; return 1; }
+ }
+ command cp -vf "$FAST_BASE_DIR"/themes/"${OPT_COPY%.ini}.ini" "${${1:-.}%.ini}.ini" || return 1
+ return 0
+fi
-[[ -n "$OPT_LIST" ]] && {
- [[ -z "$OPT_QUIET" ]] && print -r -- "Available themes:"
- print -rl -- "$FAST_BASE_DIR"/themes/*.ini(:t:r)
- return 0
-}
+[[ -n "$OPT_RESET" ]] && { command rm -f "$FAST_WORK_DIR"/{current_theme.zsh,secondary_theme.zsh}; [[ -z "$OPT_QUIET" ]] && print -r -- "${fg[yellow]}Reset done$reset_color (${fg[red]}restart is required$reset_color)"; return 0; }
+[[ -n "$OPT_OV_RESET" ]] && { command rm -f "$FAST_WORK_DIR"/theme_overlay.zsh; [[ -z "$OPT_QUIET" ]] && print -r -- "${fg[yellow]}Overlay-reset done$reset_color (${fg[red]}restart is required$reset_color)"; return 0; }
-[[ -n "$OPT_HELP" ]] && {
- print -r -- "Usage: fast-theme [-h/--help] [-v/--verbose] [-q/--quiet] [-t/--test] "
- print -r -- " fast-theme [-r/--reset] [-l/--list] [-s/--show] [-p/--palette] [-w/--workdir]"
- print -r -- " fast-theme --copy-shipped-theme {theme-name} [destination-path]"
- print -r -- ""
- print -r -- "Default action (after providing or ) is to switch"
- print -r -- "current session and any future sessions to the new theme. Using ,"
- print -r -- "i.e.: a path to an ini file means using custom, own theme. The path can use an"
- print -r -- "\"XDG:\" shorthand (e.g.: \"XDG:mytheme\") that will point to ~/.config/fsh/.ini"
- print -r -- "(or \$XDG_CONFIG_HOME/fsh/.ini in general if the variable is set in the"
- print -r -- "environment). If the INI file pointed in the path is \"*overlay*\", then it is"
- print -r -- "not a full theme, but an additional theme-snippet that overwrites only selected"
- print -r -- "styles of the main theme."
+if [[ -n "$OPT_LIST" ]]; then
+ if [[ -z "$OPT_QUIET" ]]; then
+ print -r -- "${fg_bold[yellow]}Available themes$reset_color:"
print -r -- ""
- print -r -- "Other path-shorthands:"
- print -r -- "LOCAL: = /usr/local/share/fsh/"
- print -r -- "HOME: = $HOME/.fsh/"
- print -r -- "OPT: = /opt/local/share/fsh/"
- print -r -- ""
- print -r -- "-r/--reset - unset any theme, use default highlighting (requires restart)"
- print -r -- "-R/--ov-reset - unset overlay, use styles only from main-theme (requires restart)"
- print -r -- "-l/--list - list names of available themes"
- print -r -- "-t/--test - show test block of code after switching theme"
- print -r -- "-s/--show - get and display the theme currently being set"
- print -r -- "-p/--palette - just print all 256 colors and exit (useful when creating a theme)"
- print -r -- "-w/--workdir - cd into \$FAST_WORK_DIR (if not set, then into the plugin directory)"
- print -r -- "-v/--verbose - more messages during operation"
- print -r -- "-q/--quiet - no default messages"
+ print -rl -- "$FAST_BASE_DIR"/themes/*.ini(:t:r)
print -r -- ""
- print -r -- "The option --copy-shipped-theme allows easy copying of one of the 6 shipped"
- print -r -- "themes into given destination path. Normal use means changing directory to"
- print -r -- "e.g.: ~/.config/fsh, and then issuing e.g.: \`fast-theme --copy-shipped-theme"
- print -r -- "clean mytheme', to obtain a template for own new theme."
- return 0
-}
+ fi
+ return 0
+fi
+
+if [[ -n "$OPT_HELP" ]]; then
+ print -r -- "${fg_bold[yellow]}Usage$reset_color:"
+ print -r -- " ${fg[green]}fast-theme$reset_color [-h/--help] [-v/--verbose] [-q/--quiet] [-t/--test] "
+ print -r -- " ${fg[green]}fast-theme$reset_color [-r/--reset] [-l/--list] [-s/--show] [-p/--palette] [-w/--workdir]"
+ print -r -- " ${fg[green]}fast-theme$reset_color --copy-shipped-theme {theme-name} [destination-path]"
+ print -r -- ""
+ print -r -- "${fg_bold[yellow]}Flags$reset_color:"
+ print -r -- " ${fg[cyan]}-R, --ov-reset$reset_color - unset overlay, use styles only from main-theme (requires restart)"
+ print -r -- " ${fg[cyan]}-p, --palette$reset_color - just print all 256 colors and exit (useful when creating a theme)"
+ print -r -- " ${fg[cyan]}-r, --reset$reset_color - unset any theme, use default highlighting (requires restart)"
+ print -r -- " ${fg[cyan]}-t, --test$reset_color - show test block of code after switching theme"
+ print -r -- " ${fg[cyan]}-s, --show$reset_color - get and display the theme currently being set"
+ print -r -- " ${fg[cyan]}-w, --workdir$reset_color - cd into $FAST_WORK_DIR (\$FAST_WORK_DIR)"
+ print -r -- " ${fg[cyan]}-l, --list$reset_color - list names of available themes"
+ print -r -- " ${fg[cyan]}-v, --verbose$reset_color - more messages during operation"
+ print -r -- " ${fg[cyan]}-i, --info$reset_color - additional usage information"
+ print -r -- " ${fg[cyan]}-q, --quiet$reset_color - no default messages"
+ print -r -- " ${fg[cyan]}-h, --help$reset_color - this help message"
+ print -r -- ""
+ return 0
+fi
-[[ -z "$1" ]] && { print -u2 "Provide a theme (its name or path to its file) to switch to, aborting (see -h/--help)"; return 1; }
+[[ -z "$1" ]] && { print -u2 "${fg[yellow]}Show help$reset_color: ${fg[cyan]}-h, --help$reset_color"; return 1; }
# FAST_HIGHLIGHT_STYLES key onto ini-file key
map=(
@@ -202,17 +218,17 @@ map=(
# In which order to generate entries
local -a order
order=(
- default unknown-token reserved-word alias suffix-alias builtin function command precommand
- commandseparator hashed-command path path_pathseparator globbing globbing-ext history-expansion
- single-hyphen-option double-hyphen-option back-quoted-argument single-quoted-argument
- double-quoted-argument dollar-quoted-argument back-or-dollar-double-quoted-argument
- back-dollar-quoted-argument assign redirection comment variable mathvar
- mathnum matherr assign-array-bracket for-loop-variable for-loop-number for-loop-operator
- for-loop-separator exec-descriptor here-string-tri here-string-text here-string-var secondary
- case-input case-parentheses case-condition correct-subtle incorrect-subtle subtle-separator subtle-bg
- path-to-dir paired-bracket bracket-level-1 bracket-level-2 bracket-level-3
- global-alias subcommand single-sq-bracket double-sq-bracket double-paren
- optarg-string optarg-number recursive-base
+ default unknown-token reserved-word alias suffix-alias builtin function command precommand
+ commandseparator hashed-command path path_pathseparator globbing globbing-ext history-expansion
+ single-hyphen-option double-hyphen-option back-quoted-argument single-quoted-argument
+ double-quoted-argument dollar-quoted-argument back-or-dollar-double-quoted-argument
+ back-dollar-quoted-argument assign redirection comment variable mathvar
+ mathnum matherr assign-array-bracket for-loop-variable for-loop-number for-loop-operator
+ for-loop-separator exec-descriptor here-string-tri here-string-text here-string-var secondary
+ case-input case-parentheses case-condition correct-subtle incorrect-subtle subtle-separator subtle-bg
+ path-to-dir paired-bracket bracket-level-1 bracket-level-2 bracket-level-3
+ global-alias subcommand single-sq-bracket double-sq-bracket double-paren
+ optarg-string optarg-number recursive-base
)
[[ -n "$OPT_VERBOSE" ]] && print "Number of styles available for customization: ${#order}"
@@ -227,24 +243,25 @@ color=( red green blue yellow cyan magenta black white default )
local -A out
local THEME_NAME THEME_PATH="$1"
-if [[ "$1" = */* || "$1" = (XDG|LOCAL|HOME|OPT):* ]]; then
- 1="${${1/(#s)XDG:/${${XDG_CONFIG_HOME:-$HOME/.config}%/}/fsh/}%.ini}.ini"
- 1="${${1/(#s)LOCAL://usr/local/share/fsh/}%.ini}.ini"
- 1="${${1/(#s)HOME:/$HOME/.fsh/}%.ini}.ini"
- 1="${${1/(#s)OPT://opt/local/share/fsh/}%.ini}.ini"
- 1=${~1} # allow user to quote ~
-
- [[ ! -f "$1" ]] && { print -u2 "No such theme \`$1', aborting"; return 1; }
- [[ ! -r "$1" ]] && { print -u2 "Theme \`$1' unreadable, aborting"; return 1; }
-
- THEME_NAME="${1:t:r}"
- .fast-read-ini-file "$1" out ""
+if [[ "$1" = */* || "$1" = (CONFIG|CACHE|LOCAL|HOME|OPT):* ]]; then
+ 1="${${1/(#s)CONFIG:/${${XDG_CONFIG_HOME:-$HOME/.config}%/}/f-sy-h/}%.ini}.ini"
+ 1="${${1/(#s)CACHE:/${${XDG_CACHE_HOME:-$HOME/.cache}%/}/f-sy-h/}%.ini}.ini"
+ 1="${${1/(#s)LOCAL://usr/local/share/f-sy-h/}%.ini}.ini"
+ 1="${${1/(#s)HOME:/$HOME/.f-sy-h/}%.ini}.ini"
+ 1="${${1/(#s)OPT://opt/local/share/f-sy-h/}%.ini}.ini"
+ 1=${~1} # allow user to quote ~
+
+ [[ ! -f "$1" ]] && { print -u2 "${fg[yellow]}No such theme$reset_color \`$1'${fg[yellow]}, aborting$reset_color"; return 1; }
+ [[ ! -r "$1" ]] && { print -u2 "${fg[yellow]}Theme$reset_color \`$1' ${fg[yellow]}unreadable, aborting$reset_color"; return 1; }
+
+ THEME_NAME="${1:t:r}"
+ .fast-read-ini-file "$1" out ""
else
- [[ ! -f "$FAST_BASE_DIR/themes/$1.ini" ]] && { print -u2 "No such theme \`$1', aborting"; return 1; }
- [[ ! -r "$FAST_BASE_DIR/themes/$1.ini" ]] && { print -u2 "Theme \`$1' unreadable, aborting"; return 1; }
+ [[ ! -f "$FAST_BASE_DIR/themes/$1.ini" ]] && { print -u2 "${fg[yellow]}No such theme$reset_color \`$1'${fg[yellow]}, aborting$reset_color"; return 1; }
+ [[ ! -r "$FAST_BASE_DIR/themes/$1.ini" ]] && { print -u2 "${fg[yellow]}Theme$reset_color \`$1' ${fg[yellow]}unreadable, aborting$reset_color"; return 1; }
- THEME_NAME="$1"
- .fast-read-ini-file "$FAST_BASE_DIR/themes/$1.ini" out ""
+ THEME_NAME="$1"
+ .fast-read-ini-file "$FAST_BASE_DIR/themes/$1.ini" out ""
fi
[[ -z "$OPT_SECONDARY" ]] && { [[ "$THEME_NAME" = *"overlay"* ]] && local outfile="theme_overlay.zsh" || local outfile="current_theme.zsh"; } || local outfile="secondary_theme.zsh"
@@ -252,14 +269,14 @@ fi
# Set a zstyle and a parameter to carry theme name
if [[ -z "$OPT_SECONDARY" && -z "$OPT_XCHG" && -z "$OPT_OV_XCHG" ]]; then
- [[ "$THEME_NAME" != *"overlay"* ]] && {
- print -r -- 'zstyle :plugin:fast-syntax-highlighting theme "'"$THEME_NAME"'"' >>! "$FAST_WORK_DIR"/"$outfile"
- print -r -- 'typeset -g FAST_THEME_NAME="'"$THEME_NAME"'"' >>! "$FAST_WORK_DIR"/"$outfile"
- zstyle :plugin:fast-syntax-highlighting theme "$THEME_NAME"
- typeset -g FAST_THEME_NAME="$THEME_NAME"
- }
+ [[ "$THEME_NAME" != *"overlay"* ]] && {
+ print -r -- 'zstyle :plugin:fast-syntax-highlighting theme "'"$THEME_NAME"'"' >>! "$FAST_WORK_DIR"/"$outfile"
+ print -r -- 'typeset -g FAST_THEME_NAME="'"$THEME_NAME"'"' >>! "$FAST_WORK_DIR"/"$outfile"
+ zstyle :plugin:fast-syntax-highlighting theme "$THEME_NAME"
+ typeset -g FAST_THEME_NAME="$THEME_NAME"
+ }
elif [[ -z "$OPT_XCHG" && -z "$OPT_OV_XCHG" ]]; then
- local FAST_THEME_NAME="$THEME_NAME"
+ local FAST_THEME_NAME="$THEME_NAME"
fi
# Store from which file the theme or overlay is being loaded
@@ -269,6 +286,7 @@ fi
local k kk
local inikey inival result result2 first_val isbg
integer ov_counter=0 first
+
for k in "${order[@]}"; do
first=1
for kk in ${(s. .)map[$k]} default; do
@@ -343,46 +361,46 @@ done
zcompile $FAST_WORK_DIR/$outfile 2>/dev/null
-[[ -z "$OPT_QUIET" ]] && {
+if [[ -z "$OPT_QUIET" ]]; then
if [[ "$THEME_NAME" != *"overlay"* ]]; then
print "Switched to theme \`$THEME_NAME' (current session, and future sessions)" || \
else
print "Processed the overlay ($ov_counter keys found), it is now active (for current session, and future sessions)"
fi
-}
+fi
-[[ -n "$OPT_TEST" ]] && {
+if [[ -n "$OPT_TEST" ]]; then
print -zr '
-# Subshell, assignments, math-mode
-echo $(cat /etc/hosts |& grep -i "hello337")
-local param1="text ${+variable[test]} text ${var} text"; typeset param2='"'"'other $variable'"'"'
-math=$(( 10 + HISTSIZ + HISTSIZE + $SAVEHIST )) size=$(( 0 ))
-
-# Programming-like usage, bracket matching - through distinct colors; note the backslash quoting
-for (( ii = 1; ii <= size; ++ ii )); do
- if [[ "${cmds[ii]} string" = "| string" ]]
- then
- sidx=${buffer[(in:ii:)\$\(?#[^\\\\]\)]} # find opening cmd-subst
- (( sidx <= len + 100 )) && {
- eidx=${buffer[(b:sidx:ii)[^\\\\]\)]} # find closing cmd-subst
- }
- fi
-done
+ # Sub-shell, assignments, math-mode
+ echo $(cat /etc/hosts |& grep -i "hello337")
+ local param1="text ${+variable[test]} text ${var} text"; typeset param2='"'"'other $variable'"'"'
+ math=$(( 10 + HISTSIZ + HISTSIZE + $SAVEHIST )) size=$(( 0 ))
+
+ # Programming-like usage, bracket matching - through distinct colors; note the backslash quoting
+ for (( ii = 1; ii <= size; ++ ii )); do
+ if [[ "${cmds[ii]} string" = "| string" ]]
+ then
+ sidx=${buffer[(in:ii:)\$\(?#[^\\\\]\)]} # find opening cmd-subst
+ (( sidx <= len + 100 )) && {
+ eidx=${buffer[(b:sidx:ii)[^\\\\]\)]} # find closing cmd-subst
+ }
+ fi
+ done
-# Regular command-line usage
-repeat 0 {
- zsh -i -c "cat /etc/shells* | grep -x --line-buffered -i '"'/bin/zsh'"'"
- builtin exit $return_value
- fast-theme -tq default
- fsh-alias -tq default-X # alias '"'"'fsh-alias=fast-theme'"'"' works just like the previous line
- command -v git | grep ".+git" && echo $'"'"'Git is installed'"'"'
- git checkout -m --ours /etc/shells && git status-X
- gem install asciidoctor
- cat <<<$PATH | tr : \\n > /dev/null 2>/usr/local
- man -a fopen fopen-X
- CFLAGS="-g -Wall -O0" ./configure
-}
-'
-}
+ # Regular command-line usage
+ repeat 0 {
+ zsh -i -c "cat /etc/shells* | grep -x --line-buffered -i '"'/bin/zsh'"'"
+ builtin exit $return_value
+ fast-theme -tq default
+ f-sy-h -tq default-X # alias '"'"'f-sy-h=fast-theme'"'"' works just like the previous line
+ command -v git | grep ".+git" && echo $'"'"'Git is installed'"'"'
+ git checkout -m --ours /etc/shells && git status-X
+ gem install asciidoctor
+ cat <<<$PATH | tr : \\n > /dev/null 2>/usr/local
+ man -a fopen fopen-X
+ CFLAGS="-g -Wall -O0" ./configure
+ }
+ '
+fi
return 0
diff --git a/share/free_theme.zsh b/share/free_theme.zsh
old mode 100644
new mode 100755
index 0f32d66..c1874f7
--- a/share/free_theme.zsh
+++ b/share/free_theme.zsh
@@ -1,61 +1,61 @@
-: ${FAST_HIGHLIGHT_STYLES[freedefault]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freeunknown-token]:=fg=red,bold}
-: ${FAST_HIGHLIGHT_STYLES[freereserved-word]:=fg=150}
: ${FAST_HIGHLIGHT_STYLES[freealias]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freesuffix-alias]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freeassign-array-bracket]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freeassign]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freeback-dollar-quoted-argument]:=fg=110}
+: ${FAST_HIGHLIGHT_STYLES[freeback-or-dollar-double-quoted-argument]:=fg=110}
+: ${FAST_HIGHLIGHT_STYLES[freeback-quoted-argument]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freebracket-level-1]:=fg=130}
+: ${FAST_HIGHLIGHT_STYLES[freebracket-level-2]:=fg=70}
+: ${FAST_HIGHLIGHT_STYLES[freebracket-level-3]:=fg=69}
: ${FAST_HIGHLIGHT_STYLES[freebuiltin]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freefunction]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freecase-condition]:=bg=19}
+: ${FAST_HIGHLIGHT_STYLES[freecase-input]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freecase-parentheses]:=fg=116}
: ${FAST_HIGHLIGHT_STYLES[freecommand]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freeprecommand]:=fg=180}
: ${FAST_HIGHLIGHT_STYLES[freecommandseparator]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freehashed-command]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freepath]:=fg=166}
-: ${FAST_HIGHLIGHT_STYLES[freepath_pathseparator]:=}
-: ${FAST_HIGHLIGHT_STYLES[freeglobbing]:=fg=112}
-: ${FAST_HIGHLIGHT_STYLES[freeglobbing-ext]:=fg=118}
-: ${FAST_HIGHLIGHT_STYLES[freehistory-expansion]:=fg=blue,bold}
-: ${FAST_HIGHLIGHT_STYLES[freesingle-hyphen-option]:=fg=110}
+: ${FAST_HIGHLIGHT_STYLES[freecomment]:=fg=black,bold}
+: ${FAST_HIGHLIGHT_STYLES[freecorrect-subtle]:=bg=55}
+: ${FAST_HIGHLIGHT_STYLES[freedefault]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freedollar-quoted-argument]:=fg=150}
: ${FAST_HIGHLIGHT_STYLES[freedouble-hyphen-option]:=fg=110}
-: ${FAST_HIGHLIGHT_STYLES[freeback-quoted-argument]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freesingle-quoted-argument]:=fg=150}
+: ${FAST_HIGHLIGHT_STYLES[freedouble-paren]:=fg=150}
: ${FAST_HIGHLIGHT_STYLES[freedouble-quoted-argument]:=fg=150}
-: ${FAST_HIGHLIGHT_STYLES[freedollar-quoted-argument]:=fg=150}
-: ${FAST_HIGHLIGHT_STYLES[freeback-or-dollar-double-quoted-argument]:=fg=110}
-: ${FAST_HIGHLIGHT_STYLES[freeback-dollar-quoted-argument]:=fg=110}
-: ${FAST_HIGHLIGHT_STYLES[freeassign]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freeredirection]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freecomment]:=fg=black,bold}
-: ${FAST_HIGHLIGHT_STYLES[freevariable]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freemathvar]:=fg=blue,bold}
-: ${FAST_HIGHLIGHT_STYLES[freemathnum]:=fg=166}
-: ${FAST_HIGHLIGHT_STYLES[freematherr]:=fg=red}
-: ${FAST_HIGHLIGHT_STYLES[freeassign-array-bracket]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freefor-loop-variable]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freedouble-sq-bracket]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freeexec-descriptor]:=fg=yellow,bold}
: ${FAST_HIGHLIGHT_STYLES[freefor-loop-number]:=fg=150}
: ${FAST_HIGHLIGHT_STYLES[freefor-loop-operator]:=fg=150}
: ${FAST_HIGHLIGHT_STYLES[freefor-loop-separator]:=fg=109}
-: ${FAST_HIGHLIGHT_STYLES[freeexec-descriptor]:=fg=yellow,bold}
-: ${FAST_HIGHLIGHT_STYLES[freehere-string-tri]:=fg=yellow}
+: ${FAST_HIGHLIGHT_STYLES[freefor-loop-variable]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freefunction]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freeglobal-alias]:=bg=19}
+: ${FAST_HIGHLIGHT_STYLES[freeglobbing-ext]:=fg=118}
+: ${FAST_HIGHLIGHT_STYLES[freeglobbing]:=fg=112}
+: ${FAST_HIGHLIGHT_STYLES[freehashed-command]:=fg=180}
: ${FAST_HIGHLIGHT_STYLES[freehere-string-text]:=bg=19}
+: ${FAST_HIGHLIGHT_STYLES[freehere-string-tri]:=fg=yellow}
: ${FAST_HIGHLIGHT_STYLES[freehere-string-var]:=fg=110,bg=19}
-: ${FAST_HIGHLIGHT_STYLES[freesecondary]:=zdharma}
-: ${FAST_HIGHLIGHT_STYLES[freecase-input]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freecase-parentheses]:=fg=116}
-: ${FAST_HIGHLIGHT_STYLES[freecase-condition]:=bg=19}
-: ${FAST_HIGHLIGHT_STYLES[freecorrect-subtle]:=bg=55}
+: ${FAST_HIGHLIGHT_STYLES[freehistory-expansion]:=fg=blue,bold}
: ${FAST_HIGHLIGHT_STYLES[freeincorrect-subtle]:=bg=52}
-: ${FAST_HIGHLIGHT_STYLES[freesubtle-separator]:=none}
-: ${FAST_HIGHLIGHT_STYLES[freesubtle-bg]:=bg=18}
-: ${FAST_HIGHLIGHT_STYLES[freepath-to-dir]:=fg=166,underline}
-: ${FAST_HIGHLIGHT_STYLES[freepaired-bracket]:=bg=blue}
-: ${FAST_HIGHLIGHT_STYLES[freebracket-level-1]:=fg=130}
-: ${FAST_HIGHLIGHT_STYLES[freebracket-level-2]:=fg=70}
-: ${FAST_HIGHLIGHT_STYLES[freebracket-level-3]:=fg=69}
-: ${FAST_HIGHLIGHT_STYLES[freeglobal-alias]:=bg=19}
-: ${FAST_HIGHLIGHT_STYLES[freesubcommand]:=fg=150}
-: ${FAST_HIGHLIGHT_STYLES[freesingle-sq-bracket]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freedouble-sq-bracket]:=fg=180}
-: ${FAST_HIGHLIGHT_STYLES[freedouble-paren]:=fg=150}
-: ${FAST_HIGHLIGHT_STYLES[freeoptarg-string]:=fg=150}
+: ${FAST_HIGHLIGHT_STYLES[freematherr]:=fg=red}
+: ${FAST_HIGHLIGHT_STYLES[freemathnum]:=fg=166}
+: ${FAST_HIGHLIGHT_STYLES[freemathvar]:=fg=blue,bold}
: ${FAST_HIGHLIGHT_STYLES[freeoptarg-number]:=fg=166}
+: ${FAST_HIGHLIGHT_STYLES[freeoptarg-string]:=fg=150}
+: ${FAST_HIGHLIGHT_STYLES[freepaired-bracket]:=bg=blue}
+: ${FAST_HIGHLIGHT_STYLES[freepath_pathseparator]:=}
+: ${FAST_HIGHLIGHT_STYLES[freepath-to-dir]:=fg=166,underline}
+: ${FAST_HIGHLIGHT_STYLES[freepath]:=fg=166}
+: ${FAST_HIGHLIGHT_STYLES[freeprecommand]:=fg=180}
: ${FAST_HIGHLIGHT_STYLES[freerecursive-base]:=fg=183}
+: ${FAST_HIGHLIGHT_STYLES[freeredirection]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freereserved-word]:=fg=150}
+: ${FAST_HIGHLIGHT_STYLES[freesecondary]:=zdharma}
+: ${FAST_HIGHLIGHT_STYLES[freesingle-hyphen-option]:=fg=110}
+: ${FAST_HIGHLIGHT_STYLES[freesingle-quoted-argument]:=fg=150}
+: ${FAST_HIGHLIGHT_STYLES[freesingle-sq-bracket]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freesubcommand]:=fg=150}
+: ${FAST_HIGHLIGHT_STYLES[freesubtle-bg]:=bg=18}
+: ${FAST_HIGHLIGHT_STYLES[freesubtle-separator]:=none}
+: ${FAST_HIGHLIGHT_STYLES[freesuffix-alias]:=fg=180}
+: ${FAST_HIGHLIGHT_STYLES[freeunknown-token]:=fg=red,bold}
+: ${FAST_HIGHLIGHT_STYLES[freevariable]:=none}
diff --git a/share/parse/parse.zsh b/share/parse/parse.zsh
new file mode 100755
index 0000000..27d2698
--- /dev/null
+++ b/share/parse/parse.zsh
@@ -0,0 +1,213 @@
+#!/usr/bin/env zsh
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+#
+# This file runs the highlighter on a specified file
+# i.e. parses the file with the highlighter. Outputs
+# running time (stderr) and resulting region_highlight
+# (file parse.out, or $2 if given).
+#
+# Can be also run in line-wise mode on own input (-o
+# option in $1), no region_highlight file then.
+
+0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
+0="${${(M)0:#/*}:-$PWD/$0}"
+
+ZSH_BIN="$(which zsh)"
+SET_FPATH="${0:h}/../../functions"
+[[ -z "$FAST_WORK_DIR" ]] && FAST_WORK_DIR="${0:h}"
+[[ -z "$ZSH_VERSION" ]] && exec $ZSH_BIN zsh -f -c "source \"$0\" \"$1\" \"$2\" \"$3\""
+
+if [[ ! -e "$FAST_WORK_DIR/secondary_theme.zsh" ]]; then
+ cp -f "${0:h}/../free_theme.zsh" "$FAST_WORK_DIR/secondary_theme.zsh"
+fi
+
+if [[ -e "$SET_FPATH/fast-highlight" ]]; then
+ source "$SET_FPATH/fast-highlight"
+ source "$SET_FPATH/fast-string-highlight"
+ fpath+=( "$SET_FPATH" )
+else
+ print -u2 "Could not find fast-highlight, aborting"
+ exit 1
+fi
+
+zmodload zsh/zprof
+autoload is-at-least chroma/-git.ch
+builtin setopt interactive_comments extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd
+
+# Own input?
+if [[ "$1" = "-o" || "$1" = "-oo" || "$1" = "-ooo" || "$1" = "-git" || "$1" = "-hue" || "$1" = "-hol" ]]; then
+ typeset -a input
+ input=()
+ if [[ "$1" = "-o" ]]; then
+ input+=( "./parse.zsh ../functions/fast-highlight parse2.out" )
+ input+=( "rm -f parse*.out" )
+ input+=( "./mh-parse.zsh ../functions/fast-highlight > out" )
+ input+=( "if [[ -o multibyte ]]; then echo multibyte is set; fi" )
+ input+=( "[[ \"a\" = *[[:alpha:]_-][[:alpha:]]# ]] && echo yes" )
+ input+=( 'git tag -a v0.98 -m "Syntax highlighting of the history entries"' )
+ input+=( 'func() { echo "a" >! phist2.db; echo "b" >>! phist2.db; fc -Rap "phist2.db"; list=( ${history[@]} ); echo "${history[1]}"; }' )
+ (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "${(F)input}"; return 0; }
+ elif [[ "$1" = "-oo" ]]; then
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
+ (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "${(F)input}"; return 0; }
+ elif [[ "$1" = "-ooo" ]]; then
+ local in='
+# This is an example code that is diverse and allows to test a theme
+text="An example quite long string $with variable in it"
+local param1="text $variable" param2='"'"'other $variable'"'"'
+math=$(( 10 + HISTSIZ + HISTSIZE + $SAVEHIST )) size=$(( 0 ))
+
+for (( ii = 1; ii <= size; ++ ii )); do
+ if [[ "${cmds[ii]} string" = "| string" ]]
+ then
+ sidx=${buffer[(in:ii:)\$\(?#[^\\\\]\)]} # find opening $(
+ (( sidx <= len )) && {
+ eidx=${buffer[(b:sidx:ii)[^\\\\]\)]} # find closing )
+ }
+ fi
+done'
+ (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
+ input+=( "$in" )
+ input+=( "$in" )
+ elif [[ "$1" = "-git" ]]; then
+ local in="git lp
+git push origin main
+git commit
+git add safari.ini zdharma.ini
+git st .
+git diff --cached
+git commit --allow-empty
+git checkout themes/zdharma.ini
+git commit --amend
+git commit -m \"Example commit message\"
+git tag -a 'v1.18' -m 'Here-string is highlighted, descriptor-variables passed to exec are correctly highlighted'
+git tag -l -n9
+git checkout cb66b11
+"
+ (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
+ input+=( "$in" )
+ input+=( "$in" )
+ elif [[ "$1" = "-hue" ]]; then
+ local in="var=\$other; local var=\$other
+ () { eval \"\$var\"; }
+ case \$other in
+ \$var)
+ ( echo OK; )
+ ;;
+ esac
+ sudo -i -s ls -1 /var/log
+ () { ( eval \"command ls -1\" ); } argument"
+
+ (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
+
+ input+=( "$in" "$in" )
+ elif [[ "$1" = "-hol" ]]; then
+ local in="var=\$( other )
+local var2=\$(( other + 1 ))
+() { eval \"\$var\"; }
+sudo -i -s ls -1 >/tmp/ls-log.txt /var/log
+IFS=\$'\\n' print -rl -- \$(command ls -1 | tee -a /tmp/ls-1.txt)
+var3=\$(( HISTSIZE + 10 + \$var ))
+local var4=\$( other command )
+touch \$(( HISTSIZE + \$SAVEHIST + 10 ))
+case \$other in
+ \$var)
+ ( echo OK; )
+ ;;
+ \$var3)
+ ( if { true } { noglob echo yes } )
+esac
+( builtin cd /var/log; ls -1; noglob cd \"/var/log\" 'log' )
+noglob cat <<<\"\$PATH\" | tr : \"\\n\"
+if [[ \"\$var\" -gt 10 ]]; then
+ (( var = HISTSIZE + \$SAVEHIST ))
+fi
+/var/log
+sidx=\${buffer[(in:ii:)\\\$\\(?#[^\\\\\\\\]\\)]} # find opening cmd-subst
+{
+ exec {MYFD}<&0 {MYFD2}>&1
+ ( read <&\$MYFD line; echo \$line >&\$MYFD2 && { builtin print \${match[1]}Written. } )
+} always {
+ (( MYFD > 0 )) && { print -rl -- -myfd:\$MYFD >&\$MYFD2 && print \"Sent.\" '(to filedescriptor)'; }
+}
+command sleep \"\$(( \$a + b + \${cde} + \${(s::)fgh[ijk]} + \\\$l + \\m + \\\" ))\"
+for (( i = 0; i <= 2; ++ i )) { print \$i; }
+"
+
+ (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
+
+ input+=( "$in" )
+ fi
+
+ typeset -a long_input
+ integer i
+ for (( i=1; i<= 50; i ++ )); do
+ long_input+=( "${input[@]}" )
+ done
+
+ typeset -F SECONDS
+ SECONDS=0
+
+ local right_brace_is_recognised_everywhere
+ integer path_dirs_was_set multi_func_def ointeractive_comments
+ -fast-highlight-fill-option-variables
+
+ local BUFFER
+ for BUFFER in "${long_input[@]}"; do
+ reply=( )
+ () {
+ -fast-highlight-init
+ -fast-highlight-process "" "$BUFFER" "0"
+ -fast-highlight-string-process "" "$BUFFER"
+ }
+ done
+
+ print "Running time: $SECONDS"
+ zprof | head
+# File input?
+elif [[ -r "$1" ]]; then
+ # Load from given file
+ local BUFFER="$(<$1)"
+
+ typeset -F SECONDS
+ SECONDS=0
+
+ reply=( )
+ -fast-highlight-init
+
+ local right_brace_is_recognised_everywhere
+ integer path_dirs_was_set multi_func_def ointeractive_comments
+ -fast-highlight-fill-option-variables
+
+ () {
+ -fast-highlight-process "" "$BUFFER" "0"
+ -fast-highlight-string-process "" "$BUFFER"
+ }
+
+ print "Running time: $SECONDS"
+ zprof | head
+
+ # This output can be diffed to detect changes in operation
+ if [[ -z "$2" ]]; then
+ print -rl -- "${reply[@]}" >! out.parse
+ else
+ print -rl -- "${reply[@]}" >! "$2"
+ fi
+else
+ if [[ -z "$1" ]]; then
+ print -u2 "Usage: fast-parse {to-parse file} [region_highlight output file]"
+ exit 2
+ else
+ print -u2 "Unreadable to-parse file \`$1', aborting"
+ exit 3
+ fi
+fi
+
+exit 0
diff --git a/share/test/to-parse.zsh b/share/parse/to-parse.zsh
old mode 100644
new mode 100755
similarity index 99%
rename from share/test/to-parse.zsh
rename to share/parse/to-parse.zsh
index 5ed22b6..4b6feda
--- a/share/test/to-parse.zsh
+++ b/share/parse/to-parse.zsh
@@ -245,7 +245,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
# word delimiters (an improvised array); [[ $x == *:foo:* ]] and x=${x//:foo:/}
# will DTRT regardless of how many elements or repetitions $x has..
#
- # Handling of redirections: upon seeing a redirection token, we must stall
+ # Handling of redirection: upon seeing a redirection token, we must stall
# the current state --- that is, the value of $this_word --- for two iterations
# (one for the redirection operator, one for the word following it representing
# the redirection target). Therefore, we set $in_redirection to 2 upon seeing a
diff --git a/share/test/out.parse b/share/test/out.parse
deleted file mode 100644
index 9075bec..0000000
--- a/share/test/out.parse
+++ /dev/null
@@ -1,1920 +0,0 @@
-0 99 fg=black,bold
-100 162 fg=black,bold
-163 185 fg=black,bold
-186 187 fg=black,bold
-188 284 fg=black,bold
-285 334 fg=black,bold
-335 336 fg=black,bold
-337 436 fg=black,bold
-437 471 fg=black,bold
-472 563 fg=black,bold
-564 661 fg=black,bold
-662 689 fg=black,bold
-690 789 fg=black,bold
-790 887 fg=black,bold
-888 912 fg=black,bold
-913 914 fg=black,bold
-915 1011 fg=black,bold
-1012 1110 fg=black,bold
-1111 1203 fg=black,bold
-1204 1303 fg=black,bold
-1304 1403 fg=black,bold
-1404 1504 fg=black,bold
-1505 1604 fg=black,bold
-1605 1686 fg=black,bold
-1687 1786 fg=black,bold
-1787 1869 fg=black,bold
-1870 1896 fg=black,bold
-1897 1996 fg=black,bold
-1998 2005 fg=green
-2053 2077 fg=black,bold
-2078 2085 fg=green
-2112 2113 fg=green
-2114 2153 fg=113
-2154 2155 fg=green
-2156 2208 fg=113
-2209 2210 fg=green
-2211 2261 fg=113
-2262 2263 fg=green
-2264 2305 fg=113
-2306 2307 fg=green
-2308 2356 fg=113
-2357 2358 fg=green
-2359 2402 fg=113
-2403 2404 fg=green
-2405 2449 fg=113
-2450 2451 fg=green
-2452 2495 fg=113
-2496 2497 fg=green
-2498 2544 fg=113
-2545 2546 fg=green
-2547 2595 fg=113
-2596 2597 fg=green
-2598 2648 fg=113
-2649 2650 fg=green
-2651 2693 fg=113
-2694 2695 fg=green
-2696 2742 fg=113
-2743 2744 fg=green
-2745 2794 fg=113
-2795 2796 fg=green
-2797 2850 fg=113
-2851 2852 fg=green
-2853 2901 fg=113
-2902 2903 fg=green
-2904 2961 fg=113
-2962 2963 fg=green
-2964 3016 fg=113
-3017 3018 fg=green
-3019 3071 fg=113
-3072 3073 fg=green
-3074 3126 fg=113
-3127 3128 fg=green
-3129 3188 fg=113
-3189 3190 fg=green
-3191 3250 fg=113
-3251 3252 fg=green
-3253 3312 fg=113
-3313 3314 fg=green
-3315 3379 fg=113
-3380 3381 fg=green
-3382 3444 fg=113
-3445 3446 fg=green
-3447 3509 fg=113
-3510 3511 fg=green
-3512 3550 fg=113
-3551 3552 fg=green
-3553 3596 fg=113
-3597 3598 fg=green
-3599 3647 fg=113
-3649 3677 fg=black,bold
-3678 3679 fg=black,bold
-3680 3746 fg=black,bold
-3747 3786 fg=black,bold
-3787 3788 fg=black,bold
-3789 3815 fg=black,bold
-3816 3817 fg=black,bold
-3818 3855 fg=black,bold
-3881 3883 fg=yellow
-3884 3885 fg=yellow
-3888 3890 fg=yellow
-3891 3893 fg=yellow
-3894 3937 fg=cyan
-3938 3940 fg=yellow
-3942 3946 fg=yellow
-3957 4006 fg=cyan
-4011 4013 fg=yellow
-4014 4016 fg=green
-4017 4019 fg=cyan
-4020 4028 fg=yellow
-4021 4027 fg=cyan
-4029 4031 fg=green
-4033 4037 fg=yellow
-4044 4050 fg=green
-4055 4057 fg=yellow
-4060 4062 fg=yellow
-4065 4067 fg=yellow
-4068 4070 fg=yellow
-4071 4072 fg=cyan
-4073 4087 fg=red
-4088 4090 fg=yellow
-4092 4096 fg=yellow
-4101 4107 fg=green
-4121 4136 fg=113
-4140 4142 fg=yellow
-4145 4150 fg=green
-4159 4161 fg=yellow
-4162 4170 fg=green
-4171 4173 fg=cyan
-4189 4193 fg=yellow
-4198 4200 fg=yellow
-4201 4203 fg=yellow
-4204 4220 fg=red
-4221 4223 fg=yellow
-4225 4229 fg=yellow
-4252 4256 fg=yellow
-4257 4259 fg=yellow
-4260 4283 fg=red
-4284 4286 fg=yellow
-4288 4292 fg=yellow
-4305 4319 fg=yellow
-4324 4328 fg=yellow
-4329 4331 fg=yellow
-4332 4349 fg=cyan
-4350 4352 fg=yellow
-4354 4358 fg=yellow
-4384 4388 fg=yellow
-4389 4391 fg=yellow
-4392 4410 fg=red
-4411 4413 fg=yellow
-4415 4419 fg=yellow
-4445 4449 fg=yellow
-4450 4452 fg=yellow
-4453 4470 fg=red
-4471 4473 fg=yellow
-4475 4479 fg=yellow
-4504 4508 fg=yellow
-4509 4511 fg=yellow
-4512 4529 fg=red
-4530 4532 fg=yellow
-4534 4538 fg=yellow
-4563 4637 fg=black,bold
-4642 4714 fg=black,bold
-4719 4790 fg=black,bold
-4795 4864 fg=black,bold
-4869 4870 fg=black,bold
-4875 4945 fg=black,bold
-4950 4954 fg=yellow
-4955 4956 fg=yellow
-4958 4960 fg=green
-4961 4963 fg=113
-4964 4966 fg=blue,bold
-4967 4970 fg=blue,bold
-4971 4973 fg=green
-4977 4988 fg=green
-4993 4994 fg=yellow
-5007 5008 fg=yellow
-5009 5016 fg=green
-5017 5021 fg=green
-5022 5024 fg=cyan
-5025 5027 fg=cyan
-5028 5030 fg=113
-5032 5041 fg=magenta
-5048 5052 fg=yellow
-5074 5076 fg=yellow
-5079 5081 fg=yellow
-5084 5086 fg=yellow
-5087 5088 fg=yellow
-5089 5091 fg=yellow
-5092 5099 fg=cyan
-5100 5102 fg=yellow
-5104 5108 fg=yellow
-5119 5173 fg=yellow
-5120 5121 fg=cyan
-5122 5123 fg=cyan
-5152 5154 fg=cyan
-5176 5178 fg=yellow
-5181 5183 fg=yellow
-5184 5186 fg=yellow
-5187 5230 fg=cyan
-5231 5233 fg=yellow
-5235 5239 fg=yellow
-5293 5299 fg=cyan
-5302 5304 fg=yellow
-5305 5306 fg=yellow
-5308 5375 fg=black,bold
-5376 5410 fg=black,bold
-5441 5443 fg=yellow
-5444 5445 fg=yellow
-5448 5479 fg=black,bold
-5482 5530 fg=black,bold
-5533 5570 fg=black,bold
-5573 5626 fg=black,bold
-5629 5631 fg=green
-5632 5634 fg=113
-5638 5654 fg=blue,bold
-5655 5657 fg=green
-5661 5663 fg=green
-5664 5666 fg=113
-5667 5669 fg=blue,bold
-5670 5685 fg=blue,bold
-5686 5688 fg=green
-5689 5690 fg=yellow
-5692 5708 fg=black,bold
-5709 5710 fg=black,bold
-5711 5737 fg=black,bold
-5738 5739 fg=black,bold
-5740 5777 fg=black,bold
-5807 5809 fg=yellow
-5810 5811 fg=yellow
-5814 5816 fg=yellow
-5817 5825 fg=green
-5844 5848 fg=yellow
-5859 5875 fg=cyan
-5878 5882 fg=yellow
-5893 5897 fg=yellow
-5894 5895 fg=cyan
-5897 5898 fg=cyan
-5908 5912 fg=cyan
-5922 5924 fg=yellow
-5925 5926 fg=yellow
-5928 6006 fg=black,bold
-6007 6071 fg=black,bold
-6072 6073 fg=black,bold
-6074 6132 fg=black,bold
-6133 6174 fg=black,bold
-6200 6202 fg=yellow
-6203 6204 fg=yellow
-6207 6209 fg=yellow
-6210 6212 fg=green
-6213 6229 fg=113
-6233 6235 fg=113
-6236 6238 fg=green
-6240 6244 fg=yellow
-6262 6279 fg=cyan
-6284 6288 fg=green
-6289 6293
-6290 6292
-6296 6300 fg=yellow
-6327 6329 fg=yellow
-6330 6331 fg=yellow
-6333 6369 fg=black,bold
-6393 6395 fg=yellow
-6396 6397 fg=yellow
-6400 6476 fg=black,bold
-6479 6481 fg=yellow
-6482 6484 fg=green
-6509 6511 fg=green
-6513 6517 fg=yellow
-6522 6527 fg=green
-6550 6564 fg=black,bold
-6567 6569 fg=yellow
-6572 6574 fg=yellow
-6575 6577 fg=green
-6595 6597 fg=green
-6601 6605 fg=green
-6606 6648
-6607 6609
-6610 6612
-6613 6632
-6633 6635
-6636 6638
-6638 6647
-6650 6654 fg=yellow
-6659 6664 fg=green
-6710 6714 fg=yellow
-6719 6724 fg=green
-6769 6771 fg=yellow
-6774 6776 fg=yellow
-6777 6779 fg=green
-6793 6795 fg=green
-6797 6801 fg=yellow
-6806 6813 fg=green
-6836 6840 fg=yellow
-6845 6852 fg=green
-6875 6877 fg=yellow
-6880 6882 fg=yellow
-6883 6885 fg=green
-6904 6906 fg=green
-6908 6912 fg=yellow
-6917 6924 fg=green
-6944 6948 fg=yellow
-6953 6960 fg=green
-6980 6982 fg=yellow
-6985 6992 fg=green
-7002 7008 fg=green
-7051 7095 fg=black,bold
-7098 7103 fg=green
-7156 7161 fg=green
-7188 7229 fg=black,bold
-7232 7239 fg=green
-7286 7293 fg=green
-7335 7342 fg=green
-7385 7390 fg=green
-7409 7426 fg=black,bold
-7429 7434 fg=green
-7439 7443 fg=yellow
-7440 7442 fg=cyan
-7446 7453 fg=green
-7458 7467 fg=yellow
-7459 7466 fg=cyan
-7470 7477 fg=green
-7497 7579 fg=black,bold
-7583 7588 fg=green
-7602 7648 fg=black,bold
-7652 7654 fg=yellow
-7655 7657 fg=yellow
-7658 7675 fg=blue,bold
-7676 7678 fg=yellow
-7680 7684 fg=yellow
-7705 7706 fg=green
-7717 7718 fg=green
-7721 7723 fg=yellow
-7726 7731 fg=green
-7794 7795 fg=green
-7800 7803 fg=yellow
-7804 7808 fg=yellow
-7809 7812 fg=yellow
-7813 7816 fg=yellow
-7817 7821 fg=yellow
-7826 7830 fg=yellow
-7835 7839 fg=yellow
-7840 7844 fg=yellow
-7849 7913 fg=black,bold
-7918 7934 fg=black,bold
-7937 7938 fg=green
-7977 7978 fg=green
-7983 7992 fg=yellow
-7993 8002 fg=yellow
-8003 8009 fg=yellow
-8010 8021 fg=yellow
-8022 8030 fg=yellow
-8035 8043 fg=yellow
-8044 8107 fg=black,bold
-8110 8111 fg=green
-8115 8189 fg=black,bold
-8192 8255 fg=black,bold
-8295 8296 fg=green
-8301 8308 fg=yellow
-8303 8307 fg=cyan
-8309 8316 fg=black,bold
-8321 8328 fg=yellow
-8323 8327 fg=cyan
-8329 8339 fg=black,bold
-8344 8348 fg=yellow
-8349 8369 fg=black,bold
-8374 8381 fg=yellow
-8386 8393 fg=yellow
-8398 8402 fg=yellow
-8407 8413 fg=yellow
-8418 8424 fg=yellow
-8429 8435 fg=yellow
-8440 8444 fg=yellow
-8449 8455 fg=yellow
-8460 8468 fg=yellow
-8473 8476 fg=yellow
-8477 8520 fg=black,bold
-8523 8524 fg=green
-8528 8533 fg=green
-8558 8573 fg=black,bold
-8576 8577 fg=black,bold
-8580 8597 fg=black,bold
-8600 8629 fg=black,bold
-8632 8701 fg=black,bold
-8704 8779 fg=black,bold
-8782 8858 fg=black,bold
-8861 8915 fg=black,bold
-8918 8994 fg=black,bold
-8997 9070 fg=black,bold
-9073 9147 fg=black,bold
-9150 9151 fg=black,bold
-9154 9233 fg=black,bold
-9236 9313 fg=black,bold
-9316 9394 fg=black,bold
-9397 9414 fg=black,bold
-9417 9418 fg=black,bold
-9421 9500 fg=black,bold
-9503 9582 fg=black,bold
-9585 9652 fg=black,bold
-9655 9656 fg=black,bold
-9659 9733 fg=black,bold
-9736 9815 fg=black,bold
-9818 9897 fg=black,bold
-9900 9980 fg=black,bold
-9983 10063 fg=black,bold
-10066 10145 fg=black,bold
-10148 10224 fg=black,bold
-10227 10302 fg=black,bold
-10305 10328 fg=black,bold
-10331 10332 fg=black,bold
-10335 10413 fg=black,bold
-10416 10483 fg=black,bold
-10486 10563 fg=black,bold
-10566 10594 fg=black,bold
-10597 10598 fg=black,bold
-10601 10606 fg=green
-10617 10626 fg=yellow
-10639 10646 fg=green
-10664 10683 fg=black,bold
-10686 10691 fg=green
-10701 10707 fg=yellow
-10702 10706 fg=cyan
-10710 10713 fg=yellow
-10721 10754 fg=113
-10770 10807 fg=113
-10809 10811 fg=yellow
-10816 10840 fg=black,bold
-10845 10847 fg=yellow
-10848 10850 fg=yellow
-10851 10865 fg=blue,bold
-10866 10868 fg=yellow
-10870 10874 fg=yellow
-10881 10883 fg=yellow
-10886 10900 fg=blue,bold
-10901 10903 fg=yellow
-10908 10910 fg=yellow
-10915 10917 fg=yellow
-10918 10920 fg=yellow
-10921 10935 fg=blue,bold
-10939 10940 fg=magenta
-10941 10943 fg=yellow
-10945 10949 fg=yellow
-10956 11001 fg=black,bold
-11018 11029 fg=yellow
-11034 11038 fg=yellow
-11045 11064 fg=black,bold
-11069 11071 fg=yellow
-11077 11134 fg=black,bold
-11139 11140 fg=black,bold
-11145 11190 fg=black,bold
-11195 11241 fg=black,bold
-11246 11329 fg=black,bold
-11334 11399 fg=black,bold
-11404 11405 fg=black,bold
-11410 11485 fg=black,bold
-11490 11560 fg=black,bold
-11565 11639 fg=black,bold
-11644 11665 fg=black,bold
-11670 11677 fg=green
-11722 11724 fg=yellow
-11725 11727 fg=green
-11728 11738 fg=113
-11743 11752 fg=yellow
-11754 11756 fg=green
-11758 11762 fg=yellow
-11801 11803 fg=yellow
-11804 11806 fg=green
-11807 11811 fg=113
-11815 11823 fg=yellow
-11824 11826 fg=green
-11828 11832 fg=yellow
-11868 11870 fg=yellow
-11875 11877 fg=yellow
-11883 11959 fg=black,bold
-11964 11966 fg=yellow
-11967 11969 fg=green
-11970 11974 fg=113
-11978 11981 fg=yellow
-11982 11984 fg=green
-11987 11991 fg=yellow
-11998 12066 fg=black,bold
-12073 12142 fg=black,bold
-12149 12156 fg=black,bold
-12163 12164 fg=black,bold
-12171 12240 fg=black,bold
-12247 12313 fg=black,bold
-12320 12388 fg=black,bold
-12395 12418 fg=black,bold
-12425 12430 fg=green
-12439 12446 fg=yellow
-12453 12460 fg=green
-12468 12469 fg=cyan
-12472 12495 fg=cyan
-12498 12499 fg=magenta
-12469 12471 fg=yellow
-12500 12502 fg=yellow
-12461 12502
-12509 12511 fg=yellow
-12512 12521 fg=blue,bold
-12525 12531 fg=blue,bold
-12532 12534 fg=yellow
-12541 12543 fg=yellow
-12544 12551 fg=blue,bold
-12554 12563 fg=blue,bold
-12566 12567 fg=cyan
-12568 12571 fg=blue,bold
-12572 12574 fg=yellow
-12579 12583 fg=yellow
-12590 12605 fg=black,bold
-12612 12613 fg=black,bold
-12620 12703 fg=black,bold
-12710 12711 fg=black,bold
-12718 12804 fg=black,bold
-12811 12897 fg=black,bold
-12904 12983 fg=black,bold
-12990 13077 fg=black,bold
-13084 13154 fg=black,bold
-13161 13207 fg=black,bold
-13214 13216 fg=yellow
-13217 13219 fg=green
-13220 13231 fg=yellow
-13221 13230 fg=cyan
-13234 13274 fg=13
-13275 13277 fg=green
-13279 13283 fg=yellow
-13294 13324 fg=black,bold
-13335 13342 fg=green
-13350 13364 fg=yellow
-13351 13363 fg=cyan
-13371 13375 fg=yellow
-13386 13393 fg=green
-13409 13411 fg=yellow
-13418 13420 fg=yellow
-13420 13429 fg=blue,bold
-13431 13437 fg=blue,bold
-13437 13439 fg=yellow
-13446 13448 fg=yellow
-13448 13455 fg=blue,bold
-13456 13466 fg=cyan
-13467 13474 fg=cyan
-13474 13476 fg=yellow
-13481 13483 fg=yellow
-13489 13531 fg=black,bold
-13536 13578 fg=black,bold
-13583 13627 fg=black,bold
-13632 13677 fg=black,bold
-13682 13683 fg=black,bold
-13688 13737 fg=black,bold
-13742 13787 fg=black,bold
-13792 13800 fg=black,bold
-13805 13806 fg=black,bold
-13811 13868 fg=black,bold
-13873 13926 fg=black,bold
-13931 13983 fg=black,bold
-13988 14040 fg=black,bold
-14045 14099 fg=black,bold
-14104 14153 fg=black,bold
-14158 14159 fg=black,bold
-14164 14213 fg=black,bold
-14227 14264 fg=yellow
-14228 14263 fg=cyan
-14270 14311 fg=black,bold
-14316 14317 fg=black,bold
-14322 14403 fg=black,bold
-14408 14410 fg=yellow
-14411 14413 fg=green
-14440 14445 fg=yellow
-14450 14457 fg=113
-14461 14474 fg=113
-14475 14477 fg=green
-14479 14483 fg=yellow
-14490 14492 fg=yellow
-14493 14495 fg=green
-14496 14506 fg=113
-14512 14523 fg=yellow
-14524 14533 fg=yellow
-14536 14538 fg=green
-14540 14544 fg=yellow
-14573 14577 fg=yellow
-14606 14630 fg=black,bold
-14637 14639 fg=yellow
-14646 14665 fg=red,bold
-14666 14676 fg=113
-14677 14685 fg=113
-14686 14692 fg=113
-14721 14729 fg=green
-14734 14736 fg=yellow
-14742 14769 fg=black,bold
-14774 14776 fg=yellow
-14777 14807 fg=green
-14808 14812 fg=113
-14815 14819 fg=yellow
-14826 14870 fg=black,bold
-14898 14900 fg=yellow
-14906 14949 fg=black,bold
-14954 14956 fg=yellow
-14957 14959 fg=yellow
-14962 14976 fg=blue,bold
-14977 14979 fg=yellow
-14981 14985 fg=yellow
-14992 14994 fg=yellow
-14995 14997 fg=green
-14998 15008 fg=113
-15013 15025 fg=yellow
-15027 15029 fg=green
-15033 15035 fg=green
-15036 15040 fg=113
-15041 15043 fg=blue,bold
-15047 15049 fg=green
-15051 15055 fg=yellow
-15074 15075 fg=cyan
-15106 15108 fg=yellow
-15113 15115 fg=yellow
-15121 15150 fg=black,bold
-15155 15157 fg=yellow
-15158 15160 fg=yellow
-15163 15177 fg=blue,bold
-15178 15180 fg=yellow
-15182 15186 fg=yellow
-15193 15195 fg=yellow
-15196 15198 fg=green
-15199 15209 fg=113
-15214 15226 fg=yellow
-15228 15230 fg=green
-15232 15236 fg=yellow
-15245 15249 fg=yellow
-15250 15256 fg=green
-15257 15259 fg=yellow
-15270 15302 fg=red,bold
-15313 15324 bg=blue
-15324 15325 fg=yellow
-15336 15337 fg=cyan
-15393 15405 fg=yellow
-15418 15473 fg=red,bold
-15484 15488 bg=blue
-15488 15489 fg=yellow
-15507 15508 fg=cyan
-15565 15574 fg=yellow
-15610 15622 fg=yellow
-15635 15636 bg=blue
-15636 15637 fg=yellow
-15659 15663 fg=yellow
-15670 15674 fg=yellow
-15675 15677 fg=green
-15678 15688 fg=113
-15693 15705 fg=yellow
-15707 15709 fg=green
-15711 15715 fg=yellow
-15735 15747 fg=yellow
-15767 15776 fg=yellow
-15783 15785 fg=yellow
-15789 15791 fg=yellow
-15796 15866 fg=black,bold
-15870 15872 fg=yellow
-15873 15875 fg=green
-15876 15886 fg=113
-15891 15901 fg=yellow
-15906 15910 fg=113
-15914 15922 fg=yellow
-15923 15925 fg=green
-15927 15931 fg=yellow
-15937 15959 fg=black,bold
-15985 16033 fg=black,bold
-16049 16058 fg=yellow
-16062 16066 fg=yellow
-16067 16069 fg=green
-16070 16080 fg=113
-16085 16094 fg=yellow
-16096 16098 fg=green
-16102 16104 fg=yellow
-16105 16119 fg=blue,bold
-16123 16124 fg=magenta
-16125 16127 fg=yellow
-16129 16133 fg=yellow
-16134 16160 fg=black,bold
-16166 16168 fg=yellow
-16169 16171 fg=green
-16217 16223 fg=yellow
-16218 16222 fg=cyan
-16225 16227 fg=green
-16229 16233 fg=yellow
-16262 16266 fg=yellow
-16267 16269 fg=green
-16270 16276 fg=yellow
-16271 16275 fg=cyan
-16279 16285 fg=yellow
-16286 16288 fg=green
-16290 16294 fg=yellow
-16334 16335 fg=cyan
-16376 16388 fg=yellow
-16406 16415 fg=yellow
-16421 16425 fg=yellow
-16432 16459 fg=red,bold
-16460 16464 fg=113
-16471 16476 fg=green
-16490 16498 fg=yellow
-16491 16497 fg=cyan
-16505 16530 fg=green
-16531 16546 fg=113
-16553 16558 fg=green
-16563 16571 fg=yellow
-16564 16570 fg=cyan
-16578 16580 fg=yellow
-16581 16582 fg=yellow
-16591 16669 fg=black,bold
-16678 16679 fg=black,bold
-16688 16771 fg=black,bold
-16780 16863 fg=black,bold
-16872 16955 fg=black,bold
-16964 17025 fg=black,bold
-17034 17039 fg=green
-17069 17074 fg=green
-17082 17089 fg=green
-17110 17112 fg=yellow
-17113 17115 fg=green
-17116 17120 fg=113
-17129 17131 fg=green
-17135 17137 fg=yellow
-17138 17152 fg=cyan
-17153 17155 fg=yellow
-17170 17172 fg=green
-17173 17182 fg=113
-17189 17191 fg=green
-17195 17197 fg=green
-17198 17206 fg=113
-17209 17250 fg=13
-17251 17253 fg=green
-17268 17270 fg=yellow
-17271 17295 fg=red
-17296 17298 fg=yellow
-17310 17314 fg=yellow
-17325 17350 fg=green
-17351 17362 fg=113
-17377 17383 fg=cyan
-17392 17394 fg=yellow
-17401 17402 fg=yellow
-17409 17413 fg=yellow
-17414 17418 fg=green
-17419 17421 fg=yellow
-17430 17438 bg=blue
-17438 17439 fg=yellow
-17446 17461 fg=black,bold
-17530 17532 fg=yellow
-17533 17535 fg=green
-17536 17540 fg=113
-17544 17551 fg=yellow
-17546 17550 fg=cyan
-17552 17554 fg=green
-17556 17560 fg=yellow
-17600 17603 fg=yellow
-17643 17647 fg=yellow
-17648 17650 fg=green
-17651 17655 fg=113
-17659 17666 fg=yellow
-17661 17665 fg=cyan
-17667 17669 fg=green
-17671 17675 fg=yellow
-17702 17784 fg=black,bold
-17811 17836 fg=green
-17837 17840 fg=yellow
-17887 17889 fg=yellow
-17890 17892 fg=green
-17893 17899 fg=113
-17917 17919 fg=green
-17921 17925 fg=yellow
-17965 17975 fg=yellow
-18002 18004 fg=yellow
-18029 18031 fg=yellow
-18067 18081 bg=blue
-18081 18082 fg=yellow
-18112 18117 bg=blue
-18117 18118 fg=yellow
-18128 18130 fg=yellow
-18131 18132 fg=yellow
-18159 18166 fg=green
-18206 18210 fg=yellow
-18211 18215 fg=green
-18216 18218 fg=yellow
-18247 18291 fg=red,bold
-18320 18321 fg=red,bold
-18350 18374 fg=red,bold
-18403 18404 fg=red,bold
-18433 18490 fg=red,bold
-18519 18520 fg=yellow
-18520 18524 bg=blue
-18524 18525 fg=yellow
-18526 18527 fg=green
-18558 18589 fg=red,bold
-18618 18619 fg=yellow
-18619 18624 bg=blue
-18624 18625 fg=yellow
-18671 18691 fg=red,bold
-18720 18721 fg=yellow
-18721 18722 bg=blue
-18722 18723 fg=yellow
-18724 18725 fg=green
-18754 18758 fg=yellow
-18785 18787 fg=yellow
-18788 18790 fg=yellow
-18791 18803 fg=blue,bold
-18804 18806 fg=yellow
-18808 18812 fg=yellow
-18887 18891 fg=yellow
-18960 18989 fg=green
-18990 18994 fg=113
-19023 19028 fg=green
-19042 19050 fg=yellow
-19043 19049 fg=cyan
-19079 19081 fg=green
-19127 19142 fg=yellow
-19128 19141 fg=cyan
-19192 19198 fg=yellow
-19193 19197 fg=cyan
-19200 19202 fg=green
-19243 19244 fg=green
-19244 19248 fg=113
-19248 19249 fg=green
-19276 19278 fg=yellow
-19303 19304 fg=yellow
-19329 19331 fg=red,bold
-19340 19347 fg=green
-19347 19348 fg=red,bold
-19380 19388 fg=yellow
-19388 19389 fg=red,bold
-19421 19428 fg=green
-19428 19429 fg=red,bold
-19461 19467 fg=red,bold
-19467 19468 fg=red,bold
-19508 19512 fg=red,bold
-19512 19513 fg=red,bold
-19557 19561 fg=yellow
-19627 19629 fg=yellow
-19630 19632 fg=green
-19633 19641 fg=113
-19645 19648 fg=yellow
-19649 19651 fg=green
-19653 19657 fg=yellow
-19737 19741 fg=yellow
-19770 19805 fg=black,bold
-19834 19907 fg=black,bold
-19947 19956 fg=yellow
-19983 19985 fg=yellow
-20010 20014 fg=yellow
-20015 20017 fg=green
-20018 20027 fg=113
-20030 20045 fg=113
-20046 20048 fg=green
-20052 20054 fg=yellow
-20055 20056 fg=cyan
-20057 20060 fg=blue,bold
-20061 20062 fg=magenta
-20063 20064 fg=magenta
-20069 20070 fg=magenta
-20071 20073 fg=yellow
-20075 20079 fg=yellow
-20154 20158 fg=yellow
-20159 20161 fg=green
-20162 20171 fg=113
-20175 20190 fg=113
-20191 20193 fg=green
-20195 20199 fg=yellow
-20274 20278 fg=yellow
-20279 20281 fg=green
-20332 20338 fg=yellow
-20333 20337 fg=cyan
-20340 20342 fg=green
-20344 20348 fg=yellow
-20375 20377 fg=yellow
-20378 20380 fg=green
-20381 20391 fg=113
-20396 20407 fg=yellow
-20409 20411 fg=green
-20413 20417 fg=yellow
-20446 20519 fg=black,bold
-20548 20575 fg=black,bold
-20653 20657 fg=yellow
-20732 20734 fg=yellow
-20759 20763 fg=yellow
-20764 20766 fg=yellow
-20767 20781 fg=blue,bold
-20785 20786 fg=magenta
-20787 20789 fg=yellow
-20791 20795 fg=yellow
-20864 20868 fg=yellow
-20869 20871 fg=green
-20872 20881 fg=113
-20885 20889 fg=yellow
-20890 20892 fg=green
-20894 20898 fg=yellow
-20925 20949 fg=black,bold
-20976 20977 fg=black,bold
-21004 21073 fg=black,bold
-21100 21168 fg=black,bold
-21195 21264 fg=black,bold
-21291 21360 fg=black,bold
-21387 21388 fg=black,bold
-21415 21484 fg=black,bold
-21511 21550 fg=black,bold
-21623 21642 fg=red,bold
-21643 21653 fg=113
-21654 21655 fg=cyan
-21657 21666 fg=blue,bold
-21669 21670 fg=magenta
-21655 21657 fg=yellow
-21670 21672 fg=yellow
-21673 21679 fg=113
-21748 21750 fg=yellow
-21751 21753 fg=green
-21754 21765 fg=113
-21769 21773 fg=yellow
-21774 21776 fg=green
-21778 21782 fg=yellow
-21811 21830 fg=red,bold
-21831 21832 fg=cyan
-21834 21841 fg=blue,bold
-21844 21845 fg=magenta
-21832 21834 fg=yellow
-21845 21847 fg=yellow
-21848 21856 fg=113
-21857 21863 fg=113
-21934 21936 fg=yellow
-21961 21965 fg=yellow
-21966 21968 fg=green
-21969 21973 fg=113
-21977 21981 fg=yellow
-21982 21984 fg=green
-21986 21990 fg=yellow
-22017 22037 fg=black,bold
-22108 22112 fg=yellow
-22113 22115 fg=green
-22116 22120 fg=113
-22124 22131 fg=yellow
-22126 22130 fg=cyan
-22132 22134 fg=green
-22136 22140 fg=yellow
-22167 22177 fg=black,bold
-22263 22266 fg=yellow
-22306 22310 fg=yellow
-22337 22339 fg=yellow
-22340 22366 fg=red,bold
-22368 22372 fg=yellow
-22407 22413 fg=cyan
-22440 22444 fg=yellow
-22519 22521 fg=yellow
-22546 22548 fg=yellow
-22573 22575 fg=red,bold
-22584 22585 fg=red,bold
-22585 22586 fg=red,bold
-22620 22630 fg=113
-22631 22639 fg=113
-22734 22736 fg=red,bold
-22743 22747 fg=yellow
-22753 22755 fg=yellow
-22759 22761 fg=yellow
-22765 22767 fg=yellow
-22768 22770 fg=yellow
-22773 22786 fg=blue,bold
-22787 22789 fg=yellow
-22793 22795 fg=green
-22796 22802 fg=113
-22820 22822 fg=green
-22826 22870 fg=black,bold
-22877 22878 fg=yellow
-22879 22881 fg=yellow
-22882 22896 fg=blue,bold
-22897 22899 fg=yellow
-22903 22905 fg=green
-22906 22916 fg=113
-22921 22932 fg=yellow
-22934 22936 fg=green
-22940 22942 fg=green
-22943 22953 fg=113
-22958 22970 fg=yellow
-22972 22974 fg=green
-22978 22980 fg=green
-22981 22991 fg=113
-22996 23008 fg=yellow
-23010 23012 fg=green
-23013 23014 fg=yellow
-23018 23022 fg=yellow
-23023 23051 fg=black,bold
-23058 23062 fg=yellow
-23063 23067 fg=green
-23068 23070 fg=yellow
-23079 23086 bg=blue
-23086 23087 fg=yellow
-23088 23125 fg=black,bold
-23143 23145 fg=yellow
-23146 23166 fg=red,bold
-23168 23172 fg=yellow
-23280 23289 fg=yellow
-23307 23311 fg=yellow
-23331 23356 fg=green
-23357 23360 fg=yellow
-23398 23400 fg=yellow
-23411 23422 bg=blue
-23422 23423 fg=yellow
-23424 23456 fg=black,bold
-23474 23476 fg=yellow
-23477 23479 fg=yellow
-23480 23494 fg=blue,bold
-23495 23497 fg=yellow
-23501 23506 fg=green
-23507 23561 fg=black,bold
-23579 23583 fg=yellow
-23614 23623 fg=yellow
-23641 23643 fg=yellow
-23709 23716 bg=blue
-23716 23717 fg=yellow
-23718 23731 fg=black,bold
-23749 23750 fg=black,bold
-23768 23787 fg=black,bold
-23805 23806 fg=black,bold
-23824 23896 fg=black,bold
-23914 23994 fg=black,bold
-24012 24014 fg=yellow
-24015 24052 fg=red,bold
-24054 24058 fg=yellow
-24078 24103 fg=green
-24104 24107 fg=yellow
-24147 24149 fg=yellow
-24150 24152 fg=green
-24153 24159 fg=113
-24177 24179 fg=green
-24181 24185 fg=yellow
-24218 24228 fg=yellow
-24248 24250 fg=yellow
-24268 24272 fg=yellow
-24292 24339 fg=black,bold
-24357 24359 fg=yellow
-24388 24393 bg=blue
-24393 24394 fg=yellow
-24434 24438 bg=blue
-24438 24439 fg=yellow
-24480 24484 bg=blue
-24484 24485 fg=yellow
-24528 24532 bg=blue
-24532 24533 fg=yellow
-24583 24602 fg=red,bold
-24603 24613 fg=113
-24614 24622 fg=113
-24623 24629 fg=113
-24647 24669 fg=red,bold
-24731 24736 bg=blue
-24736 24737 fg=yellow
-24786 24805 fg=red,bold
-24806 24816 fg=113
-24817 24825 fg=113
-24826 24832 fg=113
-24850 24879 fg=red,bold
-24941 24945 bg=blue
-24945 24946 fg=yellow
-24987 24992 bg=blue
-24992 24993 bg=blue
-24993 25004 bg=blue
-25004 25005 fg=yellow
-25023 25038 fg=red,bold
-25084 25085 bg=blue
-25085 25086 fg=yellow
-25093 25095 fg=yellow
-25096 25101 fg=green
-25103 25107 fg=yellow
-25125 25129 fg=yellow
-25130 25132 fg=green
-25133 25137 fg=113
-25140 25147 fg=yellow
-25142 25146 fg=cyan
-25148 25150 fg=green
-25154 25191 fg=red,bold
-25193 25197 fg=yellow
-25217 25256 fg=black,bold
-25274 25278 fg=yellow
-25279 25281 fg=green
-25282 25291 fg=113
-25294 25309 fg=113
-25310 25312 fg=green
-25316 25318 fg=yellow
-25319 25320 fg=cyan
-25321 25324 fg=blue,bold
-25325 25326 fg=magenta
-25327 25328 fg=magenta
-25333 25334 fg=magenta
-25335 25337 fg=yellow
-25339 25343 fg=yellow
-25404 25408 fg=yellow
-25409 25411 fg=green
-25462 25468 fg=yellow
-25463 25467 fg=cyan
-25470 25472 fg=green
-25474 25478 fg=yellow
-25498 25500 fg=yellow
-25501 25503 fg=green
-25504 25514 fg=113
-25519 25530 fg=yellow
-25532 25534 fg=green
-25536 25540 fg=yellow
-25604 25608 fg=yellow
-25669 25671 fg=yellow
-25689 25693 fg=yellow
-25694 25696 fg=yellow
-25697 25711 fg=blue,bold
-25715 25716 fg=magenta
-25717 25719 fg=yellow
-25721 25725 fg=yellow
-25780 25784 fg=yellow
-25804 25806 fg=yellow
-25807 25833 fg=red,bold
-25835 25839 fg=yellow
-25867 25873 fg=cyan
-25893 25897 fg=yellow
-25952 25954 fg=yellow
-25972 25974 fg=yellow
-26001 26005 fg=yellow
-26010 26012 fg=yellow
-26017 26019 fg=yellow
-26020 26021 fg=yellow
-26022 26024 fg=yellow
-26025 26038 fg=blue,bold
-26039 26041 fg=yellow
-26043 26047 fg=yellow
-26054 26073 fg=red,bold
-26074 26084 fg=113
-26085 26093 fg=113
-26094 26100 fg=113
-26107 26109 fg=green
-26110 26116 fg=113
-26128 26134 fg=113
-26150 26152 fg=green
-26156 26187 fg=red,bold
-26192 26194 fg=yellow
-26199 26201 fg=yellow
-26202 26204 fg=green
-26255 26261 fg=yellow
-26256 26260 fg=cyan
-26263 26265 fg=green
-26267 26271 fg=yellow
-26278 26280 fg=yellow
-26281 26283 fg=green
-26284 26288 fg=113
-26292 26295 fg=yellow
-26296 26298 fg=green
-26302 26322 fg=red,bold
-26324 26328 fg=yellow
-26337 26381 fg=black,bold
-26400 26411 fg=yellow
-26418 26422 fg=yellow
-26441 26450 fg=yellow
-26485 26487 fg=yellow
-26492 26496 fg=yellow
-26504 26506 fg=green
-26553 26559 fg=yellow
-26554 26558 fg=cyan
-26564 26574 fg=113
-26579 26588 fg=yellow
-26590 26592 fg=green
-26603 26605 fg=green
-26651 26657 fg=yellow
-26652 26656 fg=cyan
-26662 26672 fg=113
-26677 26686 fg=yellow
-26688 26690 fg=green
-26692 26696 fg=yellow
-26713 26722 fg=yellow
-26727 26731 fg=yellow
-26732 26734 fg=green
-26735 26739 fg=113
-26743 26751 fg=yellow
-26755 26765 fg=113
-26770 26779 fg=yellow
-26781 26783 fg=green
-26785 26789 fg=yellow
-26796 26824 fg=black,bold
-26854 26919 fg=black,bold
-26926 26967 fg=black,bold
-26974 26975 fg=black,bold
-26982 27047 fg=black,bold
-27054 27123 fg=black,bold
-27130 27131 fg=black,bold
-27138 27204 fg=black,bold
-27221 27239 fg=yellow
-27244 27246 fg=yellow
-27261 27269 fg=cyan
-27274 27276 fg=yellow
-27277 27279 fg=yellow
-27280 27294 fg=blue,bold
-27298 27299 fg=magenta
-27300 27302 fg=yellow
-27304 27308 fg=yellow
-27315 27353 fg=black,bold
-27370 27380 fg=cyan
-27385 27389 fg=yellow
-27396 27415 fg=black,bold
-27420 27422 fg=yellow
-27425 27429 fg=yellow
-27430 27431 fg=yellow
-27433 27471 fg=black,bold
-27500 27502 fg=yellow
-27503 27504 fg=yellow
-27509 27515 fg=green
-27547 27549 fg=green
-27550 27554 fg=113
-27558 27599 fg=blue,bold
-27600 27602 fg=green
-27612 27614 fg=green
-27615 27619 fg=113
-27623 27638 fg=13
-27639 27641 fg=green
-27642 27643 fg=yellow
-27676 27678 fg=yellow
-27679 27680 fg=yellow
-27683 27688 fg=green
-27723 27731 fg=cyan
-27748 27750 fg=green
-27754 27794 fg=yellow
-27755 27793 fg=cyan
-27798 27830 fg=yellow
-27799 27829 fg=cyan
-27834 27874 fg=yellow
-27835 27873 fg=cyan
-27875 27877 fg=green
-27881 27887 fg=green
-27892 27895 fg=yellow
-27896 27898 fg=yellow
-27899 27902 none
-27905 27910 none
-27911 27914 none
-27903 27904 fg=yellow
-27914 27915 fg=yellow,bold
-27916 27920 fg=cyan
-27921 27923 fg=yellow
-27931 27932 fg=yellow,bold
-27933 27936 none
-27936 27938 fg=yellow
-27939 27941 fg=yellow
-27944 27946 fg=yellow
-27951 27953 fg=yellow
-27954 27956 fg=green
-27957 27968 fg=113
-27972 27975 fg=yellow
-27976 27978 fg=green
-27980 27984 fg=yellow
-27991 28010 fg=red,bold
-28011 28012 fg=cyan
-28014 28017 fg=blue,bold
-28020 28021 fg=magenta
-28012 28014 fg=yellow
-28021 28023 fg=yellow
-28024 28028 fg=113
-28029 28043 fg=113
-28048 28050 fg=yellow
-28053 28057 fg=yellow
-28058 28059 fg=yellow
-28061 28087 fg=black,bold
-28088 28138 fg=black,bold
-28139 28205 fg=black,bold
-28232 28234 fg=yellow
-28235 28236 fg=yellow
-28239 28266 fg=red,bold
-28267 28271 fg=113
-28275 28280 fg=green
-28295 28303 fg=yellow
-28296 28302 fg=cyan
-28321 28323 fg=green
-28327 28341 fg=113
-28342 28344 fg=green
-28348 28354 fg=green
-28359 28361 fg=green
-28365 28379 fg=113
-28380 28382 fg=green
-28386 28392 fg=green
-28397 28399 fg=green
-28403 28417 fg=113
-28418 28420 fg=green
-28424 28430 fg=green
-28436 28463 fg=black,bold
-28466 28471 fg=green
-28485 28488 fg=yellow
-28503 28510 fg=113
-28513 28515 fg=yellow
-28520 28522 fg=green
-28526 28554 fg=yellow
-28527 28538 fg=cyan
-28539 28553 fg=cyan
-28555 28557 fg=green
-28561 28567 fg=green
-28572 28576 fg=yellow
-28580 28632 fg=black,bold
-28635 28637 fg=green
-28643 28661 fg=113
-28662 28664 fg=green
-28668 28674 fg=green
-28680 28753 fg=black,bold
-28756 28758 fg=yellow
-28759 28761 fg=green
-28762 28771 fg=113
-28772 28774 fg=blue,bold
-28775 28778 fg=yellow
-28782 28795 fg=113
-28799 28807 fg=113
-28808 28810 fg=green
-28812 28816 fg=yellow
-28821 28826 fg=green
-28842 28843 fg=green
-28844 28864 fg=blue,bold
-28865 28866 fg=green
-28871 28873 fg=yellow
-28874 28875 fg=cyan
-28876 28879 fg=blue,bold
-28882 28883 fg=magenta
-28884 28886 fg=yellow
-28911 28917 fg=green
-28922 28924 fg=yellow
-28928 28946 fg=black,bold
-28949 28955 fg=green
-28958 28959 fg=yellow
-28961 29015 fg=black,bold
-29038 29040 fg=yellow
-29041 29042 fg=yellow
-29045 29051 fg=green
-29079 29084 fg=green
-29108 29113 fg=green
-29121 29128 fg=green
-29143 29148 fg=green
-29163 29232 fg=black,bold
-29235 29238 fg=yellow
-29239 29241 fg=yellow
-29242 29243 none
-29244 29245 fg=yellow
-29246 29247 fg=magenta
-29248 29249 fg=yellow,bold
-29250 29251 none
-29254 29257 none
-29258 29261 none
-29264 29269 none
-29270 29273 none
-29252 29253 fg=yellow
-29262 29263 fg=yellow
-29274 29275 fg=yellow,bold
-29276 29277 none
-29278 29280 fg=yellow
-29281 29282 fg=magenta
-29283 29285 fg=yellow
-29288 29290 fg=yellow
-29295 29297 fg=yellow
-29298 29299 fg=blue,bold
-29302 29303 fg=blue,bold
-29306 29315 fg=blue,bold
-29318 29319 fg=magenta
-29320 29322 fg=yellow
-29327 29329 fg=yellow
-29330 29331 fg=blue,bold
-29334 29335 fg=blue,bold
-29338 29339 fg=magenta
-29340 29342 fg=yellow
-29347 29351 fg=yellow
-29352 29362 fg=green
-29363 29365 fg=yellow
-29372 29375 bg=blue
-29376 29377 fg=yellow
-29426 29468 fg=black,bold
-29481 29483 fg=yellow
-29484 29486 fg=green
-29487 29496 fg=113
-29499 29540 fg=13
-29541 29543 fg=green
-29546 29550 fg=yellow
-29565 29567 fg=yellow
-29568 29569 fg=blue,bold
-29573 29574 fg=cyan
-29575 29580 fg=blue,bold
-29581 29583 fg=yellow
-29584 29614 fg=black,bold
-29629 29631 fg=yellow
-29632 29633 fg=blue,bold
-29637 29638 fg=cyan
-29639 29644 fg=blue,bold
-29645 29647 fg=yellow
-29648 29662 fg=black,bold
-29675 29679 fg=yellow
-29680 29682 fg=green
-29683 29692 fg=113
-29695 29743 fg=13
-29744 29746 fg=green
-29749 29753 fg=yellow
-29768 29770 fg=yellow
-29771 29772 fg=blue,bold
-29776 29777 fg=cyan
-29778 29783 fg=blue,bold
-29784 29786 fg=yellow
-29787 29828 fg=black,bold
-29843 29845 fg=yellow
-29846 29847 fg=blue,bold
-29851 29852 fg=cyan
-29853 29858 fg=blue,bold
-29859 29861 fg=yellow
-29862 29876 fg=black,bold
-29889 29893 fg=yellow
-29908 29916 fg=green
-29929 29931 fg=yellow
-29953 29957 bg=blue
-29957 29958 fg=yellow
-30005 30007 fg=yellow
-30008 30010 fg=green
-30023 30035 fg=blue,bold
-30036 30038 fg=green
-30040 30044 fg=yellow
-30059 30061 fg=yellow
-30062 30063 fg=blue,bold
-30067 30068 fg=magenta
-30069 30071 fg=yellow
-30072 30099 fg=black,bold
-30114 30116 fg=yellow
-30117 30118 fg=blue,bold
-30122 30123 fg=magenta
-30124 30126 fg=yellow
-30127 30159 fg=black,bold
-30172 30176 fg=yellow
-30191 30199 fg=green
-30212 30214 fg=yellow
-30236 30237 bg=blue
-30237 30238 fg=yellow
-30239 30247 fg=green
-30256 30260 fg=yellow
-30265 30284 fg=red,bold
-30285 30287 fg=113
-30288 30290 fg=113
-30291 30297 fg=113
-30300 30304 fg=yellow
-30305 30306 fg=yellow
-30308 30362 fg=black,bold
-30392 30394 fg=yellow
-30395 30396 fg=yellow
-30399 30405 fg=green
-30433 30438 fg=green
-30462 30467 fg=green
-30475 30482 fg=green
-30497 30502 fg=green
-30517 30522 fg=green
-30528 30535 fg=green
-30540 30618 fg=black,bold
-30621 30624 fg=yellow
-30625 30627 fg=yellow
-30628 30629 none
-30630 30631 fg=yellow
-30632 30633 fg=magenta
-30634 30635 fg=yellow,bold
-30636 30637 none
-30640 30643 none
-30644 30647 none
-30650 30655 none
-30656 30659 none
-30638 30639 fg=yellow
-30648 30649 fg=yellow
-30660 30661 fg=yellow,bold
-30662 30663 none
-30664 30666 fg=yellow
-30667 30668 fg=magenta
-30669 30671 fg=yellow
-30674 30676 fg=yellow
-30681 30683 fg=yellow
-30684 30685 fg=blue,bold
-30688 30689 fg=blue,bold
-30692 30701 fg=blue,bold
-30704 30705 fg=magenta
-30706 30708 fg=yellow
-30713 30715 fg=yellow
-30716 30717 fg=blue,bold
-30720 30721 fg=blue,bold
-30724 30725 fg=magenta
-30726 30728 fg=yellow
-30733 30737 fg=yellow
-30738 30748 fg=green
-30749 30751 fg=yellow
-30758 30762 bg=blue
-30762 30763 fg=yellow
-30810 30813 fg=yellow
-30814 30816 fg=yellow
-30817 30818 none
-30821 30822 none
-30819 30820 fg=yellow
-30823 30824 fg=yellow
-30825 30826 fg=magenta
-30827 30828 fg=yellow,bold
-30829 30830 none
-30834 30837 none
-30838 30841 none
-30844 30849 none
-30850 30853 none
-30831 30833 fg=yellow
-30842 30843 fg=yellow
-30854 30855 fg=yellow,bold
-30856 30857 none
-30858 30860 fg=yellow
-30861 30862 fg=magenta
-30863 30865 fg=yellow
-30867 30869 fg=yellow
-30884 30886 fg=green
-30887 30897 fg=yellow
-30888 30896 fg=cyan
-30898 30900 fg=blue,bold
-30919 30921 fg=green
-30925 30930 fg=green
-30943 30947 fg=yellow
-30963 30978 fg=cyan
-30991 31049 fg=black,bold
-31062 31064 fg=yellow
-31065 31067 fg=green
-31071 31076 fg=yellow
-31072 31075 fg=cyan
-31080 31104 fg=yellow
-31126 31131 fg=yellow
-31127 31130 fg=cyan
-31135 31148 fg=yellow
-31170 31175 fg=yellow
-31171 31174 fg=cyan
-31179 31199 fg=yellow
-31221 31226 fg=yellow
-31222 31225 fg=cyan
-31230 31250 fg=yellow
-31266 31268 fg=red,bold
-31270 31274 fg=yellow
-31289 31291 fg=yellow
-31292 31293 fg=blue,bold
-31297 31298 fg=cyan
-31299 31304 fg=blue,bold
-31305 31307 fg=yellow
-31322 31324 fg=yellow
-31325 31326 fg=blue,bold
-31330 31331 fg=cyan
-31332 31337 fg=blue,bold
-31338 31340 fg=yellow
-31353 31357 fg=yellow
-31372 31374 fg=yellow
-31375 31377 fg=yellow
-31378 31379 fg=cyan
-31380 31383 fg=blue,bold
-31386 31388 fg=cyan
-31389 31390 fg=magenta
-31391 31393 fg=yellow
-31400 31410 fg=113
-31421 31423 fg=green
-31425 31429 fg=yellow
-31446 31498 fg=black,bold
-31549 31551 fg=yellow
-31566 31568 fg=yellow
-31569 31570 fg=blue,bold
-31574 31575 fg=magenta
-31576 31578 fg=yellow
-31579 31606 fg=black,bold
-31621 31623 fg=yellow
-31624 31625 fg=blue,bold
-31629 31630 fg=magenta
-31631 31633 fg=yellow
-31634 31666 fg=black,bold
-31679 31681 fg=yellow
-31703 31704 bg=blue
-31704 31705 fg=yellow
-31706 31714 fg=green
-31723 31727 fg=yellow
-31732 31751 fg=red,bold
-31752 31754 fg=113
-31755 31757 fg=113
-31758 31764 fg=113
-31767 31771 fg=yellow
-31772 31773 fg=yellow
-31775 31818 fg=black,bold
-31819 31919 fg=black,bold
-31920 31970 fg=black,bold
-31998 32000 fg=yellow
-32001 32002 fg=yellow
-32005 32007 fg=yellow
-32008 32009 fg=cyan
-32014 32015 fg=magenta
-32016 32018 fg=yellow
-32022 32027 fg=green
-32031 32033 fg=cyan
-32038 32113 fg=yellow
-32117 32225 fg=black,bold
-32228 32234 fg=green
-32260 32265 fg=green
-32274 32275 fg=green
-32276 32294 fg=113
-32295 32296 fg=yellow
-32298 32397 fg=black,bold
-32398 32431 fg=black,bold
-32432 32531 fg=black,bold
-32553 32555 fg=yellow
-32556 32557 fg=yellow
-32602 32603 fg=green
-32603 32604 fg=green
-32605 32606 fg=yellow
-32627 32629 fg=yellow
-32630 32631 fg=yellow
-32634 32639 fg=green
-32655 32660 fg=green
-32679 32681 fg=cyan
-32688 32690 fg=cyan
-32693 32698 fg=green
-32703 32706 fg=yellow
-32718 32720 fg=yellow
-32725 32727 fg=yellow
-32728 32730 fg=yellow
-32731 32766 fg=red
-32767 32769 fg=yellow
-32771 32775 fg=yellow
-32789 32790 fg=green
-32790 32838 fg=yellow
-32791 32797 fg=cyan
-32798 32802 fg=cyan
-32803 32837 fg=cyan
-32838 32839 fg=green
-32846 32851 fg=green
-32856 32858 fg=yellow
-32861 32865 fg=yellow
-32866 32867 fg=yellow
-32890 32902 fg=black,bold
-2265 2266 fg=green,bold
-6226 6227 fg=yellow,bold
-4345 4346 fg=cyan,bold
-2960 2961 fg=green,bold
-3554 3555 fg=green,bold
-6228 6229 fg=yellow,bold
-4743 4744 fg=yellow,bold
-4348 4349 fg=yellow,bold
-29360 29361 fg=yellow,bold
-5638 5639 fg=yellow,bold
-2965 2966 fg=green,bold
-2768 2769 fg=yellow,bold
-21161 21162 fg=yellow,bold
-19467 19468 fg=red,bold
-21162 21163 fg=green,bold
-12654 12655 fg=green,bold
-12657 12658 fg=green,bold
-12958 12959 fg=cyan,bold
-6330 6331 fg=green,bold
-3063 3064 fg=yellow,bold
-1580 1581 fg=green,bold
-2570 2571 fg=yellow,bold
-5444 5445 fg=green,bold
-4851 4852 fg=yellow,bold
-2475 2476 fg=yellow,bold
-2674 2675 fg=yellow,bold
-5645 5646 fg=yellow,bold
-3368 3369 fg=yellow,bold
-5646 5647 fg=yellow,bold
-4955 4956 fg=yellow,bold
-2876 2877 fg=yellow,bold
-27792 27793 fg=yellow,bold
-12660 12661 fg=yellow,bold
-21770 21771 fg=cyan,bold
-12365 12366 fg=yellow,bold
-21771 21772 fg=yellow,bold
-23955 23956 fg=yellow,bold
-20886 20887 fg=yellow,bold
-20887 20888 fg=cyan,bold
-2179 2180 fg=yellow,bold
-3070 3071 fg=green,bold
-21978 21979 fg=yellow,bold
-3470 3471 fg=yellow,bold
-2382 2383 fg=yellow,bold
-2679 2680 fg=yellow,bold
-3075 3076 fg=green,bold
-3175 3176 fg=yellow,bold
-4463 4464 fg=yellow,bold
-2483 2484 fg=yellow,bold
-2780 2781 fg=yellow,bold
-5652 5653 fg=yellow,bold
-4464 4465 fg=cyan,bold
-3276 3277 fg=yellow,bold
-2287 2288 fg=yellow,bold
-4466 4467 fg=cyan,bold
-4863 4864 fg=yellow,bold
-3378 3379 fg=green,bold
-3576 3577 fg=yellow,bold
-2499 2500 fg=green,bold
-2587 2588 fg=yellow,bold
-2401 2402 fg=green,bold
-2599 2600 fg=green,bold
-2885 2886 fg=yellow,bold
-19086 19087 fg=cyan,bold
-19087 19088 fg=green,bold
-2304 2305 fg=green,bold
-1314 1315 fg=green,bold
-2987 2988 fg=yellow,bold
-2207 2208 fg=green,bold
-2900 2901 fg=green,bold
-2406 2407 fg=green,bold
-19388 19389 fg=red,bold
-31082 31083 fg=yellow,bold
-31182 31183 fg=yellow,bold
-19303 19304 fg=yellow,bold
-2905 2906 fg=green,bold
-12869 12870 fg=yellow,bold
-12671 12672 fg=cyan,bold
-12473 12474 fg=yellow,bold
-31086 31087 fg=yellow,bold
-12672 12673 fg=green,bold
-31087 31088 fg=yellow,bold
-21979 21980 fg=yellow,bold
-12673 12674 fg=yellow,bold
-27821 27822 fg=yellow,bold
-112 113 fg=green,bold
-30892 30893 fg=yellow,bold
-114 115 fg=green,bold
-31102 31103 fg=yellow,bold
-30895 30896 fg=yellow,bold
-27828 27829 fg=yellow,bold
-11306 11307 fg=yellow,bold
-4270 4271 fg=yellow,bold
-4469 4470 fg=yellow,bold
-2390 2391 fg=yellow,bold
-4271 4272 fg=cyan,bold
-2193 2194 fg=yellow,bold
-2293 2294 fg=yellow,bold
-4273 4274 fg=cyan,bold
-3383 3384 fg=green,bold
-19089 19090 fg=green,bold
-4275 4276 fg=cyan,bold
-5860 5861 fg=yellow,bold
-2494 2495 fg=green,bold
-2692 2693 fg=green,bold
-3187 3188 fg=green,bold
-2594 2595 fg=green,bold
-2309 2310 fg=green,bold
-2793 2794 fg=green,bold
-3299 3300 fg=yellow,bold
-2212 2213 fg=green,bold
-3884 3885 fg=green,bold
-2697 2698 fg=green,bold
-3588 3589 fg=yellow,bold
-2115 2116 fg=green,bold
-3600 3601 fg=green,bold
-2798 2799 fg=green,bold
-5868 5869 fg=cyan,bold
-3008 3009 fg=yellow,bold
-19198 19199 fg=cyan,bold
-3405 3406 fg=yellow,bold
-31192 31193 fg=yellow,bold
-3508 3509 fg=green,bold
-31193 31194 fg=yellow,bold
-12482 12483 fg=cyan,bold
-19512 19513 fg=red,bold
-12681 12682 fg=yellow,bold
-12483 12484 fg=green,bold
-12682 12683 fg=green,bold
-31097 31098 fg=yellow,bold
-12485 12486 fg=green,bold
-31197 31198 fg=yellow,bold
-31098 31099 fg=yellow,bold
-11298 11299 fg=yellow,bold
-12982 12983 fg=yellow,bold
-12686 12687 fg=green,bold
-12687 12688 fg=yellow,bold
-12699 12700 fg=yellow,bold
-23975 23976 fg=yellow,bold
-12700 12701 fg=green,bold
-12304 12305 fg=yellow,bold
-12701 12702 fg=cyan,bold
-12702 12703 fg=yellow,bold
-3192 3193 fg=green,bold
-4281 4282 fg=cyan,bold
-4282 4283 fg=yellow,bold
-6263 6264 fg=yellow,bold
-5670 5671 fg=yellow,bold
-3097 3098 fg=yellow,bold
-3999 4000 fg=yellow,bold
-8345 8346 fg=yellow,bold
-4000 4001 fg=cyan,bold
-8346 8347 fg=yellow,bold
-3595 3596 fg=green,bold
-4002 4003 fg=cyan,bold
-5873 5874 fg=cyan,bold
-4685 4686 fg=yellow,bold
-5874 5875 fg=yellow,bold
-5676 5677 fg=yellow,bold
-3311 3312 fg=green,bold
-3498 3499 fg=yellow,bold
-3015 3016 fg=green,bold
-4005 4006 fg=yellow,bold
-2521 2522 fg=yellow,bold
-2719 2720 fg=yellow,bold
-3214 3215 fg=yellow,bold
-4403 4404 fg=yellow,bold
-2621 2622 fg=yellow,bold
-4404 4405 fg=cyan,bold
-2820 2821 fg=yellow,bold
-3513 3514 fg=green,bold
-14170 14171 fg=yellow,bold
-12190 12191 fg=yellow,bold
-3118 3119 fg=yellow,bold
-3316 3317 fg=green,bold
-18131 18132 fg=yellow,bold
-4406 4407 fg=cyan,bold
-12291 12292 fg=yellow,bold
-2428 2429 fg=yellow,bold
-14174 14175 fg=yellow,bold
-12195 12196 fg=yellow,bold
-12493 12494 fg=cyan,bold
-12494 12495 fg=yellow,bold
-2927 2928 fg=yellow,bold
-12695 12696 fg=yellow,bold
-19428 19429 fg=red,bold
-12696 12697 fg=green,bold
-12697 12698 fg=cyan,bold
-12416 12417 fg=yellow,bold
-5285 5286 fg=yellow,bold
-5286 5287 fg=cyan,bold
-3020 3021 fg=green,bold
-6278 6279 fg=yellow,bold
-5288 5289 fg=cyan,bold
-4409 4410 fg=yellow,bold
-4993 4994 fg=yellow,bold
-2331 2332 fg=yellow,bold
-4213 4214 fg=yellow,bold
-2234 2235 fg=yellow,bold
-3125 3126 fg=green,bold
-4214 4215 fg=cyan,bold
-2532 2533 fg=yellow,bold
-5305 5306 fg=green,bold
-2137 2138 fg=yellow,bold
-3622 3623 fg=yellow,bold
-4216 4217 fg=cyan,bold
-2437 2438 fg=yellow,bold
-1546 1547 fg=green,bold
-1448 1449 fg=green,bold
-2636 2637 fg=yellow,bold
-5607 5608 fg=yellow,bold
-2738 2739 fg=yellow,bold
-14199 14200 fg=yellow,bold
-4918 4919 fg=yellow,bold
-19637 19638 fg=green,bold
-21134 21135 fg=green,bold
-19836 19837 fg=red,bold
-31233 31234 fg=yellow,bold
-21135 21136 fg=yellow,bold
-27857 27858 fg=yellow,bold
-31137 31138 fg=yellow,bold
-30743 30744 fg=yellow,bold
-5291 5292 fg=yellow,bold
-5689 5690 fg=green,bold
-32825 32826 fg=yellow,bold
-30746 30747 fg=yellow,bold
-3130 3131 fg=green,bold
-4219 4220 fg=yellow,bold
-6203 6204 fg=green,bold
-5609 5610 fg=cyan,bold
-2145 2146 fg=yellow,bold
-3630 3631 fg=yellow,bold
-4522 4523 fg=yellow,bold
-2344 2345 fg=yellow,bold
-3433 3434 fg=yellow,bold
-5898 5899 fg=yellow,bold
-5810 5811 fg=green,bold
-4919 4920 fg=yellow,bold
-4523 4524 fg=cyan,bold
-2543 2544 fg=green,bold
-2741 2742 fg=green,bold
-5613 5614 fg=cyan,bold
-4821 4822 fg=yellow,bold
-3237 3238 fg=yellow,bold
-14191 14192 fg=yellow,bold
-4525 4526 fg=cyan,bold
-2248 2249 fg=yellow,bold
-3535 3536 fg=yellow,bold
-19142 19143 fg=cyan,bold
-5912 5913 fg=yellow,bold
-4823 4824 fg=yellow,bold
-3338 3339 fg=yellow,bold
-2448 2449 fg=green,bold
-4528 4529 fg=yellow,bold
-2548 2549 fg=green,bold
-2647 2648 fg=green,bold
-2746 2747 fg=green,bold
-19640 19641 fg=green,bold
-2846 2847 fg=yellow,bold
-2945 2946 fg=yellow,bold
-19347 19348 fg=red,bold
-31141 31142 fg=yellow,bold
-31142 31143 fg=yellow,bold
-31243 31244 fg=yellow,bold
-31244 31245 fg=yellow,bold
-31146 31147 fg=yellow,bold
-31248 31249 fg=yellow,bold
-23922 23923 fg=yellow,bold
-12638 12639 fg=yellow,bold
-32836 32837 fg=yellow,bold
-6396 6397 fg=red,bold
-3042 3043 fg=yellow,bold
-2152 2153 fg=green,bold
-5619 5620 fg=cyan,bold
-2453 2454 fg=green,bold
-2849 2850 fg=green,bold
-3443 3444 fg=green,bold
-3542 3543 fg=yellow,bold
-2355 2356 fg=green,bold
-2157 2158 fg=green,bold
-2652 2653 fg=green,bold
-5623 5624 fg=cyan,bold
-19151 19152 fg=cyan,bold
-5624 5625 fg=yellow,bold
-19152 19153 fg=green,bold
-2854 2855 fg=green,bold
-3448 3449 fg=green,bold
-3646 3647 fg=green,bold
-19154 19155 fg=green,bold
-5925 5926 fg=green,bold
-29357 29358 fg=yellow,bold
-27872 27873 fg=yellow,bold
-12639 12640 fg=cyan,bold
-12640 12641 fg=green,bold
-27777 27778 fg=yellow,bold
-12941 12942 fg=cyan,bold
-23936 23937 fg=yellow,bold
-3249 3250 fg=green,bold
-2260 2261 fg=green,bold
-2360 2361 fg=green,bold
-3152 3153 fg=yellow,bold
-4341 4342 fg=yellow,bold
-3549 3550 fg=green,bold
-4342 4343 fg=cyan,bold
-3254 3255 fg=green,bold
diff --git a/share/test/parse.zsh b/share/test/parse.zsh
deleted file mode 100755
index d125f52..0000000
--- a/share/test/parse.zsh
+++ /dev/null
@@ -1,220 +0,0 @@
-#!/bin/sh
-
-#
-# This file runs the highlighter on a specified file
-# i.e. parses the file with the highlighter. Outputs
-# running time (stderr) and resulting region_highlight
-# (file parse.out, or $2 if given).
-#
-# Can be also run in line-wise mode on own input (-o
-# option in $1), no region_highlight file then.
-#
-
-[[ -z "$ZSH_VERSION" ]] && exec /usr/bin/env /usr/local/bin/zsh -f -c "source \"$0\" \"$1\" \"$2\" \"$3\""
-
-ZERO="${(%):-%N}"
-
-if [[ -e "${ZERO}/../fast-highlight" ]]; then
- source "${ZERO}/../fast-highlight"
- source "${ZERO}/../fast-string-highlight"
- fpath+=( "${ZERO}/.." )
-elif [[ -e "../fast-highlight" ]]; then
- source "../fast-highlight"
- source "../fast-string-highlight"
- fpath+=( "$PWD/.." )
-elif [[ -e "${ZERO}/fast-highlight" ]]; then
- source "${ZERO}/fast-highlight"
- source "${ZERO}/fast-string-highlight"
- fpath+=( "${ZERO}" )
-elif [[ -e "./fast-highlight" ]]; then
- source "./fast-highlight"
- source "./fast-string-highlight"
- fpath+=( "./" )
-else
- print -u2 "Could not find fast-highlight, aborting"
- exit 1
-fi
-
-zmodload zsh/zprof
-autoload is-at-least chroma/-git.ch
-
-setopt interactive_comments extendedglob
-
-# Own input?
-if [[ "$1" = "-o" || "$1" = "-oo" || "$1" = "-ooo" || "$1" = "-git" || "$1" = "-hue" || "$1" = "-hol" ]]; then
- typeset -a input
- input=()
- if [[ "$1" = "-o" ]]; then
- input+=( "./parse.zsh ../fast-highlight parse2.out" )
- input+=( "rm -f parse*.out" )
- input+=( "./mh-parse.zsh ../fast-highlight > out" )
- input+=( "if [[ -o multibyte ]]; then echo multibyte is set; fi" )
- input+=( "[[ \"a\" = *[[:alpha:]_-][[:alpha:]]# ]] && echo yes" )
- input+=( 'git tag -a v0.98 -m "Syntax highlighting of the history entries"' )
- input+=( 'func() { echo "a" >! phist2.db; echo "b" >>! phist2.db; fc -Rap "phist2.db"; list=( ${history[@]} ); echo "${history[1]}"; }' )
- (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "${(F)input}"; return 0; }
- elif [[ "$1" = "-oo" ]]; then
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- input+=( 'typeset -a list\n() {\necho "a" >! phist2.db\necho "b" >>! phist2.db\nfc -Rap "phist2.db"\nlist=( ${history[@]} )\necho "${history[2]}"\necho "${history[1]}"\necho "${#history}";\ninteger size="${#history}"\nsize+=1\necho "$size" / "${history[$size]}"\nlist=( "${history[$size]}" ${history[@]} )\n}' )
- (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "${(F)input}"; return 0; }
- elif [[ "$1" = "-ooo" ]]; then
- local in='
-# This is an example code that is diverse and allows to test a theme
-text="An example quite long string $with variable in it"
-local param1="text $variable" param2='"'"'other $variable'"'"'
-math=$(( 10 + HISTSIZ + HISTSIZE + $SAVEHIST )) size=$(( 0 ))
-
-for (( ii = 1; ii <= size; ++ ii )); do
- if [[ "${cmds[ii]} string" = "| string" ]]
- then
- sidx=${buffer[(in:ii:)\$\(?#[^\\\\]\)]} # find opening $(
- (( sidx <= len )) && {
- eidx=${buffer[(b:sidx:ii)[^\\\\]\)]} # find closing )
- }
- fi
-done'
- (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
- input+=( "$in" )
- input+=( "$in" )
- elif [[ "$1" = "-git" ]]; then
- local in="git lp
-git push origin main
-git commit
-git add safari.ini zdharma.ini
-git st .
-git diff --cached
-git commit --allow-empty
-git checkout themes/zdharma.ini
-git commit --amend
-git commit -m \"Example commit message\"
-git tag -a 'v1.18' -m 'Here-string is highlighted, descriptor-variables passed to exec are correctly highlighted'
-git tag -l -n9
-git checkout cb66b11
-"
- (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
- input+=( "$in" )
- input+=( "$in" )
- elif [[ "$1" = "-hue" ]]; then
- local in="var=\$other; local var=\$other
- () { eval \"\$var\"; }
- case \$other in
- \$var)
- ( echo OK; )
- ;;
- esac
- sudo -i -s ls -1 /var/log
- () { ( eval \"command ls -1\" ); } argument"
-
- (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
-
- input+=( "$in" "$in" )
- elif [[ "$1" = "-hol" ]]; then
- local in="var=\$( other )
-local var2=\$(( other + 1 ))
-() { eval \"\$var\"; }
-sudo -i -s ls -1 >/tmp/ls-log.txt /var/log
-IFS=\$'\\n' print -rl -- \$(command ls -1 | tee -a /tmp/ls-1.txt)
-var3=\$(( HISTSIZE + 10 + \$var ))
-local var4=\$( other command )
-touch \$(( HISTSIZE + \$SAVEHIST + 10 ))
-case \$other in
- \$var)
- ( echo OK; )
- ;;
- \$var3)
- ( if { true } { noglob echo yes } )
-esac
-( builtin cd /var/log; ls -1; noglob cd \"/var/log\" 'log' )
-noglob cat <<<\"\$PATH\" | tr : \"\\n\"
-if [[ \"\$var\" -gt 10 ]]; then
- (( var = HISTSIZE + \$SAVEHIST ))
-fi
-/var/log
-sidx=\${buffer[(in:ii:)\\\$\\(?#[^\\\\\\\\]\\)]} # find opening cmd-subst
-{
- exec {MYFD}<&0 {MYFD2}>&1
- ( read <&\$MYFD line; echo \$line >&\$MYFD2 && { builtin print \${match[1]}Written. } )
-} always {
- (( MYFD > 0 )) && { print -rl -- -myfd:\$MYFD >&\$MYFD2 && print \"Sent.\" '(to filedescriptor)'; }
-}
-command sleep \"\$(( \$a + b + \${cde} + \${(s::)fgh[ijk]} + \\\$l + \\m + \\\" ))\"
-for (( i = 0; i <= 2; ++ i )) { print \$i; }
-"
-
- (( ${+ZSH_EXECUTION_STRING} == 0 )) && { print -zr "$in"; return 0; }
-
- input+=( "$in" )
- fi
-
- typeset -a long_input
- integer i
- for (( i=1; i<= 50; i ++ )); do
- long_input+=( "${input[@]}" )
- done
-
- typeset -F SECONDS
- SECONDS=0
-
- local right_brace_is_recognised_everywhere
- integer path_dirs_was_set multi_func_def ointeractive_comments
- -fast-highlight-fill-option-variables
-
- local BUFFER
- for BUFFER in "${long_input[@]}"; do
- reply=( )
- () {
- -fast-highlight-init
- -fast-highlight-process "" "$BUFFER" "0"
- -fast-highlight-string-process "" "$BUFFER"
- }
- done
-
- print "Running time: $SECONDS"
- zprof | head
-# File input?
-elif [[ -r "$1" ]]; then
- # Load from given file
- local BUFFER="$(<$1)"
-
- typeset -F SECONDS
- SECONDS=0
-
- reply=( )
- -fast-highlight-init
-
- local right_brace_is_recognised_everywhere
- integer path_dirs_was_set multi_func_def ointeractive_comments
- -fast-highlight-fill-option-variables
-
- () {
- -fast-highlight-process "" "$BUFFER" "0"
- -fast-highlight-string-process "" "$BUFFER"
- }
-
- print "Running time: $SECONDS"
- zprof | head
-
- # This output can be diffed to detect changes in operation
- if [[ -z "$2" ]]; then
- print -rl -- "${reply[@]}" >! out.parse
- else
- print -rl -- "${reply[@]}" >! "$2"
- fi
-else
- if [[ -z "$1" ]]; then
- print -u2 "Usage: ./parse.zsh {to-parse file} [region_highlight output file]"
- exit 2
- else
- print -u2 "Unreadable to-parse file \`$1', aborting"
- exit 3
- fi
-fi
-
-exit 0
-
-# vim:ft=zsh
diff --git a/tests/_output/.gitkeep b/tests/_output/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/_support/.gitkeep b/tests/_support/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/_support/bootstrap b/tests/_support/bootstrap
deleted file mode 100644
index 0107661..0000000
--- a/tests/_support/bootstrap
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env zsh
-# Write your bootstrap code here
diff --git a/tests/main.zunit b/tests/main.zunit
index 8c187cd..75c91ce 100644
--- a/tests/main.zunit
+++ b/tests/main.zunit
@@ -1,6 +1,6 @@
#!/usr/bin/env zunit
@setup {
- load "../fast-highlight"
+ load "../functions/fast-highlight"
setopt interactive_comments
-fast-highlight-fill-option-variables
}
diff --git a/themes/base16.ini b/themes/base16.ini
new file mode 100644
index 0000000..8c82598
--- /dev/null
+++ b/themes/base16.ini
@@ -0,0 +1,82 @@
+[base]
+default = none
+unknown-token = 1,bold
+commandseparator = none
+redirection = none
+here-string-tri = 14
+here-string-text = bg:11
+here-string-var = 1,bg:11
+exec-descriptor = 9,bold
+comment = 8
+correct-subtle = 12
+incorrect-subtle = 1
+subtle-separator = 12
+subtle-bg = bg:10
+; secondary =
+; recursive-base =
+
+[command-point]
+reserved-word = 5
+subcommand = 6
+alias = 4
+suffix-alias = 4
+global-alias = 4,bg:11
+builtin = 4
+function = 4
+command = 4
+precommand = 6
+hashed-command = 4
+single-sq-bracket = 4
+double-sq-bracket = 4
+double-paren = 5
+
+[paths]
+path = 9
+pathseparator =
+path-to-dir = 9,underline
+globbing = 6
+globbing-ext = 6,bold
+
+[brackets]
+paired-bracket = bg:8
+bracket-level-1 = 3,bold
+bracket-level-2 = 6,bold
+bracket-level-3 = 2,bold
+
+[arguments]
+single-hyphen-option = 3
+double-hyphen-option = 3
+back-quoted-argument = none
+single-quoted-argument = 2
+double-quoted-argument = 2
+dollar-quoted-argument = 2
+
+[in-string]
+; backslash in $'...'
+back-dollar-quoted-argument = 6
+; backslash or $... in "..."
+back-or-dollar-double-quoted-argument = 1
+
+[other]
+variable = 1
+assign = none
+assign-array-bracket = 5
+history-expansion = 6,bold
+
+[math]
+mathvar = 1
+mathnum = 9
+matherr = 1,bold
+
+[for-loop]
+forvar = 1
+fornum = 9
+; operator
+foroper = none
+; separator
+forsep = none
+
+[case]
+case-input = 1
+case-parentheses = 5
+case-condition = bg:10
diff --git a/themes/z-shell.ini b/themes/z-shell.ini
index 60e9799..c6c1690 100644
--- a/themes/z-shell.ini
+++ b/themes/z-shell.ini
@@ -1,6 +1,6 @@
[base]
default = none
-unknown-token = red,bold
+unknown-token = 196,bold
commandseparator = none
redirection = none
here-string-tri = 141
@@ -11,8 +11,8 @@ comment = black,bold
correct-subtle = bg:55
incorrect-subtle = bg:52
subtle-bg = bg:17
-secondary = safari
-recursive-base = 184
+secondary = base16
+recursive-base = 190
[command-point]
reserved-word = 48
diff --git "a/\342\206\222chroma/-autoload.ch" "b/\342\206\222chroma/-autoload.ch"
deleted file mode 100644
index d41e5de..0000000
--- "a/\342\206\222chroma/-autoload.ch"
+++ /dev/null
@@ -1,103 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-# Tracks autoload command - highlights function names if they exist somewhere
-# in $fpath. Also warns that the autoloaded function is already defined.
-#
-# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
-#
-# $2 - the current token, also accessible by $__arg from the above scope -
-# basically a private copy of $__arg; the token can be eg.: "grep"
-#
-# $3 - a private copy of $_start_pos, i.e. the position of the token in the
-# command line buffer, used to add region_highlight entry (see man),
-# because Zsh colorizes by *ranges* in command line buffer
-#
-# $4 - a private copy of $_end_pos from the above scope
-#
-
-(( next_word = 2 | 8192 ))
-
-local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
-local __style __chars
-integer __idx1 __idx2
-local -a __results __deserialized __noshsplit
-
-# First call, i.e. command starts, i.e. "grep" token etc.
-(( __first_call )) && {
- FAST_HIGHLIGHT[chroma-autoload-counter]=0
- FAST_HIGHLIGHT[chroma-autoload-counter-all]=1
- FAST_HIGHLIGHT[chroma-autoload-message]=""
- #FAST_HIGHLIGHT[chroma-autoload-message-shown]=""
- [[ -z ${FAST_HIGHLIGHT[chroma-autoload-message-shown-at]} ]] && FAST_HIGHLIGHT[chroma-autoload-message-shown-at]=0
- FAST_HIGHLIGHT[chroma-autoload-elements]=""
- __style=${FAST_THEME_NAME}command
-
-} || {
- if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
- fi
- (( FAST_HIGHLIGHT[chroma-autoload-counter-all] += 1, __idx2 = FAST_HIGHLIGHT[chroma-autoload-counter-all] ))
-
- # Following call, i.e. not the first one.
-
- # Check if chroma should end – test if token is of type
- # "starts new command", if so pass-through – chroma ends
- [[ "$__arg_type" = 3 ]] && return 2
-
- if [[ "$__wrd" = [-+]* ]]; then
- # Detected option, add style for it.
- [[ "$__wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
- __style=${FAST_THEME_NAME}single-hyphen-option
- else
- # Count non-option tokens.
- (( FAST_HIGHLIGHT[chroma-autoload-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-autoload-counter] ))
-
- if [[ $__wrd != (\$|\"\$)* && $__wrd != (/|\"/|\'/)* && $__wrd != \`* ]]; then
- __results=( ${^fpath}/$__wrd(N) )
- __deserialized=( "${(Q@)${(z@)FAST_HIGHLIGHT[chroma-fpath_peq-elements]}}" )
- __results+=( ${^__deserialized}/$__wrd(N) )
- [[ "${#__results}" -gt 0 ]] && {
- __style=${FAST_THEME_NAME}correct-subtle
- __deserialized=( "${(Q@)${(z@)FAST_HIGHLIGHT[chroma-autoload-elements]}}" )
- [[ -z "${__deserialized[1]}" && ${#__deserialized} -eq 1 ]] && __deserialized=()
- # Cannot use ${abc:+"$abc"} trick with ${~...}, so handle most
- # cases of the possible shwordsplit through an additional array
- __noshsplit=( ${~__wrd} )
- __deserialized+=( "${(j: :)__noshsplit}" )
- FAST_HIGHLIGHT[chroma-autoload-elements]="${(j: :)${(q@)__deserialized}}"
- # Make the function defined for big-loop's *main-type mechanism
- __fast_highlight_main__command_type_cache[${(j: :)__noshsplit}]="function"
- } || __style=${FAST_THEME_NAME}incorrect-subtle
- fi
-
- if (( ${+functions[${(Q)__wrd}]} )); then
- FAST_HIGHLIGHT[chroma-autoload-message]+="Warning: Function ${(Q)__wrd} already defined (e.g. loaded)"$'\n'
- fi
- fi
-
- # Display only when processing last autoload argument
- if (( ${#${(z)BUFFER}} == FAST_HIGHLIGHT[chroma-autoload-counter-all] )); then
- # Display only if already shown message differs or when it timeouts
- if [[ ${FAST_HIGHLIGHT[chroma-autoload-message]} != ${FAST_HIGHLIGHT[chroma-autoload-message-shown]} ||
- $(( EPOCHSECONDS - FAST_HIGHLIGHT[chroma-autoload-message-shown-at] )) -gt 7
- ]]; then
- FAST_HIGHLIGHT[chroma-autoload-message-shown]=${FAST_HIGHLIGHT[chroma-autoload-message]}
- FAST_HIGHLIGHT[chroma-autoload-message-shown-at]=$EPOCHSECONDS
- zle -M "${FAST_HIGHLIGHT[chroma-autoload-message]}"
- fi
- fi
-}
-
-# Add region_highlight entry (via `reply' array).
-#
-# This is a common place of adding such entry, but any above code
-# can do it itself and skip setting __style to disable this code.
-[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-
-# We aren't passing-through (no return 1 occured), do obligatory things ourselves.
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-autorandr.ch" "b/\342\206\222chroma/-autorandr.ch"
deleted file mode 100644
index c7217bd..0000000
--- "a/\342\206\222chroma/-autorandr.ch"
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-(( next_word = 2 | 8192 ))
-[[ "$__arg_type" = 3 ]] && return 2
-
-local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
-
-if (( __first_call )) || [[ "$__wrd" = -* ]]; then
- return 1
-else
- if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
- fi
- if [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/autorandr/$__wrd" ]] then
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
- fi
-fi
-
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-awk.ch" "b/\342\206\222chroma/-awk.ch"
deleted file mode 100644
index 9175f06..0000000
--- "a/\342\206\222chroma/-awk.ch"
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
-#
-# $2 - the current token, also accessible by $__arg from the above scope -
-# basically a private copy of $__arg; the token can be eg.: "grep"
-#
-# $3 - a private copy of $_start_pos, i.e. the position of the token in the
-# command line buffer, used to add region_highlight entry (see man),
-# because Zsh colorizes by *ranges* in command line buffer
-#
-# $4 - a private copy of $_end_pos from the above scope
-#
-
-(( next_word = 2 | 8192 ))
-
-local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
-local __style __chars __val __style2
-integer __idx1 __idx2
-
-# First call, i.e. command starts, i.e. "grep" token etc.
-(( __first_call )) && {
- FAST_HIGHLIGHT[chroma-awk-counter]=0
- FAST_HIGHLIGHT[chroma-awk-f-seen]=0
- return 1
-} || {
- # Following call, i.e. not the first one.
-
- if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
- fi
-
- # Check if chroma should end – test if token is of type
- # "starts new command", if so pass-through – chroma ends
- [[ "$__arg_type" = 3 ]] && return 2
-
- if [[ "$__wrd" = -* ]]; then
- # Detected option, add style for it.
- [[ "$__wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
- __style=${FAST_THEME_NAME}single-hyphen-option
- [[ "$__wrd" = "-f" ]] && FAST_HIGHLIGHT[chroma-awk-f-seen]=1
- else
- # Count non-option tokens.
- (( FAST_HIGHLIGHT[chroma-awk-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-awk-counter] ))
-
- # First non-option token is the pattern (regex), we will
- # highlight it.
- if (( FAST_HIGHLIGHT[chroma-awk-counter] == 1 && FAST_HIGHLIGHT[chroma-awk-f-seen] == 0 )); then
- if print -r -- "${(Q)__wrd}" | gawk --source 'BEGIN { exit } END { exit 0 }' -f - >/dev/null 2>&1; then
- __style2="${FAST_THEME_NAME}subtle-bg"
- else
- __style2="${FAST_THEME_NAME}incorrect-subtle"
- fi
-
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style2]}")
-
- # Highlight keywords
- FSH_LIST=()
- : "${__wrd//(#m)(BEGIN|END|FIELDWIDTHS|RS|ARGC|ARGV|ENVIRON|NF|NR|IGNORECASE|FILENAME|if|then|else|while|toupper|tolower|function|print|sub)/$(( fsh_sy_h_append($MBEGIN, $MEND) ))}";
- for __val in "${FSH_LIST[@]}" ; do
- [[ ${__wrd[${__val%%;;*}]} = [a-zA-Z0-9_] || ${__wrd[${__val##*;;}+1]} = [a-zA-Z0-9_] ]] && continue
- __idx1=$(( __start_pos + ${__val%%;;*} ))
- __idx2=__idx1+${__val##*;;}-${__val%%;;*}+1
- (( __start=__idx1-${#PREBUFFER}, __end=__idx2-${#PREBUFFER}-1, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}reserved-word]},${FAST_HIGHLIGHT_STYLES[$__style2]}")
- done
-
- # Highlight regex characters
- __chars="*+\\)(\{\}[]^"
- __idx1=__start_pos
- __idx2=__start_pos
- while [[ "$__wrd" = (#b)[^$__chars]#([\\][\\])#((+|\*|\[|\]|\)|\(|\^|\}|\{)|[\\](+|\*|\[|\]|\)|\(|\^|\{|\}))(*) ]]; do
- if [[ -n "${match[3]}" ]]; then
- __idx1+=${mbegin[3]}-1
- __idx2=__idx1+${mend[3]}-${mbegin[3]}+1
- (( __start=__idx1-${#PREBUFFER}, __end=__idx2-${#PREBUFFER}, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}mathnum]},${FAST_HIGHLIGHT_STYLES[$__style2]}")
- __idx1=__idx2
- else
- __idx1+=${mbegin[5]}-1
- fi
- __wrd="${match[5]}"
- done
- elif (( FAST_HIGHLIGHT[chroma-awk-counter] >= 2 || FAST_HIGHLIGHT[chroma-awk-f-seen] == 1 )); then
- FAST_HIGHLIGHT[chroma-awk-f-seen]=0
- # Handle paths, etc. normally - just pass-through to the big
- # highlighter (the main FSH highlighter, used before chromas).
- return 1
- fi
- fi
-}
-
-# Add region_highlight entry (via `reply' array).
-#
-# This is a common place of adding such entry, but any above
-# code can do it itself (and it does) and skip setting __style
-# to disable this code.
-[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-
-# We aren't passing-through (no return 1 occured), do obligatory things ourselves.
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-fast-theme.ch" "b/\342\206\222chroma/-fast-theme.ch"
deleted file mode 100644
index 20c8abd..0000000
--- "a/\342\206\222chroma/-fast-theme.ch"
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-(( next_word = 2 | 8192 ))
-[[ "$__arg_type" = 3 ]] && return 2
-
-local __first_call="$1" __wrd="${(Q)2}" __start_pos="$3" __end_pos="$4"
-local __style
-
-if (( __first_call )); then
- FAST_HIGHLIGHT[chroma-fast-theme-first]=0
- return 1
-elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
-elif (( ${FAST_HIGHLIGHT[chroma-fast-theme-first]} )) || [[ $__wrd = -* ]]; then
- return 1
-else
- FAST_HIGHLIGHT[chroma-fast-theme-first]=1
-fi
-
-if [[ "$__wrd" = */* || "$__wrd" = (XDG|LOCAL|HOME|OPT):* ]]; then
- __wrd="${${__wrd/(#s)XDG:/${${XDG_CONFIG_HOME:-$HOME/.config}%/}/fsh/}%.ini}.ini"
- __wrd="${${__wrd/(#s)LOCAL://usr/local/share/fsh/}%.ini}.ini"
- __wrd="${${__wrd/(#s)HOME:/$HOME/.fsh/}%.ini}.ini"
- __wrd="${${__wrd/(#s)OPT://opt/local/share/fsh/}%.ini}.ini"
- __wrd=${~__wrd} # allow user to quote ~
-else
- __wrd="$FAST_BASE_DIR/themes/$__wrd.ini"
-fi
-
-if [[ -f $__wrd ]]; then
- __style=${FAST_THEME_NAME}path
-else
- __style=${FAST_THEME_NAME}incorrect-subtle
-fi
-
-(( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-git.ch" "b/\342\206\222chroma/-git.ch"
deleted file mode 100644
index 8df5088..0000000
--- "a/\342\206\222chroma/-git.ch"
+++ /dev/null
@@ -1,954 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-# Chroma function for command `git'. It colorizes the part of command
-# line that holds `git' invocation.
-
-(( FAST_HIGHLIGHT[-git.ch-chroma-def] )) && return 1
-
-FAST_HIGHLIGHT[-git.ch-chroma-def]=1
-
-typeset -gA fsh__git__chroma__def
-fsh__git__chroma__def=(
- ##
- ## No subcommand
- ##
- ## {{{
-
- subcmd:NULL "NULL_0_opt"
- NULL_0_opt "(-C|--exec-path=|--git-dir=|--work-tree=|--namespace=|--super-prefix=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || -c
- <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP
- <<>> __style=\${FAST_THEME_NAME}optarg-string // NO-OP
- || (--version|--help|--html-path|--man-path|--info-path|-p|--paginate|
- -P|--no-pager|--no-replace-objects|--bare)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
-
- "subcommands" "::→chroma/-git-get-subcommands" # run a function (the :: causes this) and use `reply'
- #"subcommands" "(fetch|pull)" # run a function (the :: causes this) and use `reply'
-
- "subcmd-hook" "→chroma/-git-check-if-alias"
-
- "subcommands-blacklist" "mv,other"
-
- ## }}}
-
- ##
- ## `FETCH'
- ##
- ## {{{
-
- subcmd:fetch "FETCH_MULTIPLE_0_opt^ // FETCH_ALL_0_opt^ // FETCH_0_opt //
- REMOTE_GR_1_arg // REF_#_arg // NO_MATCH_#_opt"
-
- # Special options (^ - has directives, currently - an :add and :del directive)
- "FETCH_MULTIPLE_0_opt^" "
- --multiple
- <<>> __style=\${FAST_THEME_NAME}double-hyphen-option // NO-OP
- || --multiple:add
- <<>> REMOTE_GR_#_arg
- || --multiple:del
- <<>> REMOTE_GR_1_arg // REF_#_arg" # when --multiple is passed, then
- # there is no refspec argument, only remotes-ids
- # follow unlimited # of them, hence the # in the
- # REMOTE_GR_#_arg
-
- # Special options (^ - has directives - an :del-directive)
- "FETCH_ALL_0_opt^" "
- --all
- <<>> __style=\${FAST_THEME_NAME}double-hyphen-option // NO-OP
- || --all:del
- <<>> REMOTE_GR_1_arg // REF_#_arg" # --all can be only followed by options
-
- # FETCH_0_opt. FETCH-options (FETCH is an identifier) at position 0 ->
- # -> before any argument
- FETCH_0_opt "
- (--depth=|--deepen=|--shallow-exclude=|--shallow-since=|--receive-pack=|
- --refmap=|--recurse-submodules=|-j|--jobs=|--submodule-prefix=|
- --recurse-submodules-default=|-o|--server-option=|--upload-pack|
- --negotiation-tip=|--set-upstream=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (--help|--all|-a|--append|--unshallow|--atomic|--auto-maintenance|--update-shallow|--dry-run|-f|--force|
- -k|--keep|--multiple|-p|--prune|-n|--no-tags|-t|--tags|--prefetch |--no-recurse-submodules|--negotiation-tip|
- --auto-gc|--filter|--write-fetch-head|--write-commit-graph|--show-forced-updates|--prune-tags|
- -u|--update-head-ok|-q|--quiet|-v|--verbose|--progress|
- -4|--ipv4|-6|--ipv6)
- <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP"
- # Above: note the two <<>>-separated blocks for options that have
- # some arguments – the second pair of action/handler is being
- # run when an option argument is occurred (first one: the option
- # itself). If there is only one <<>>-separated block, then the option
- # is set to be argument-less. The argument is a) -o/--option argument
- # and b) -o/--option=argument.
-
- REMOTE_GR_1_arg "NO-OP // ::→chroma/-git-verify-remote-or-group" # This definition is generic, reused later
- "REF_#_arg" "NO-OP // ::→chroma/-git-verify-ref" # This too
- "REMOTE_GR_#_arg" "NO-OP // ::→chroma/-git-verify-remote-or-group" # and this too
- # The hash `#' above denotes: an argument at any position
- # It will nicely match any following (above the first explicitly
- # numbered ones) arguments passed when using --multiple
-
- # A generic action
- NO_MATCH_\#_opt "* <<>> __style=\${FAST_THEME_NAME}incorrect-subtle // NO-OP"
- NO_MATCH_\#_arg "__style=\${FAST_THEME_NAME}incorrect-subtle // NO-OP"
-
- ## }}}
-
- ##
- ## PUSH
- ##
- ## {{{
-
- subcmd:push "PUSH_0_opt // REMOTE_1_arg // REF_#_arg // NO_MATCH_#_opt"
-
- PUSH_0_opt "
- (--receive-pack=|--exec=|--repo=|--push-option=|--signed=|
- --force-with-lease=|--signed=|--recurse-submodules=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (--help|--all|--mirror|--tags|--follow-tags|--atomic|-n|--dry-run|
- --porcelain|--delete|--tags|--follow-tags|--signed|--no-signed|
- --atomic|--no-atomic|-o|--push-option|--force-with-lease|
- --no-force-with-lease|-f|--force|-u|--set-upstream|--thin|
- --no-thin|-q|--quiet|-v|--verbose|--progress|--no-recurse-submodules|
- --verify|--no-verify|-4|--ipv4|-6|--ipv6)
- <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP"
-
- REMOTE_1_arg "NO-OP // ::→chroma/-git-verify-remote" # This definition is generic, reused later
-
- ### }}}
-
- ##
- ## PULL
- ##
- ## {{{
-
- subcmd:pull "PULL_0_opt // REMOTE_1_arg // REF_#_arg // NO_MATCH_#_opt"
-
- PULL_0_opt "
- (--recurse-submodules=|-S|--gpg-sign=|--log=|-s|--strategy=|-X|
- --strategy-option=|--rebase=|--depth=|--deepen=|--shallow-exclude=|
- --shallow-since=|--negotiation-tip|--upload-pack|-o|--server-option=|
- --no-recurse-submodules=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (--help|-q|--quiet|-v|--verbose|--progress|--no-recurse-submodules|
- --commit|--no-commit|--edit|--no-edit|--ff|--no-ff|--ff-only|
- --log|--no-log|--signoff|--no-signoff|--stat|-n|--no-stat|--squash|
- --no-squash|--verify-signatures|--no-verify-signatures|--summary|
- --no-summary|--allow-unrelated-histories|-r|--rebase|--no-rebase|
- --autostash|--no-autostash|--all|-a|--append|--unshallow|
- --update-shallow|-f|--force|-k|--keep|--no-tags|-u|--update-head-ok|
- --progress|-4|--ipv4|-6|--ipv6|--recurse-submodules)
- <<>> __style=\${FAST_THEME_NAME}single-hyphen-option // NO-OP"
-
- ## }}}
-
- ##
- ## COMMIT
- ##
- ## {{{
-
- subcmd:commit "COMMIT_#_opt // FILE_#_arg // NO_MATCH_#_opt"
-
- "COMMIT_#_opt" "
- (-m|--message=|-am)
- <<>> NO-OP // ::→chroma/-git-commit-msg-opt-action
- <<>> NO-OP // ::→chroma/-git-commit-msg-opt-ARG-action
- || (--help|-a|--all|-p|--patch|--reset-author|--short|--branch|
- --porcelain|--long|-z|--null|-s|--signoff|-n|--no-verify|
- --allow-empty|--allow-empty-message|-e|--edit|--no-edit|
- --amend|--no-post-rewrite|-i|--include|-o|--only|--untracked-files|
- -v|--verbose|-q|--quiet|--dry-run|--status|--no-status|--no-gpg-sign)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || (-C|--reuse-message=|-c|--reedit-message=|--fixup=|--squash=|
- -F|--file=|--author=|--date=|-t|--template=|--cleanup=|
- -u|--untracked-files=|-S|--gpg-sign=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action"
-
- # A generic action
- "FILE_#_arg" "NO-OP // ::→chroma/-git-verify-file"
-
- ## }}}
-
- ##
- ## MERGE
- ##
- ## {{{
-
- subcmd:merge "MERGE_0_opt // COMMIT_#_arg"
- MERGE_0_opt
- "(-m)
- <<>> NO-OP // ::→chroma/-git-commit-msg-opt-action
- <<>> NO-OP // ::→chroma/-git-commit-msg-opt-ARG-action
- (-S|--gpg-sign=|--log=|-e|--strategy=|-X|--strategy-option=|-F|
- --file)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (--help|--commit|--no-commit|-e|--edit|--no-edit|--ff|--no-ff|--ff-only|
- --log|--no-log|--signoff|--no-signoff|-n|--stat|--no-stat|--squash|
- --no-squash|--verify-signatures|--no-verify-signatures|--summary|
- --no-summary|-q|--quiet|-v|--verbose|--progress|--no-progress|
- --allow-unrelated-histories|--rerere-autoupdate|--no-rerere-autoupdate|
- --abort|--continue)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
- COMMIT_\#_arg "NO-OP // ::→chroma/-git-verify-commit"
-
- ## }}}
-
- ##
- ## RESET
- ##
- ## {{{
-
- subcmd:reset "RESET_0_opt^ // RESET_0_opt // RESET_#_arg // NO_MATCH_#_opt"
- "RESET_0_opt^" "
- (--soft|--mixed|--hard|--merge|--keep)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || (--soft|--mixed|--hard|--merge|--keep):del
- <<>> RESET_0_opt // RESET_#_arg
- || (--soft|--mixed|--hard|--merge|--keep):add
- <<>> RESET_1_arg // NO_MATCH_#_arg
- "
-
- RESET_0_opt "
- (-q|-p|--patch)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- RESET_1_arg "NO-OP // ::→chroma/-git-verify-commit"
-
- "RESET_#_arg" "NO-OP // ::→chroma/-git-RESET-verify-commit-or-file"
-
-
- ## }}}
-
- ##
- ## REVERT
- ##
- ## {{{
-
- subcmd:revert "REVERT_SEQUENCER_0_opt^ // REVERT_0_opt // REVERT_#_arg // NO_MATCH_#_opt"
- REVERT_0_opt "
- (-m|--mainline|-S|--gpg-sign=|--strategy=|-X|--strategy-option=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (-e|--edit|--no-edit|-n|--no-commit|-s|--signoff)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- "REVERT_SEQUENCER_0_opt^" "
- (--continue|--quit|--abort)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || (--continue|--quit|--abort):del
- <<>> REVERT_0_opt // REVERT_#_arg
- || (--continue|--quit|--abort):add
- <<>> NO_MATCH_#_arg"
-
- "REVERT_#_arg" "NO-OP // ::→chroma/-git-verify-commit"
-
- ## }}}
-
- ##
- ## DIFF
- ##
- ## TODO: #10 When a second argument is also a path and it points to a directory, then
- ## git appends the previous file name to it – good to implement this too
- ## {{{
-
- subcmd:diff "DIFF_NO_INDEX_0_opt^ // DIFF_0_opt // COMMIT_FILE_DIR_#_arg // NO_MATCH_#_opt"
-
- "DIFF_NO_INDEX_0_opt^" "
- --no-index
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || --no-index:del
- <<>> COMMIT_FILE_DIR_#_arg
- || --no-index:add
- <<>> FILE_1_arg // FILE_2_arg // NO_MATCH_#_arg"
- DIFF_0_opt "
- (-U|--unified=|--anchored=|--diff-algorithm=|--stat=|--dirstat|
- --submodule=|--color=|--color-moved=|--color-moved-ws=|--word-diff=|
- --word-diff-regex=|--color-words=|--ws-error-highlight=|--abbrev=|
- -B|--break-rewrites=|-M|--find-renames=|-C|--find-copies=|-l|
- --diff-filter=|-S|-G|--find-object=|--relative=|-O|--relative=|
- --inter-hunk-context=|--ignore-submodules=|--src-prefix=|--dst-prefix=|
- --line-prefix=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (-p|--patch|-u|-s|--no-patch|--raw|--patch-with-raw|--indent-heuristic|
- --no-indent-heuristic|--minimal|--patience|--histogram|--stat|
- --compact-summary|--numstat|--shortstat|--dirstat|--summary|
- --patch-with-stat|-z|--name-only|--name-status|--submodule|--no-color|
- --color-moved|--word-diff|--color-words|--no-renames|--check|
- --full-index|--binary|--abbrev|--break-rewrites|--find-renames|
- --find-copies|--find-copies-harder|-D|--pickaxe-all|--pickaxe-regex|
- --irreversible-delete|-R|--relative|-a|--text|--ignore-cr-at-eol|
- --ignore-space-at-eol|-b|--ignore-space-change|-w|--ignore-all-space|
- --ignore-blank-lines|-W|--function-context|--exit-code|--quiet|
- --ext-diff|--no-ext-diff|--textconv|--no-textconv|--ignore-submodules|
- --no-prefix|--ita-invisible-in-index|-1|--base|-2|--ours|-3|--theirs|
- -0|--cached)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- # A generic action
- "COMMIT_FILE_DIR_#_arg" "NO-OP // ::→chroma/-git-verify-commit-or-file-or-dir"
-
- # A generic action
- "FILE_1_arg" "NO-OP // ::→chroma/-git-verify-file"
-
- # A generic action
- "FILE_2_arg" "NO-OP // ::→chroma/-git-verify-file"
-
- ## }}}
-
- ##
- ## ADD
- ##
- ## {{{
-
- subcmd:add "ADD_0_opt // FILE_OR_DIR_#_arg // NO_MATCH_#_opt"
-
- ADD_0_opt "
- --chmod=
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (-v|--verbose|-f|--force|-i|--interactive|-n|--dry-run|
- -p|--patch|-e|--edit|--all|--no-all|-A|--all|--no-all|
- --ignore-removal|--no-ignore-removal|-u|--update|-N|
- --intent-to-add|--refresh|--ignore-errors|--ignore-missing|
- --renormalize|--no-warn-embedded-repo)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- FILE_OR_DIR_#_arg "NO-OP // ::→chroma/-git-verify-file-or-dir"
-
- ## }}}
-
- ##
- ## CHECKOUT
- ##
- ## {{{
-
- subcmd:checkout "CHECKOUT_BRANCH_0_opt^ //
- CHECKOUT_0_opt // FILE_OR_DIR_OR_BRANCH_OR_COMMIT_1_arg // FILE_#_arg //
- FILE_#_arg // NO_MATCH_#_opt"
-
- "CHECKOUT_BRANCH_0_opt^" "
- (-b|-B|--orphan)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || (-b|-B|--orphan):del
- <<>> FILE_OR_DIR_OR_BRANCH_OR_COMMIT_1_arg // FILE_#_arg // FILE_#_arg
- || (-b|-B|--orphan):add
- <<>> NEW_BRANCH_1_arg // COMMIT_2_arg // NO_MATCH_#_arg"
-
- NEW_BRANCH_1_arg "NO-OP // ::→chroma/-git-verify-correct-branch-name"
-
- COMMIT_2_arg "NO-OP // ::→chroma/-git-verify-commit"
-
- CHECKOUT_0_opt "
- --conflict=
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (-q|--quiet|--progress|--no-progress|-f|--force|--ours|--theirs|
- -b|-B|-t|--track|--no-track|-l|--detach|--orphan|
- --ignore-skip-worktree-bits|-m|--merge|-p|--patch|
- --ignore-other-worktrees|--no-ignore-other-worktrees)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- # A generic action
- COMMIT_1_arg "NO-OP // ::→chroma/-git-verify-commit"
-
- # Unused
- FILE_OR_BRANCH_OR_COMMIT_1_arg "NO-OP // ::→chroma/-git-file-or-ubranch-or-commit-verify"
- FILE_OR_DIR_OR_BRANCH_OR_COMMIT_1_arg "NO-OP // ::→chroma/-git-file-or-dir-or-ubranch-or-commit-verify"
-
- ## }}}
-
- ##
- ## REMOTE
- ##
- ## {{{
-
- subcmd:remote "REMOTE_0_opt // REMOTE_ADD_1_arg // REMOTE_RENAME_1_arg // REMOTE_REMOVE_1_arg //
- REMOTE_SET_HEAD_1_arg // REMOTE_SET_BRANCHES_1_arg //
- REMOTE_GET_URL_1_arg // REMOTE_SET_URL_1_arg // REMOTE_SHOW_1_arg //
- REMOTE_PRUNE_1_arg // REMOTE_UPDATE_1_arg"
-
- REMOTE_0_opt "(-v|--verbose)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_ADD_1_arg "add ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_ADD_OPTS_1_opt // REMOTE_A_NAME_2_arg //
- REMOTE_A_URL_3_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- REMOTE_RENAME_1_arg "rename ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_2_arg // REMOTE_A_NAME_3_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- REMOTE_REMOVE_1_arg "remove ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- REMOTE_SET_HEAD_1_arg "set-head ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_2_arg // BRANCH_3_arg //
- REMOTE_SET_HEAD_OPTS_1_opt // REMOTE_SET_HEAD_OPTS_2_opt //
- NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- REMOTE_SET_BRANCHES_1_arg "set-branches ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_SET_BRANCHES_OPTS_1_opt // REMOTE_2_arg //
- BRANCH_#_arg // NO_MATCH_#_opt"
-
- REMOTE_GET_URL_1_arg "get-url ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_GET_URL_OPTS_1_opt // REMOTE_2_arg //
- NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- REMOTE_SET_URL_1_arg "set-url ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_SET_URL_OPTS_1_opt^ //
- REMOTE_2_arg // REMOTE_A_URL_3_arg // REMOTE_A_URL_4_arg //
- NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- REMOTE_SHOW_1_arg "show ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_SHOW_OPTS_1_opt // REMOTE_#_arg // NO_MATCH_#_opt"
-
- REMOTE_PRUNE_1_arg "prune ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_PRUNE_OPTS_1_opt // REMOTE_#_arg // NO_MATCH_#_opt"
-
- REMOTE_UPDATE_1_arg "update ::::: __style=${FAST_THEME_NAME}subcommand // NO-OP <<>>
- add:REMOTE_UPDATE_OPTS_1_opt // REMOTE_GR_#_arg // NO_MATCH_#_opt"
-
- REMOTE_ADD_OPTS_1_opt "
- (-t|-m|--mirror=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (-f|--tags|--no-tags)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_SET_HEAD_OPTS_1_opt "
- (-a|--auto|-d|--delete)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_SET_HEAD_OPTS_2_opt "
- (-a|--auto|-d|--delete)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_SET_BRANCHES_OPTS_1_opt "
- --add
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_GET_URL_OPTS_1_opt "
- (--push|--all)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- "REMOTE_SET_URL_OPTS_1_opt^" "
- --push|--add|--delete
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || (--add|--delete):del
- <<>> REMOTE_A_URL_4_arg"
-
- REMOTE_SHOW_OPTS_1_opt "
- -n
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_PRUNE_OPTS_1_opt "
- (-n|--dry-run)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_UPDATE_OPTS_1_opt "
- (-p|--prune)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- REMOTE_A_NAME_2_arg "NO-OP // ::→chroma/-git-verify-correct-branch-name"
- REMOTE_A_NAME_3_arg "NO-OP // ::→chroma/-git-verify-correct-branch-name"
- REMOTE_A_URL_3_arg "NO-OP // ::→chroma/main-chroma-std-verify-url"
- REMOTE_A_URL_4_arg "NO-OP // ::→chroma/main-chroma-std-verify-url"
- BRANCH_3_arg "NO-OP // ::→chroma/-git-verify-branch"
- BRANCH_\#_arg "NO-OP // ::→chroma/-git-verify-branch"
- REMOTE_2_arg "NO-OP // ::→chroma/-git-verify-remote"
- REMOTE_\#_arg "NO-OP // ::→chroma/-git-verify-remote"
-
- ## }}}
-
- ##
- ## LOG
- ##
-
- subcmd:log "LOG_0_opt // LOG_1_arg // FILE_#_arg // NO_MATCH_#_opt"
-
- LOG_0_opt "
- (--decorate=|--decorate-refs=|--decorate-refs-exclude=|-L|-n|--max-count=|
- --skip=|--since=|--after=|--until=|--before=|--author=|--committer=|
- --grep-reflog=|--grep=|--min-parents=|--max-parents=|--branches=|--tags=|
- --remotes=|--glob=|--exclude=|--no-walk=|--pretty=|--format=|--encoding=|
- --expand-tabs=|--notes=|--show-notes=|--date=|--show-linear-break=|-U|
- --unified=|--anchored=|--diff-algorithm=|--stat=|--dirstat=|--submodule=|
- --color=|--color-moved=|--color-moved-ws=|--word-diff=|--word-diff-regex=|
- --color-words=|--ws-error-highlight=|--abbrev=|-B|--break-rewrites=|-M|
- --find-renames=|-C|--find-copies=|-l|--diff-filter=|-S|-G|--find-object=|
- --relative=|-O|--relative=|--inter-hunk-context=|--ignore-submodules=|
- --src-prefix=|--dst-prefix=|--line-prefix=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
-
- || (--follow|--decorate|--no-decorate|--source|--use-mailmap|--full-diff|
- --log-size|--all-match|--invert-grep|-i|--regexp-ignore-case|--basic-regexp|
- -E|--extended-regexp|-F|--fixed-strings|-P|--perl-regexp|--remove-empty|
- --merges|--no-merges|--no-min-parents|--no-max-parents|--first-parent|
- --not|--all|--branches|--tags|--remotes|--reflog|--single-worktree|
- --ignore-missing|--bisect|--stdin|--cherry-mark|--cherry-pick|--left-only|
- --right-only|--cherry|-g|--walk-reflogs|--merge|--boundary|--simplify-by-decoration|
- --full-history|--dense|--sparse|--simplify-merges|--ancestry-path|--date-order|
- --author-date-order|--topo-order|--reverse|--no-walk|--do-walk|--pretty|
- --abbrev-commit|--no-abbrev-commit|--oneline|--expand-tabs|--no-expand-tabs|
- --notes|--no-notes|--show-notes|--no-standard-notes|--show-signature|
- --relative-date|--parents|--children|--left-right|--graph|--show-linear-break|
- -c|--cc|-m|-r|-t|-p|-u|--patch|-s|--no-patch|--raw|--patch-with-raw|
- --indent-heuristic|--no-indent-heuristic|--minimal|--patience|--histogram|
- --stat|--compact-summary|--numstat|--shortstat|--dirstat|--summary|
- --patch-with-stat|-z|--name-only|--name-status|--submodule|--color|--no-color|
- --color-moved|--word-diff|--color-words|--no-renames|--check|--full-index|
- --binary|--abbrev|--break-rewrites|--find-renames|
- --find-copies|--find-copies-harder|-D|--irreversible-delete|
- --pickaxe-all|--pickaxe-regex|-R|--relative|-a|--text|--ignore-cr-at-eol|
- --ignore-space-at-eol|-b|--ignore-space-change|-w|--ignore-all-space|
- --ignore-blank-lines|-W|--function-context|--ext-diff|--no-ext-diff|
- --textconv|--no-textconv|--ignore-submodules|--no-prefix|
- --ita-invisible-in-index)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- LOG_1_arg "NO-OP // ::→chroma/-git-verify-rev-range-or-file"
-
- ##
- ## TAG
- ##
-
- subcmd:tag "TAG_D_0_opt^ // TAG_L_0_opt^ // TAG_V_0_opt^ // TAG_0_opt^"
-
- "TAG_0_opt^" "
- (-u|--local-user=|--cleanup=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || -m
- <<>> NO-OP // ::→chroma/-git-commit-msg-opt-action
- <<>> NO-OP // ::→chroma/-git-commit-msg-opt-ARG-action
- || (-F|--file)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/-git-verify-file
- || (-a|--annotate|-s|--sign|-f|-e|--edit)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || (-u|--local-user=|--cleanup=|-m|-F|--file|-a|--annotate|-s|--sign|
- -f|-e|--edit):add
- <<>> TAG_NEW_1_arg // COMMIT_2_arg // NO_MATCH_#_arg //
- NO_MATCH_#_opt"
-
- TAG_NEW_1_arg "NO-OP // ::→chroma/-git-verify-correct-branch-name"
-
- TAG_1_arg "NO-OP // ::→chroma/-git-verify-tag-name"
-
- "TAG_D_0_opt^" "
- (-d)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || -d:add
- <<>> TAG_#_arg // NO_MATCH_#_opt
- || -d:del
- <<>> TAG_0_opt // TAG_NEW_1_arg // COMMIT_2_arg"
-
- "TAG_#_arg" "NO-OP // ::→chroma/-git-verify-tag-name"
-
- "TAG_L_0_opt^" "
- (-l)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || -l:add
- <<>> TAG_L_0_opt // TAG_PAT_#_arg // NO_MATCH_#_opt
- || -l:del
- <<>> TAG_0_opt // TAG_NEW_1_arg // COMMIT_2_arg"
-
- TAG_L_0_opt "
- (-n|--contains|--no-contains|--points-at|--column=|--sort=|--format=|
- --color=)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action
- || (--column|--no-column|--create-reflog|--merged|--no-merged|--color|-i)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- "TAG_PAT_#_arg" "NO-OP // ::→chroma/main-chroma-std-verify-pattern"
-
- "TAG_V_0_opt^" "
- (-v)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- || -v:add
- <<>> TAG_V_0_opt // TAG_#_arg // NO_MATCH_#_opt
- || -v:del
- <<>> TAG_0_opt // TAG_NEW_1_arg // COMMIT_2_arg"
-
- TAG_V_0_opt "
- --format=
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-ARG-action"
-
- ##
- ## All remaining subcommands
- ##
- ## {{{
-
- "subcmd:*" "CATCH_ALL_#_opt"
- "CATCH_ALL_#_opt" "* <<>> NO-OP // ::→chroma/main-chroma-std-aopt-SEMI-action"
-
- ## }}}
-)
-
-# Called after entering just "git" on the command line
-→chroma/-git-first-call() {
- # Called for the first time - new command
- # FAST_HIGHLIGHT is used because it survives between calls, and
- # allows to use a single global hash only, instead of multiple
- # global variables
- FAST_HIGHLIGHT[chroma-git-counter]=0
- FAST_HIGHLIGHT[chroma-git-got-subcommand]=0
- FAST_HIGHLIGHT[chroma-git-subcommand]=""
- FAST_HIGHLIGHT[chrome-git-got-msg1]=0
- FAST_HIGHLIGHT[chrome-git-got-anymsg]=0
- FAST_HIGHLIGHT[chrome-git-occurred-double-hyphen]=0
- FAST_HIGHLIGHT[chroma-git-checkout-new]=0
- FAST_HIGHLIGHT[chroma-git-fetch-multiple]=0
- FAST_HIGHLIGHT[chroma-git-branch-change]=0
- FAST_HIGHLIGHT[chroma-git-option-with-argument-active]=0
- FAST_HIGHLIGHT[chroma-git-reset-etc-saw-commit]=0
- FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=0
- return 1
-}
-
-→chroma/-git-check-if-alias() {
- local _wrd="$1"
- local -a _result
-
- typeset -ga fsh__chroma__git__aliases
- _result=( ${(M)fsh__chroma__git__aliases[@]:#${_wrd}[[:space:]]##*} )
- →chroma/main-chroma-print "Got is-alias-_result: $_result"
- [[ -n "$_result" ]] && \
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]="${${${_result#* }## ##}%% *}"
-}
-
-# A hook that returns the list of git's
-# available subcommands in $reply
-→chroma/-git-get-subcommands() {
- local __svalue
- integer __ivalue
- LANG=C .fast-run-command "git help -a" chroma-${FAST_HIGHLIGHT[chroma-current]}-subcmd-list "" $(( 15 * 60 ))
- if [[ "${__lines_list[1]}" = See* ]]; then
- # (**)
- # git >= v2.20, the aliases in the `git help -a' command
- __lines_list=( ${${${${(M)__lines_list[@]:#([[:space:]](#c3,3)[a-zA-Z0-9_]*|Command aliases)}##[[:space:]]##}//(#s)Command\ aliases(#e)/Command_aliases}} )
- __svalue="+${__lines_list[(I)Command_aliases]}"
- __lines_list[1,__svalue-1]=( ${(@)__lines_list[1,__svalue-1]%%[[:space:]]##*} )
- else
- # (**)
- # git < v2.20, add aliases through extra code
- __lines_list=( ${(s: :)${(M)__lines_list[@]:# [a-z]*}} )
-
- __svalue=${#__lines_list}
- # This allows to check if the command is an alias - we want to
- # highlight the aliased command just like the target command of
- # the alias
- .fast-run-command "+git config --get-regexp 'alias.*'" chroma-${FAST_HIGHLIGHT[chroma-current]}-alias-list "[[:space:]]#alias." $(( 15 * 60 ))
- fi
-
- __tmp=${#__lines_list}
- typeset -ga fsh__chroma__git__aliases
- fsh__chroma__git__aliases=( ${__lines_list[__svalue+1,__tmp]} )
- [[ ${__lines_list[__svalue]} != "Command_aliases" ]] && (( ++ __svalue, __ivalue=0, 1 )) || (( __ivalue=1 ))
- __lines_list[__svalue,__tmp]=( ${(@)__lines_list[__svalue+__ivalue,__tmp]%%[[:space:]]##*} )
- reply=( "${__lines_list[@]}" )
-}
-
-# A generic handler
-→chroma/-git-verify-remote() {
- local _wrd="$4"
- .fast-run-git-command "git remote" "chroma-git-remotes-$PWD" "" 10
- [[ -n ${__lines_list[(r)$_wrd]} ]] && {
- __style=${FAST_THEME_NAME}correct-subtle; return 0
- } || {
- [[ $_wrd != *:* ]] && { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
- }
-}
-
-# A generic handler - checks if given ref is correct
-→chroma/-git-verify-ref() {
- local _wrd="$4"
- _wrd="${_wrd%%:*}"
- .fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-refs-$PWD" "refs/heads" 10
- [[ -n ${__lines_list[(r)$_wrd]} ]] && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
-}
-
-# A generic handler - checks if given remote or group is correct
-→chroma/-git-verify-remote-or-group() {
- →chroma/-git-verify-remote "$@" && return 0
- # The check for a group is to follow below
- integer _start="$2" _end="$3"
- local _scmd="$1" _wrd="$4"
-}
-
-# A generic handler - checks whether the file exists
-→chroma/-git-verify-file() {
- integer _start="$2" _end="$3" __pos __start __end
- local _wrd="$4" bg
-
- [[ -f $_wrd ]] && {
- (( __start=_start, __end=_end, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
- bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]%bg=*}
- ((1))
- } || {
- (( __start=_start, __end=_end, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]%bg=*}
- }
-
- [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} && \
- ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path]} != \
- ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}
- ]] && \
- for (( __pos = 1; __pos <= (_end-_start); __pos++ )) {
- [[ ${_wrd[__pos]} == "/" ]] && {
- [[ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} = *bg=* ]] && {
- (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
- reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}")
- ((1))
- } || {
- (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
- reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}${bg:+,$bg}")
- }
- }
- }
-}
-
-# A generic handler - checks whether the file exists
-→chroma/-git-verify-file-or-dir() {
- integer _start="$2" _end="$3" __pos __start __end retval
- local _wrd="$4" bg
-
- __style=
- [[ -f $_wrd || -d $_wrd ]] && {
- (( __start=_start, __end=_end, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
- bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]%bg=*}
- ((1))
- } || {
- (( __start=_start, __end=_end, __start >= 0 )) && \
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- bg=${(M)FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]%bg=*}
- retval=1
- }
-
- [[ -n ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} && \
- ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path]} != \
- ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}
- ]] && \
- for (( __pos = 1; __pos <= (_end-_start); __pos++ )) {
- [[ ${_wrd[__pos]} == "/" ]] && {
- [[ ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]} = *bg=* ]] && {
- (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
- reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}")
- ((1))
- } || {
- (( __start=_start+__pos-__PBUFLEN, __start >= 0 )) && \
- reply+=("$(( __start - 1 )) $__start ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}path_pathseparator]}${bg:+,$bg}")
- }
- }
- }
- return $retval
-}
-
-→chroma/-git-verify-branch() {
- local _wrd="$4"
- .fast-run-git-command "git for-each-ref --format='%(refname:short)'" "chroma-git-branches-$PWD" "refs/heads" 10
- if [[ -n ${__lines_list[(r)$_wrd]} ]] {
- __style=${FAST_THEME_NAME}correct-subtle; return 0
- } elif [[ -n ${__lines_list[(r)origin/$_wrd]} ]] {
- __style=${FAST_THEME_NAME}correct-subtle; return 0
- } else {
- __style=${FAST_THEME_NAME}incorrect-subtle; return 1
- }
-}
-
-→chroma/-git-verify-also-unfetched-ref() {
- local _wrd="$4"
- .fast-run-git-command "git config --get checkout.defaultRemote" \
- "chroma-git-defaultRemote-$PWD" "" 10
- local remote="${__lines_list[1]:-origin}"
- .fast-run-git-command "git rev-list --count --no-walk
- --glob=\"refs/remotes/$remote/$_wrd\"" \
- "chroma-git-unfetched-ref-$PWD" "" 10
-
- (( __lines_list[1] )) && { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
-}
-
-# A generic handler
-→chroma/-git-file-or-ubranch-or-commit-verify() {
- →chroma/-git-verify-commit "$@" && return
- →chroma/-git-verify-file "$@" && return
- →chroma/-git-verify-branch "$@" && return
- →chroma/-git-verify-also-unfetched-ref "$@"
-}
-
-# A generic handler
-→chroma/-git-file-or-dir-or-ubranch-or-commit-verify() {
- →chroma/-git-verify-commit "$@" && return
- →chroma/-git-verify-file-or-dir "$@" && return
- →chroma/-git-verify-branch "$@" && return
- →chroma/-git-verify-also-unfetched-ref "$@"
-}
-
-# A generic handler
-→chroma/-git-verify-correct-branch-name() {
- local _wrd="$4"
- →chroma/-git-verify-commit "$@" && \
- { __style=${FAST_THEME_NAME}incorrect-subtle; return 0; }
-
- →chroma/-git-verify-remote "$@" && \
- { __style=${FAST_THEME_NAME}incorrect-subtle; return 0; }
-
- [[ "$_wrd" != ./* && "$_wrd" != *..* && "$_wrd" != *[~\^\ $'\t']* &&
- "$_wrd" != */ && "$_wrd" != *.lock && "$_wrd" != *\\* ]] && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
-}
-
-# A generic handler that checks if given commit reference is correct
-→chroma/-git-verify-commit() {
- local _wrd="$4"
- __lines_list=()
- .fast-run-git-command --status "git rev-parse --verify --quiet \"$_wrd\"" \
- "chroma-git-commits-$PWD-$_wrd" "" $(( 1.5 * 60 ))
- if (( __lines_list[1] == 0 )); then
- __style=${FAST_THEME_NAME}correct-subtle
- return 0
- fi
- __style=${FAST_THEME_NAME}incorrect-subtle
- return 1
-}
-
-# A generic handler that checks if given commit reference
-# is correct or if it's a file that exists
-→chroma/-git-verify-commit-or-file() {
- →chroma/-git-verify-commit "$@" && return
- →chroma/-git-verify-file "$@"
-}
-
-# A generic handler that checks if given commit reference
-# is correct or if it's a file or directives that exists
-→chroma/-git-verify-commit-or-file-or-dir() {
- →chroma/-git-verify-commit "$@" && return
- →chroma/-git-verify-file-or-dir "$@"
-}
-
-# A generic handler that checks if given revision range
-# is correct or if a file of that name exists
-→chroma/-git-verify-rev-range-or-file() {
- local _wrd="$4"
-
- →chroma/-git-verify-commit "$@" && return 0
-
- if [[ "$_wrd" = *..* ]]; then
- (( FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file] )) && {
- →chroma/-git-verify-file "$@" && return 0
- __style=${FAST_THEME_NAME}unknown-token
- return 1
- }
-
- __style=""
- return 0
- fi
-
- →chroma/-git-verify-file "$@" && \
- { FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=1; return 0; }
-
- __style=""
- return 1
-}
-
-→chroma/-git-verify-tag-name() {
- local _wrd="$4"
- .fast-run-git-command "git tag" "chroma-git-tags-$PWD" "" $(( 2*60 ))
- [[ -n ${__lines_list[(r)$_wrd]} ]] && \
- __style=${FAST_THEME_NAME}correct-subtle || \
- __style=${FAST_THEME_NAME}incorrect-subtle
-}
-
-# A handler for the commit's -m/--message options.Currently
-# does the same what →chroma/main-chroma-std-aopt-action does
-→chroma/-git-commit-msg-opt-action() {
- →chroma/main-chroma-std-aopt-action "$@"
-}
-
-# A handler for the commit's -m/--message options' argument
-→chroma/-git-commit-msg-opt-ARG-action() {
- integer _start="$2" _end="$3"
- local _scmd="$1" _wrd="$4"
-
- (( __start >= 0 )) || return
-
- # Match the message body in case of an --message= option
- if [[ "$_wrd" = (#b)(--message=)(*) && -n "${match[2]}" ]]; then
- _wrd="${(Q)${match[2]//\`/x}}"
- # highlight --message=>>something<<
- reply+=("$(( __start+10 )) $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-quoted-argument]}")
- elif [[ "$_wrd" != --message ]]; then
- # highlight the message's body
- reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-quoted-argument]}")
- fi
-
- integer length=${FAST_HIGHLIGHT[git-cmsg-len]:-50}
-
- if (( ${#_wrd} > length )); then
- for (( __idx1 = 1, __idx2 = 1; __idx1 <= length; ++ __idx1, ++ __idx2 )); do
- # Use __arg from the fast-highlight-process's scope
- while [[ "${__arg[__idx2]}" != "${_wrd[__idx1]}" ]]; do
- (( ++ __idx2 ))
- (( __idx2 > __asize )) && { __idx2=-1; break; }
- done
- (( __idx2 == -1 )) && break
- done
- if (( __idx2 != -1 )); then
- if [[ -n "${match[1]}" ]]; then
- reply+=("$(( __start+__idx2 )) $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- else
- reply+=("$(( __start+__idx2-1 )) $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- fi
- fi
- fi
-}
-
-# A RESET handler
-# TODO: differentiate tree-ish from commit
-→chroma/-git-RESET-verify-commit-or-file() {
- →chroma/-git-verify-commit "$@" && {
- →chroma/-git-verify-file "$@" && {
- # TODO: with -p/--patch, the are optional,
- # and this argument will be taken as a commit in a
- # specific circumstances
- FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=1
- return 0
- }
-
- (( FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file] ||
- FAST_HIGHLIGHT[chroma-git-reset-etc-saw-commit] )) && \
- { __style=${FAST_THEME_NAME}unknown-token; return 1; }
-
- FAST_HIGHLIGHT[chroma-git-reset-etc-saw-commit]=1
-
- __style=${FAST_THEME_NAME}correct-subtle
-
- return 0
- }
-
- →chroma/-git-verify-file "$@" && \
- { FAST_HIGHLIGHT[chroma-git-reset-etc-saw-file]=1; return 0; }
-
- return 1
-}
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-nmcli.ch" "b/\342\206\222chroma/-nmcli.ch"
deleted file mode 100644
index e0df88c..0000000
--- "a/\342\206\222chroma/-nmcli.ch"
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-(( next_word = 2 | 8192 ))
-[[ "$__arg_type" = 3 ]] && return 2
-
-typeset -A subcommands
-local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4" subcommand
-subcommands=(
- help "_"
- general "help status hostname permissions logging _"
- networking "help on off connectivity _"
- radio "help all wifi wwan _"
- connection "help show up down add modify clone edit delete monitor reload load import export _"
- device "help status show set connect reapply modify disconnect delete monitor wifi lldp _"
- agent "help secret polkit all _"
- monitor "help _"
- _ "_"
-)
-
-if (( __first_call )); then
- FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]=""
- FAST_HIGHLIGHT[chroma-nmcli-subcommand-b]=""
- return 1
-elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
-elif [[ "$2" = -* ]]; then
- return 1
-elif [[ -z ${FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]} ]]; then
- for subcommand in ${(@k)subcommands}; do
- [[ $subcommand = $__wrd* ]] && break || subcommand="_"
- done
- if [[ $subcommand = _ ]]; then
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- else
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}subcommand]}")
- fi
- FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]="$subcommand"
-elif [[ -z ${FAST_HIGHLIGHT[chroma-nmcli-subcommand-b]} ]]; then
- for subcommand in ${(s. .)subcommands[${FAST_HIGHLIGHT[chroma-nmcli-subcommand-a]}]}; do
- [[ "$subcommand" = $__wrd* ]] && break || subcommand="_"
- done
- if [[ $subcommand = _ ]]; then
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- else
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}subcommand]}")
- fi
- FAST_HIGHLIGHT[chroma-nmcli-subcommand-b]="$subcommand"
-else
- return 1
-fi
-
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-perl.ch" "b/\342\206\222chroma/-perl.ch"
deleted file mode 100644
index 26efb76..0000000
--- "a/\342\206\222chroma/-perl.ch"
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-# Chroma function for command `perl'. It highlights code passed to perl
-# with -e option - does syntax check by calling `perl -ce', then highlights
-# as correct or incorrect code.
-#
-# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
-# $2 - the current token, also accessible by $__arg from the above scope -
-# basically a private copy of $__arg
-# $3 - a private copy of $_start_pos, i.e. the position of the token in the
-# command line buffer, used to add region_highlight entry (see man),
-# because Zsh colorizes by *ranges* in command line buffer
-# $4 - a private copy of $_end_pos from the above scope
-#
-
-(( next_word = 2 | 8192 ))
-
-local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
-local __style
-integer __idx1 __idx2
-
-(( __first_call )) && {
- # Called for the first time - new command.
- # FAST_HIGHLIGHT is used because it survives between calls, and
- # allows to use a single global hash only, instead of multiple
- # global variables.
- FAST_HIGHLIGHT[chrome-perl-got-eswitch]=0
- return 1
-} || {
- # Following call, i.e. not the first one.
-
- # Check if chroma should end – test if token is of type
- # "starts new command", if so pass-through – chroma ends
- [[ "$__arg_type" = 3 ]] && return 2
-
- if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
- fi
-
- if [[ "$__wrd" = -* && ${FAST_HIGHLIGHT[chroma-perl-got-subcommand]} -eq 0 ]]; then
- __style=${FAST_THEME_NAME}${${${__wrd:#--*}:+single-hyphen-option}:-double-hyphen-option}
-
- if [[ "$__wrd" = "-e" || ("$__wrd" = -*e* && "$__wrd" != --*) ]]; then
- FAST_HIGHLIGHT[chrome-perl-got-eswitch]=1
- fi
- else
- __wrd="${__wrd//\`/x}"
- __arg="${__arg//\`/x}"
- __wrd="${(Q)__wrd}"
- if (( FAST_HIGHLIGHT[chrome-perl-got-eswitch] == 1 )); then
- FAST_HIGHLIGHT[chrome-perl-got-eswitch]=0
- if perl -ce "$__wrd" >/dev/null 2>&1; then
- # Add correct-subtle style
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
- else
- # Add incorrect-subtle style
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
- fi
- else
- # Pass-through to the big-loop outside
- return 1
- fi
- fi
-}
-
-# Add region_highlight entry (via `reply' array)
-#
-# This is a common place of adding such entry, but any above
-# code can do it itself (and it does) and skip setting __style
-# to disable this code.
-[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-
-# We aren't passing-through, do obligatory things ourselves
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/-source.ch" "b/\342\206\222chroma/-source.ch"
deleted file mode 100644
index fb6614f..0000000
--- "a/\342\206\222chroma/-source.ch"
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-# vim: ft=zsh sw=2 ts=2 et
-#
-# Chroma for `source' builtin - verifies if file to be sourced compiles
-# correctly.
-#
-# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
-#
-# $2 - the current token, also accessible by $__arg from the above scope -
-# basically a private copy of $__arg; the token can be eg.: "grep"
-#
-# $3 - a private copy of $_start_pos, i.e. the position of the token in the
-# command line buffer, used to add region_highlight entry (see man),
-# because Zsh colorizes by *ranges* in command line buffer
-#
-# $4 - a private copy of $_end_pos from the above scope
-#
-
-(( next_word = 2 | 8192 ))
-
-local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
-local __style __chars __home=$FAST_WORK_DIR
-integer __idx1 __idx2
-
-# First call, i.e. command starts, i.e. "grep" token etc.
-(( __first_call )) && {
- FAST_HIGHLIGHT[chroma-src-counter]=0
- __style=${FAST_THEME_NAME}builtin
-
-} || {
- # Following call, i.e. not the first one.
-
- # Check if chroma should end – test if token is of type
- # "starts new command", if so pass-through – chroma ends
- [[ "$__arg_type" = 3 ]] && return 2
-
- if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
- fi
-
- if [[ "$__wrd" = -* ]]; then
- # Detected option, add style for it.
- [[ "$__wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
- __style=${FAST_THEME_NAME}single-hyphen-option
- else
- # Count non-option tokens.
- (( FAST_HIGHLIGHT[chroma-src-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-src-counter] ))
-
- if (( FAST_HIGHLIGHT[chroma-src-counter] == 1 )); then
- command mkdir -p "$__home"
- command cp -f "${__wrd}" "$__home" 2>/dev/null && {
- zcompile "$__home"/"${__wrd:t}" 2>/dev/null 1>&2 && __style=${FAST_THEME_NAME}correct-subtle || __style=${FAST_THEME_NAME}incorrect-subtle
- }
- elif (( FAST_HIGHLIGHT[chroma-src-counter] == 2 )); then
- # Handle paths, etc. normally - just pass-through to the big
- # highlighter (the main FSH highlighter, used before chromas).
- return 1
- fi
- fi
-}
-
-# Add region_highlight entry (via `reply' array).
-#
-# This is a common place of adding such entry, but any above
-# code can do it itself (and it does) and skip setting __style
-# to disable this code.
-[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-
-# We aren't passing-through (no return 1 occured), do obligatory things ourselves.
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
\ No newline at end of file
diff --git "a/\342\206\222chroma/-zinit.ch" "b/\342\206\222chroma/-zinit.ch"
deleted file mode 100644
index 73e0005..0000000
--- "a/\342\206\222chroma/-zinit.ch"
+++ /dev/null
@@ -1,377 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-# Chroma function for command `git'. It colorizes the part of command
-# line that holds `git' invocation.
-
-(( FAST_HIGHLIGHT[-zinit.ch-chroma-def] )) && return 1
-
-FAST_HIGHLIGHT[-zinit.ch-chroma-def]=1
-
-typeset -gA fsh__zinit__chroma__def
-fsh__zinit__chroma__def=(
- ##
- ## No subcommand
- ##
- ## {{{
-
- subcmd:NULL "NULL_0_opt"
- NULL_0_opt "(-help|--help|-h)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- "subcommands" "(help|man|self-update|cd|times|zstatus|load|light|unload|snippet|ls|ice||update|status|report|delete|loaded|list|cd|create|edit|glance|stress|changes|recently|clist|completions|cdisable|cname|cenable|cname|creinstall|cuninstall|csearch|compinit|dtrace|dstart|dstop|dunload|dreport|dclear|compile|uncompile|compiled|cdlist|cdreplay|cdclear|srv|recall|env-whitelist|bindkeys|module)"
-
- ## }}}
-
- # Generic actions
- NO_MATCH_\#_opt "* <<>> __style=\${FAST_THEME_NAME}incorrect-subtle // NO-OP"
- NO_MATCH_\#_arg "__style=\${FAST_THEME_NAME}incorrect-subtle // NO-OP"
-
-
- ##
- ## `ice'
- ##
- ## {{{
-
- subcmd:ice "ICE_#_arg // NO_MATCH_#_opt"
-
- "ICE_#_arg" "NO-OP // ::→chroma/-zinit-check-ice-mod"
-
- ## }}}
-
- ##
- ## `snippet'
- ##
- ## {{{
-
- subcmd:snippet "SNIPPET_0_opt // SNIPPET_1_arg // NO_MATCH_#_opt //
- NO_MATCH_#_arg"
-
- SNIPPET_0_opt "(-f|--command)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- SNIPPET_1_arg "NO-OP // ::→chroma/-zinit-verify-snippet"
-
- ## }}}
-
- ##
- ## `load'
- ##
- ## {{{
-
- "subcmd:load"
- "LOAD_1_arg // LOAD_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- LOAD_1_arg "NO-OP // ::→chroma/-zinit-verify-plugin"
-
- LOAD_2_arg "NO-OP // ::→chroma/-zinit-verify-plugin"
-
- ## }}}
-
- ##
- ## `compile|uncompile|stress|edit|glance|recall|status|cd|changes`
- ##
- ## {{{
-
- "subcmd:(compile|uncompile|stress|edit|glance|recall|status|cd|changes)"
- "PLGSNP_1_arg // PLGSNP_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- PLGSNP_1_arg "NO-OP // ::→chroma/-zinit-verify-plugin-or-snippet"
-
- PLGSNP_2_arg "NO-OP // ::→chroma/-zinit-verify-plugin-or-snippet"
-
- ## }}}
-
- ##
- ## `update'
- ##
- ## {{{
-
- subcmd:update "UPDATE_0_opt // PLGSNP_1_arg // PLGSNP_2_arg //
- NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- UPDATE_0_opt "
- (--all|-r|--reset|-q|--quiet|-p|--parallel)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- ## }}}
-
- ##
- ## `light'
- ##
- ## {{{
-
- subcmd:light "LIGHT_0_opt // LOAD_1_arg // LOAD_2_arg // NO_MATCH_#_opt //
- NO_MATCH_#_arg"
-
- LIGHT_0_opt "-b
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- ## }}}
-
- ##
- ## `unload'
- ##
- ## {{{
-
- subcmd:unload "UNLOAD_0_opt // UNLOAD_1_arg // UNLOAD_2_arg // NO_MATCH_#_opt //
- NO_MATCH_#_arg"
-
- UNLOAD_0_opt "-q
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- UNLOAD_1_arg "NO-OP // ::→chroma/-zinit-verify-loaded-plugin"
-
- UNLOAD_2_arg "NO-OP // ::→chroma/-zinit-verify-loaded-plugin"
-
- ## }}}
-
- ##
- ## `report'
- ##
- ## {{{
-
- subcmd:report "REPORT_0_opt // UNLOAD_1_arg // UNLOAD_2_arg // NO_MATCH_#_opt //
- NO_MATCH_#_arg"
-
- REPORT_0_opt "--all
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- ## }}}
-
- ##
- ## `delete'
- ##
- ## {{{
-
- "subcmd:delete"
- "DELETE_0_opt // PLGSNP_1_arg // PLGSNP_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- DELETE_0_opt "
- (--all|--clean|-y|--yes|-q|--quiet)
- <<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"
-
- ## }}}
-
- ##
- ## `cenable'
- ##
- ## {{{
-
- subcmd:cenable "COMPLETION_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- COMPLETION_1_arg "NO-OP // ::→chroma/-zinit-verify-disabled-completion"
-
- ## }}}
-
- ##
- ## `cdisable'
- ##
- ## {{{
-
- subcmd:cdisable "DISCOMPLETION_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- DISCOMPLETION_1_arg "NO-OP // ::→chroma/-zinit-verify-completion"
-
- ## }}}
-
-
- ##
- ## `light'
- ##
- ## {{{
-
- subcmd:uncompile "UNCOMPILE_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"
-
- UNCOMPILE_1_arg "NO-OP // ::→chroma/-zinit-verify-compiled-plugin"
-
- ## }}}
-
- ##
- ## `*'
- ##
- ## {{{
-
- "subcmd:*" "CATCH_ALL_#_opt"
- "CATCH_ALL_#_opt" "* <<>> NO-OP // ::→chroma/main-chroma-std-aopt-SEMI-action"
-
- ## }}}
-)
-
-#→chroma/-zinit-first-call() {
- # This is being done in the proper place - in -fast-highlight-process
- #FAST_HIGHLIGHT[chroma-zinit-ice-elements-svn]=0
-#}
-
-→chroma/-zinit-verify-plugin() {
- local _scmd="$1" _wrd="$4"
-
- [[ -d "$_wrd" ]] && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; }
-
- typeset -a plugins
- plugins=( "${ZINIT[PLUGINS_DIR]}"/*(N:t) )
- plugins=( "${plugins[@]//---//}" )
- plugins=( "${plugins[@]:#_local/zinit}" )
- plugins=( "${plugins[@]:#custom}" )
-
- [[ -n "${plugins[(r)$_wrd]}" ]] && \
- __style=${FAST_THEME_NAME}correct-subtle || \
- return 1
- #__style=${FAST_THEME_NAME}incorrect-subtle
- return 0
-}
-
-→chroma/-zinit-verify-plugin-or-snippet() {
- →chroma/-zinit-verify-plugin "$1" "" "" "$4" || \
- →chroma/-zinit-verify-snippet "$1" "" "" "$4"
- return $?
-}
-
-→chroma/-zinit-verify-loaded-plugin() {
- local _scmd="$1" _wrd="$4"
- typeset -a plugins absolute1 absolute2 absolute3 normal
- plugins=( "${ZINIT_REGISTERED_PLUGINS[@]:#_local/zinit}" )
- normal=( "${plugins[@]:#%*}" )
- absolute1=( "${(M)plugins[@]:#%*}" )
- absolute1=( "${absolute1[@]/\%\/\//%/}" )
- local hm="${HOME%/}"
- absolute2=( "${absolute1[@]/$hm/HOME}" )
- absolute3=( "${absolute1[@]/\%/}" )
- plugins=( $absolute1 $absolute2 $absolute3 $normal )
-
- [[ -n "${plugins[(r)$_wrd]}" ]] && \
- __style=${FAST_THEME_NAME}correct-subtle || \
- return 1
- #__style=${FAST_THEME_NAME}incorrect-subtle
-
- return 0
-}
-
-→chroma/-zinit-verify-completion() {
- local _scmd="$1" _wrd="$4"
- # Find enabled completions
- typeset -a completions
- completions=( "${ZINIT[COMPLETIONS_DIR]}"/_*(N:t) )
- completions=( "${completions[@]#_}" )
-
- [[ -n "${completions[(r)${_wrd#_}]}" ]] && \
- __style=${FAST_THEME_NAME}correct-subtle || \
- return 1
-
- return 0
-}
-
-→chroma/-zinit-verify-disabled-completion() {
- local _scmd="$1" _wrd="$4"
- # Find enabled completions
- typeset -a completions
- completions=( "${ZINIT[COMPLETIONS_DIR]}"/[^_]*(N:t) )
-
- [[ -n "${completions[(r)${_wrd#_}]}" ]] && \
- __style=${FAST_THEME_NAME}correct-subtle || \
- return 1
-
- return 0
-}
-
-→chroma/-zinit-verify-compiled-plugin() {
- local _scmd="$1" _wrd="$4"
-
- typeset -a plugins
- plugins=( "${ZINIT[PLUGINS_DIR]}"/*(N) )
-
- typeset -a show_plugins p matches
- for p in "${plugins[@]}"; do
- matches=( $p/*.zwc(N) )
- if [ "$#matches" -ne "0" ]; then
- p="${p:t}"
- [[ "$p" = (_local---zinit|custom) ]] && continue
- p="${p//---//}"
- show_plugins+=( "$p" )
- fi
- done
-
- [[ -n "${show_plugins[(r)$_wrd]}" ]] && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- return 1
-}
-
-→chroma/-zinit-verify-snippet() {
- local _scmd="$1" url="$4" dirname local_dir
- url="${${url#"${url%%[! $'\t']*}"}%/}"
- id_as="${FAST_HIGHLIGHT[chroma-zinit-ice-elements-id-as]:-${ZINIT_ICE[id-as]:-$url}}"
-
- filename="${${id_as%%\?*}:t}"
- dirname="${${id_as%%\?*}:t}"
- local_dir="${${${id_as%%\?*}:h}/:\/\//--}"
- [[ "$local_dir" = "." ]] && local_dir="" || local_dir="${${${${${local_dir#/}//\//--}//=/--EQ--}//\?/--QM--}//\&/--AMP--}"
- local_dir="${ZINIT[SNIPPETS_DIR]}${local_dir:+/$local_dir}"
-
- (( ${+ZINIT_ICE[svn]} || ${FAST_HIGHLIGHT[chroma-zinit-ice-elements-svn]} )) && {
- # TODO: handle the SVN path's specifics
- [[ -d "$local_dir/$dirname" ]] && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- return 1
- } || {
- # TODO: handle the non-SVN path's specifics
- [[ -d "$local_dir/$dirname" ]] && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- return 1
- }
-}
-
-→chroma/-zinit-check-ice-mod() {
- local _scmd="$1" _wrd="$4"
- [[ "$_wrd" = (svn(\'|\")*|svn) ]] && \
- FAST_HIGHLIGHT[chroma-zinit-ice-elements-svn]=1
- [[ "$_wrd" = (#b)(id-as(:|)(\'|\")(*)(\'|\")|id-as:(*)|id-as(*)) ]] && \
- FAST_HIGHLIGHT[chroma-zinit-ice-elements-id-as]="${match[4]}${match[6]}${match[7]}"
-
- # Copy from zinit-autoload.zsh / -zplg-recall
- local -a ice_order nval_ices ext_val_ices
- ext_val_ices=( ${(@)${(@Ms.|.)ZINIT_EXTS[ice-mods]:#*\'\'*}//\'\'/} )
-
- ice_order=(
- svn proto from teleid bindmap cloneopts id-as depth if wait load
- unload blockf pick bpick src as ver silent lucid notify mv cp
- atinit atclone atload atpull nocd run-atpull has cloneonly make
- service trackbinds multisrc compile nocompile nocompletions
- reset-prompt wrap-track reset sh \!sh bash \!bash ksh \!ksh csh
- \!csh aliases countdown ps-on-unload ps-on-update trigger-load
- light-mode is-snippet atdelete pack git verbose on-update-of
- subscribe param extract
- # Include all additional ices – after
- # stripping them from the possible: ''
- ${(@s.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
- )
- nval_ices=(
- blockf silent lucid trackbinds cloneonly nocd run-atpull
- nocompletions sh \!sh bash \!bash ksh \!ksh csh \!csh
- aliases countdown light-mode is-snippet git verbose
-
- # Include only those additional ices,
- # don't have the '' in their name, i.e.
- # aren't designed to hold value
- ${(@)${(@s.|.)ZINIT_EXTS[ice-mods]}:#*\'\'*}
-
- # Must be last
- svn
- )
-
- if [[ "$_wrd" = (#b)(${(~j:|:)${ice_order[@]:#(${(~j:|:)nval_ices[@]:#(${(~j:|:)ext_val_ices[@]})})}})(*) ]]; then
- reply+=("$(( __start )) $(( __start+${mend[1]} )) ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-hyphen-option]}")
- reply+=("$(( __start+${mbegin[2]} )) $(( __end )) ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}optarg-string]}")
- -fast-highlight-string
- return 0
- elif [[ "$_wrd" = (#b)(${(~j:|:)nval_ices[@]}) ]]; then
- __style=${FAST_THEME_NAME}single-hyphen-option
- return 0
- else
- __style=${FAST_THEME_NAME}incorrect-subtle
- return 1
- fi
-}
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et
diff --git "a/\342\206\222chroma/main-chroma.ch" "b/\342\206\222chroma/main-chroma.ch"
deleted file mode 100644
index 3224ec1..0000000
--- "a/\342\206\222chroma/main-chroma.ch"
+++ /dev/null
@@ -1,460 +0,0 @@
-# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
-#
-# Main chroma function. It allows to create the command-dedicated chromas
-# (like -git.ch) through a definition provided by `chroma_def' array (read
-# from the upper scope).
-#
-# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
-# $2 - the current token, also accessible by $__arg from the above scope -
-# basically a private copy of $__arg
-# $3 - a private copy of $_start_pos, i.e. the position of the token in the
-# command line buffer, used to add region_highlight entry (see man),
-# because Zsh colorizes by *ranges* in command line buffer
-# $4 - a private copy of $_end_pos from the above scope
-#
-
-(( next_word = 2 | 8192 ))
-
-→chroma/main-chroma-print() {
- (( FAST_HIGHLIGHT[DEBUG] )) && print "$@" >> /tmp/fsh-dbg
-}
-
-local __chroma_name="${1#\%}" __first_call="$2" __wrd="$3" __start_pos="$4" __end_pos="$5"
-
-# Not a well formed chroma name
-[[ -z "$__chroma_name" ]] && return 1
-
-# Load the fsh_{name-of-the-chroma}_chroma_def array
-(( !FAST_HIGHLIGHT[-${__chroma_name}.ch-chroma-def] )) && →chroma/-${__chroma_name}.ch
-
-→chroma/main-chroma-print -r -- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-→chroma/main-chroma-print -r -- @@@@@@@ local __chroma_name="${1#\%}" __first_call="$2" __wrd="$3" __start_pos="$4" __end_pos="$5" @@@@@@@
-local __style __entry __value __action __handler __tmp __svalue __hspaces=$'\t ' __nl=$'\n' __ch_def_name
-integer __idx1 __idx2 __start __end __ivalue __have_value=0
-local -a __lines_list __avalue
-local -A map
-map=( "#" "_H" "^" "_D" "*" "_S" )
-
-(( __start=_start_pos-__PBUFLEN, __end=_end_pos-__PBUFLEN ))
-
-# Handler that highlights the options
-→chroma/main-chroma-std-aopt-action() {
- integer _start="$2" _end="$3"
- local _scmd="$1" _wrd="$4"
-
- [[ "$_wrd" = (#b)(--[a-zA-Z0-9_-]##)=(*) ]] && {
- reply+=("$_start $(( _end - mend[2] + mbegin[2] - 1 )) ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-hyphen-option]}")
- } || {
- [[ "$_wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
- __style=${FAST_THEME_NAME}single-hyphen-option
- }
-}
-
-# Handler that highlights the options' arguments
-→chroma/main-chroma-std-aopt-ARG-action() {
- integer _start="$2" _end="$3"
- local _scmd="$1" _wrd="$4"
-
- [[ "$_wrd" = (#b)(--[a-zA-Z0-9_-]##)=(*) ]] && {
- reply+=("$(( _start + 1 + mend[1] )) $_end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}optarg-${${${(M)match[2]:#<->}:+number}:-string}]}")
- } || __style=${FAST_THEME_NAME}optarg-${${${(M)_wrd:#(-|)<->}:+number}:-string}
-}
-
-# This handler also highlights explicit arguments, i.e. --opt=the-explicit-arg
-→chroma/main-chroma-std-aopt-SEMI-action() {
- integer _start="$2" _end="$3"
- local _scmd="$1" _wrd="$4"
-
- [[ "$_wrd" = (#b)(--[a-zA-Z0-9_-]##)=(*) ]] && {
- reply+=("$_start $(( _end - mend[2] + mbegin[2] - 1 )) ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}double-hyphen-option]}")
- reply+=("$(( _start + 1 + mend[1] )) $_end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}optarg-${${${(M)match[2]:#<->}:+number}:-string}]}")
- } || {
- [[ "$_wrd" = --* ]] && __style=${FAST_THEME_NAME}double-hyphen-option || \
- __style=${FAST_THEME_NAME}single-hyphen-option
- }
-}
-
-# A handler which verifies the token as an GIT url
-→chroma/main-chroma-std-verify-url() {
- setopt localoptions extendedglob
- local _wrd="$4"
- integer url_correct=0
- # Correct matches
- # Correct matches
- if [[ "$_wrd" = (#b)(git|http|https|ftp|ftps|file)://([a-zA-Z0-9._~-]##)(:[0-9]##)(#c0,1)(/([a-zA-Z0-9./_~:-]##))(#c0,1) ]]; then
- url_correct=1
- elif [[ "$_wrd" = (#b)rsync://([a-zA-Z0-9._~-]##)(/([a-zA-Z0-9./_~:-]##))(#c0,1) ]]; then
- url_correct=1
- elif [[ "$_wrd" = (#b)ssh://([a-zA-Z0-9._~-]##@)(#c0,1)([a-zA-Z0-9._~-]##)(:[0-9]##)(#c0,1)(/([a-zA-Z0-9./_~:-]##))(#c0,1) ]]; then
- url_correct=1
- elif [[ "$_wrd" = (#b)([a-zA-Z0-9._~-]##@)(#c0,1)([a-zA-Z0-9._~-]##):([a-zA-Z0-9./_~:-](#c0,1)[a-zA-Z0-9._~:-][a-zA-Z0-9./_~:-]#)(#c0,1) ]]; then
- url_correct=1
- elif [[ "$_wrd" = (#b)[[:alnum:]/_~:.-]## ]]; then
- url_correct=1
- fi
-
- (( url_correct )) && \
- { __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
- { __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
-}
-
-# A handler which verifies the token as a shell wildcard
-→chroma/main-chroma-std-verify-pattern() {
- setopt localoptions extendedglob
- local _wrd="$4"
- __style=${FAST_THEME_NAME}globbing-ext
-}
-
-# Creates a hash table for given option set (an *_opt field in the chroma def.)
-→chroma/main-create-OPTION-hash.ch() {
- local __subcmd="$1" __option_set_id="$2" __the_hash_name="$3" __ __e __el __the_hash_name __var_name
- local -a __split __sp __s
-
- →chroma/main-chroma-print -rl "======================" " **## STARTING ##** →chroma/main-##CREATE##-option-HASH.ch // subcmd:$__subcmd // option_set_id:$__option_set_id // h-nam:$__the_hash_name"
- →chroma/main-chroma-print "[D] Got option-set: ${(j:,:)__option_set_id}"
- typeset -gA "$__the_hash_name"
- →chroma/main-chroma-print "[E] __the_hash_name ${__the_hash_name}:[$__option_set_id]"
-
- # Split on ||
- __ch_def_name="fsh__${__chroma_name}__chroma__def[${__option_set_id}]"
- __split=( "${(P@s:||:)__ch_def_name}" )
- [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
- # Remove only leading and trailing whitespace
- __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
-
- →chroma/main-chroma-print -rl "[F] Got ||-__split: _________" ${${(@)${${__split[@]##[[:space:]]##}[@]//[${__hspaces}]##/ }[@]//[${__nl}]##/$__nl}[@]//(#s)/:::} "_________"
- for __el in $__split; do
- __sp=( "${(@s:<<>>:)__el}" )
- [[ ${#__sp} -eq 1 && -z "${__sp[1]}" ]] && __sp=()
- __sp=( "${__sp[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
-
- →chroma/main-chroma-print -l -- "Processing an ||-part - got <<>>-split: _________" "${${__sp[@]}[@]/(#s)/-\\t}" "_________"
- __e="${__sp[1]}"
- local __e1=${${__e#\(}%\)(:add|:del|)}
- local __e2=${(M)__e##\(*\)(:add|:del)}
- # Split on | with the ( and ) and :add/:del stripped and then append
- # the :add or :del depending on what's on the input line
- __s=()
- for __ in ${(@s:|:)__e1}; do
- __s+=( $__${__e2:+${(M)__e%(:add|:del)}} )
- done
- [[ ${#__s} -eq 1 && -z "${__s[1]}" ]] && __s=()
- __s=( "${__s[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
- shift __sp
-
- for __ in $__s; do
- __=${__%\^}
- [[ "$__" = -*:(add|del) ]] && __var_name="${__the_hash_name}[${__}-directive]" || __var_name="${__the_hash_name}[${__}-opt-action]"
- →chroma/main-chroma-print "${(r:70:: :):-${__var_name}} := >>${__sp[1]}${${${#__sp}:#(0|1)}:+ +}<<"
- : ${(P)__var_name::=${__sp[1]}${${${#__sp}:#(0|1)}:+ +}}
-
- if (( ${#__sp} >= 2 )); then
- __var_name="${__the_hash_name}[${__}-opt-arg-action]"
- →chroma/main-chroma-print "${(r:70:: :):-${__var_name}} := >>${__sp[2]}<<}"
- : ${(P)__var_name::=$__sp[2]}
- fi
- done
- done
-}
-
-# Processes given token
-→chroma/main-process-token.ch() {
- local __subcmd="$1" __wrd="$2" __val __var_name __main_hash_name __the_hash_name __i __size
- local -a __splitted __split __added
-
- →chroma/main-chroma-print "\n******************* Starting →chroma/main-process-token <<$__wrd>>// subcmd:${(qq)__subcmd}"
- __main_hash_name="fsh__chroma__main__${${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}//(#b)([\#\^\*])/${map[${match[1]}]}}"
- __var_name="${__main_hash_name}[subcmd:$__subcmd]"
- __splitted=( "${(@s://:P)__var_name}" )
- [[ ${#__splitted} -eq 1 && -z "${__splitted[1]}" ]] && __splitted=()
- __splitted=( "${__splitted[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
-
- →chroma/main-chroma-print -rl -- "[B] MAIN-PROCESS-TOKEN: got [OPTION/ARG-**S-E-T-S**] //-splitted from subcmd:$__subcmd: ${${(j:, :)__splitted}:-EMPTY-SET!}" "----- __splitted\\Deleted: -----" ${${(j:, :)${__splitted[@]:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}}:-EMPTY-SET (deleted)!} "----- Added\\Deleted: -----" ${${(j:, :)${${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}}:-EMPTY-SET (added)!} -----\ Deleted:\ ----- ${(j:, :)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}} >> /tmp/reply
-
- (( ! ${#__splitted} )) && {
- __var_name="${__main_hash_name}[subcmd:*]"
- __splitted=( "${(@s://:P)__var_name}" )
- [[ ${#__splitted} -eq 1 && -z "${__splitted[1]}" ]] && __splitted=()
- __splitted=( "${__splitted[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
- (( ! ${#__splitted} )) && return 1
- }
-
- →chroma/main-chroma-print -rl -- "---NO-HASH-CREATE-FROM-NOW-ON---"
-
- if [[ -z "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}" ]]; then
- →chroma/main-chroma-print -rl -- "-z OPT-WITH-ARG-ACTIVE == true"
- if [[ "$__wrd" = -* ]]; then
- →chroma/main-chroma-print "1st-PATH (-z opt-with-arg-active, non-opt-arg branch, i.e. OPTION BRANCH) [#${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}]"
- for __val in ${__splitted[@]:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})} ${${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}; do
- [[ "${__val}" != "${__val%%_([0-9]##|\#)##*}"_${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}_opt(\*|\^|) && "${__val}" != "${__val%%_([0-9]##|\#)*}"_"#"_opt(\*|\^|) ]] && { →chroma/main-chroma-print "DIDN'T MATCH $__val / arg counter:${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}" ; continue; } || →chroma/main-chroma-print "Got candidate: $__val"
- # Create the hash cache-parameter if needed
- __the_hash_name="fsh__chroma__${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}__${__subcmd//[^a-zA-Z0-9_]/_}__${${__val//(#b)([\#\^\*])/${map[${match[1]}]}}//[^a-zA-Z0-9_]/_}"
- [[ "$__val" = *_opt(\*|\^|) && "${(P)+__the_hash_name}" -eq 0 ]] && →chroma/main-create-OPTION-hash.ch "$__subcmd" "$__val" "$__the_hash_name" || →chroma/main-chroma-print "Not creating, the hash already exists..."
- # Try dedicated-entry for the option
- __var_name="${__the_hash_name}[${${${${(M)__wrd#?*=}:+${__wrd%=*}=}:-$__wrd}}-opt-action]"
- __split=( "${(@s://:P)__var_name}" )
- [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
- # If no result, then try with catch-all entry
- (( ! ${#__split} )) && {
- →chroma/main-chroma-print "% no ${(q-)${${${(M)__wrd#?*=}:+${__wrd%=*}=}:-$__wrd}}-opt-action, retrying with *-opt-action" "|__var_name|:$__var_name"
- __var_name="${__the_hash_name}[*-opt-action]"
- __split=( "${(@s://:P)__var_name}" )
- [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
- }
- __svalue="$__var_name"
- # Remove whitespace
- __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
- →chroma/main-chroma-print -l -- "\`$__val' // ${#__split} // $__wrd: (ch.run #${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]}), deref. of \`$__var_name'"
- if (( ${#__split} )); then
- →chroma/main-chroma-print -l -- "Got split of {\$#__split:$#__split} ${__wrd}-opt-action or *-opt-action" "${${(q-)__split[@]}[@]/(#s)/->\\t}"
- if [[ "${__split[2]}" = *[[:blank:]]+ ]]; then
- →chroma/main-chroma-print "YES handling the value (the OPT.ARGUMENT)! [${__split[2]}]"
- if [[ "$__wrd" = *=* ]]; then
- →chroma/main-chroma-print "The-immediate Arg-Acquiring, of option"
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]="${__svalue%-opt-action\]}-opt-arg-action]"
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-arg]="${__wrd#*=}"
- __have_value=2
- else
- →chroma/main-chroma-print "Enable Arg-Awaiting, of option"
- →chroma/main-chroma-print "FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]=\"${__svalue%-opt-action\]}-opt-arg-action]\""
- __have_value=0
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]="${__svalue%-opt-action\]}-opt-arg-action]"
- fi
- fi
-
- __action="${__split[1]}"
- __handler="${__split[2]%[[:blank:]]+}"
-
- # Check for directives (like :add)
- if [[ "$__val" = *_opt\^ ]]; then
- __var_name="${__the_hash_name}[${${${${(M)__wrd#?*=}:+${__wrd%=*}=}:-$__wrd}}:add-directive]"
- (( ${(P)+__var_name} )) && __split=( "${(@s://:P)__var_name}" ) || __split=()
- [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split[1]=()
- __ivalue=${#__split}
- __var_name="${__var_name%:add-*}:del-directive]"
- (( ${(P)+__var_name} )) && __split+=( "${(@s://:P)__var_name}" )
- [[ ${#__split} -eq $(( __ivalue + 1 )) && -z "${__split[__ivalue+1]}" ]] && __split[__ivalue+1]=()
- __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
- __tmp=${#__split}
-
- # First: del-directive
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]+="${(j: :)__split[__ivalue+1,__tmp]} "
-
- →chroma/main-chroma-print -rl ":add / :del directives: __ivalue:$__ivalue, THE __SPLIT[#$__tmp]: " "${__split[@]}" "//" "The FAST_HIGHLIGHT[chroma-*deleted-nodes]: " ${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]} >> /tmp/reply
-
- # Second: add-directive
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]+="${(j: :)__split[1,__ivalue]} "
- fi
- [[ "$__handler" = ::[^[:space:]]* ]] && __handler="${__handler#::}" || __handler=""
- [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && { →chroma/main-chroma-print -rl -- "Running handler(1): $__handler" ; "$__handler" "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}" "$__start" "$__end" "$__wrd"; }
- [[ "$__have_value" -ne 2 && -n "$__action" && "$__action" != "NO-OP" ]] && { →chroma/main-chroma-print -rl "Running action (1): $__action" ; eval "() { $__action; }"; }
- [[ "$__val" != *\* ]] && break
- else
- →chroma/main-chroma-print -rl -- "NO-MATCH ROUTE TAKEN"
- fi
- done
- else
- →chroma/main-chroma-print "1st-PATH-B (-z opt-with-arg-active, non-opt-arg branch, ARGUMENT BRANCH [#${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}]) //// added-nodes: ${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}"
- for __val in ${__splitted[@]:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})} ${${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}:#(${(~j:|:)${(@)=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}})}; do
- [[ "${__val}" != "${__val%%_([0-9]##|\#)*}"_"${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}"_arg(\*|\^|) && "${__val}" != "${__val%%_([0-9]##|\#)*}"_"#"_arg(\*|\^|) ]] && { →chroma/main-chroma-print "Continuing for $__val / arg counter ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}" ; continue }
- # Create the hash cache-parameter if needed
- __the_hash_name="fsh__chroma__${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}__${__subcmd//[^a-zA-Z0-9_]/_}__${${__val//\#/H}//[^a-zA-Z0-9_]/_}"
- __action="" __handler=""
- →chroma/main-chroma-print "A hit, chosen __val:$__val!"
- __ch_def_name="fsh__${__chroma_name}__chroma__def[$__val]"
- __split=( "${(P@s:<<>>:)__ch_def_name}" )
- __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
-
- __sp=( "${(@s://:)__split[1]}" )
- __sp=( "${__sp[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
- __action="${__sp[1]#*::::: ##}"
-
- # Verify if it's the expected argument
- [[ "${__sp[1]}" = *:::::* && "$__wrd" != ${~${__sp[1]%% ##:::::*}} ]] && \
- { →chroma/main-chroma-print -r "mismatch ${__sp[1]%% ##:::::*} != $__wrd, continuing" ; continue; }
-
- →chroma/main-chroma-print -l -- "Got action record for $__val, i.e. the split:" "${__sp[@]//(#s)/-\t}" "_________"
-
- [[ "${__sp[2]}" = ::[^[:space:]]* ]] && __handler="${__sp[2]#::}" || { [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && →chroma/main-chroma-print "=== Error === In chroma definition: a handler entry ${(q)__sp[2]} without leading \`::'" ; }
- [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && { →chroma/main-chroma-print -rl -- "Running handler(3): $__handler" ; "$__handler" "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}" "$__start" "$__end" "$__wrd"; }
- [[ -n "$__action" && "$__action" != "NO-OP" ]] && { →chroma/main-chroma-print -rl -- "Running action(3): $__action" ; eval "() { $__action; } \"${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}\" \"$__start\" \"$__end\" \"$__wrd\""; }
-
- # Check for argument directives (like :add)
- if (( ${#__split} >= 2 )); then
- for __ in "${(@)__split[2,-1]}"; do
- __splitted=( "${(@s://:)__}" )
- if [[ "${__splitted[1]}" = add:* ]]; then
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]+="${__splitted[1]#add:} ${(j: :)__splitted[2,-1]} "
- elif [[ "${__splitted[1]}" = del:* ]]; then
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]+="${__splitted[1]#del:} ${(j: :)__splitted[2,-1]} "
- fi
- done
- →chroma/main-chroma-print -l "ARGUMENT :add / :del directives: THE __SPLIT[#${#__split}]: " "${__split[@]//(#s)/-\\t}" "//" "The FAST_HIGHLIGHT[chroma-*deleted-nodes]: " ${(@)${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]}//(#s)/-\\t} "The FAST_HIGHLIGHT[chroma-*added-nodes]: " ${(@)${=FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]}//(#s)/-\\t}
- fi
-
- [[ "$__val" != *\* ]] && break
- done
- fi
- else
- →chroma/main-chroma-print -- "2nd-PATH (-n opt-with-arg-active) NON-EMPTY arg-active:\nThe actual opt-val <<< \$__wrd:$__wrd >>> store (after the \`Arg-Awaiting' in the chroma-run: #$(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]-1 )) [current: #$(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr] ))])"
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-arg]="$__wrd"
- __have_value=1
- fi
-
- # Execute the action if not during simulated opt-argument (--opt=...)
- →chroma/main-chroma-print "** BEFORE: \`if (( __have_value ))'"
- if (( __have_value )); then
- →chroma/main-chroma-print "In the \`if (( __have_value ))' [have_value: $__have_value]"
- # Split
- __var_name="${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}"
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]=""
- __split=( "${(@s://:P)__var_name}" )
- [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && { →chroma/main-chroma-print -rl "NULL at __var_name:$__var_name" ; __split=(); }
- __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
-
- # Remember 1st level action
- (( __have_value == 2 )) && __value="$__action" || __value=""
-
- if (( ${#__split} )); then
- →chroma/main-chroma-print -l -- "Got //-split (3, for opt-ARG-action, from [$__var_name]):" "${${(q-)__split[@]}[@]/(#s)/+\\t}"
- __action="${__split[1]}"
- __handler="${__split[2]}"
- [[ "$__handler" = ::[^[:space:]]* ]] && __handler="${__handler#::}"
-
- [[ -n "$__handler" && "$__handler" != "NO-OP" ]] && { →chroma/main-chroma-print -rl -- "Running handler(2): $__handler" ; "$__handler" "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]:-NULL}" "$__start" "$__end" "$__wrd"; }
- [[ -n "$__action" && "$__action" != "NO-OP" ]] && { →chroma/main-chroma-print -rl -- "Running action(2): $__action" ; eval "$__action"; }
- →chroma/main-chroma-print -rl -- "The __action value: [$__value]"
- [[ "$__have_value" -eq 2 && -n "$__value" && "$__value" != "NO-OP" ]] && { →chroma/main-chroma-print -rl "Running action (of 1, at 2): $__value" ; eval "$__value"; }
- fi
- fi
- →chroma/main-chroma-print -- "_________ Exiting →chroma/main-process-token.ch $__subcmd / $__wrd _________"
-}
-
-# Iterates over the chroma def. fields and creates initial
-# fields in the fsh__${__chroma_name}__chroma__def hash
-→chroma/-pre_process_chroma_def.ch() {
- local __key __value __ke _val __the_hash_name="$1" __var_name
- local -a __split
-
- →chroma/main-chroma-print -rl -- "Starting PRE_PROCESS for __the_hash_name:$__the_hash_name"
-
- __ch_def_name="fsh__${__chroma_name}__chroma__def[subcommands]"
- local __subcmds="${(P)__ch_def_name}"
- if [[ "$__subcmds" = "::"* ]]; then
- ${__subcmds#::}
- __var_name="${__the_hash_name}[subcommands]"
- : ${(P)__var_name::=(${(j:|:)reply})}
- else
- __var_name="${__the_hash_name}[subcommands]"
- : ${(P)__var_name::=$__subcmds}
- fi
- →chroma/main-chroma-print "Got SUBCOMMANDS: ${(P)__var_name}"
-
- __ch_def_name="fsh__${__chroma_name}__chroma__def[subcmd-hook]"
- local __subcmd_hook="${(P)__ch_def_name}"
- if [[ -n "$__subcmd_hook" ]]; then
- __var_name="${__the_hash_name}[subcmd-hook]"
- : ${(P)__var_name::=$__subcmd_hook}
- fi
-
- __ch_def_name="fsh__${__chroma_name}__chroma__def[(I)subcmd:*]"
- for __key in "${(P@)__ch_def_name}"; do
- __split=( "${(@s:|:)${${__key##subcmd:\((#c0,1)}%\)}}" )
- [[ ${#__split} -eq 1 && -z "${__split[1]}" ]] && __split=()
- __split=( "${__split[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
- for __ke in "${__split[@]}"; do
- __var_name="${__the_hash_name}[subcmd:$__ke]"
- __ch_def_name="fsh__${__chroma_name}__chroma__def[$__key]"
- : ${(P)__var_name::=${(P)__ch_def_name}}
- →chroma/main-chroma-print -rl -- "Storred ${__var_name}=chroma_def[$__key], i.e. = ${(P)__ch_def_name}"
- done
- done
-}
-
-if (( __first_call )); then
- →chroma/-${__chroma_name}-first-call
- FAST_HIGHLIGHT[chroma-current]="$__wrd"
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]=0
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-got-subcommand]=0
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]=""
- FAST_HIGHLIGHT[chrome-${FAST_HIGHLIGHT[chroma-current]}-occurred-double-hyphen]=0
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]=""
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-arg]=""
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]=1
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-added-nodes]=""
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-deleted-nodes]=""
- __the_hash_name="fsh__chroma__main__${${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}//(#b)([\#\^])/${map[${match[1]}]}}"
- (( 0 == ${(P)+__the_hash_name} )) && {
- typeset -gA "$__the_hash_name"
- →chroma/-pre_process_chroma_def.ch "$__the_hash_name"
- } || →chroma/main-chroma-print "...No... [\${+$__the_hash_name} ${(P)+__the_hash_name}]"
- return 1
-else
- (( ++ FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr] ))
- # Following call, i.e. not the first one
-
- # Check if chroma should end – test if token is of type
- # "starts new command", if so pass-through – chroma ends
- [[ "$__arg_type" = 3 ]] && return 2
-
- →chroma/main-chroma-print "== @@ Starting @@ #${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-call-nr]} Main-Chroma-call == // << __WORD:$__wrd >> ## Subcommand: ${${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}:-NULL} //@@// -n option-with-arg-active:${(q-)FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}"
- if [[ "$__wrd" = -* || -n "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-option-with-arg-active]}"
- ]]; then
- →chroma/main-chroma-print "## The \`if -*' i.e. \`IF OPTION' MAIN branch"
- →chroma/main-process-token.ch "${${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}:-NULL}" "$__wrd"
- else
- # If at e.g. '>' or destination/source spec (of the redirection)
- if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
- return 1
- elif (( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-got-subcommand] == 0 )) {
- __the_hash_name="fsh__chroma__main__${${FAST_HIGHLIGHT[chroma-current]//[^a-zA-Z0-9_]/_}//(#b)([\#\^])/${map[${match[1]}]}}"
- __var_name="${__the_hash_name}[subcommands]"
- if [[ "$__wrd" = ${(P)~__var_name} ]]; then
- →chroma/main-chroma-print "GOT-SUBCOMMAND := $__wrd, subcmd verification / OK"
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-got-subcommand]=1
- FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]="$__wrd"
- __var_name="${__the_hash_name}[subcmd-hook]"
- (( ${(P)+__var_name} )) && { →chroma/main-chroma-print -r -- "Running subcmd-hook: ${(P)__var_name}" ; "${(P)__var_name}" "$__wrd"; }
- __style="${FAST_THEME_NAME}subcommand"
- else
- →chroma/main-chroma-print "subcmd verif / NOT OK; Incrementing the COUNTER-ARG ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]} -> $(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] + 1 ))" >> /tmp/fsh-dbg
- (( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] += 1 ))
- →chroma/main-chroma-print "UNRECOGNIZED ARGUMENT ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}"
- →chroma/main-process-token.ch "${${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}:-NULL}" "$__wrd"
- fi
- } else {
- __wrd="${__wrd//\`/x}"
- __arg="${__arg//\`/x}"
- __wrd="${(Q)__wrd}"
-
- local __tmp_def_name="fsh__${__chroma_name}__chroma__def[subcommands-blacklist]"
- if [[ ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]} = \
- (${(~j:|:)${(@s:,:)${(PA)__tmp_def_name}}})
- ]] {
- return 1
- }
-
- →chroma/main-chroma-print "Incrementing the COUNTER-ARG ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]} -> $(( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] + 1 ))"
- (( FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg] += 1 ))
- →chroma/main-chroma-print "ARGUMENT ${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-counter-arg]}"
-
- →chroma/main-chroma-print "ELSE *-got-subcommand == 1 is TRUE"
- →chroma/main-process-token.ch "${FAST_HIGHLIGHT[chroma-${FAST_HIGHLIGHT[chroma-current]}-subcommand]}" "$__wrd"
- }
- fi
-fi
-
-
-# Add region_highlight entry (via `reply' array)
-if [[ -n "$__style" ]]; then
- (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
- && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
-fi
-
-# We aren't passing-through, do obligatory things ourselves
-(( this_word = next_word ))
-_start_pos=$_end_pos
-
-return 0
-
-# vim: ft=zsh sw=2 ts=2 et