move to new repo

This commit is contained in:
tumillanino
2026-03-24 20:17:22 +11:00
parent 083b57c87b
commit 35bcba335a
1910 changed files with 161640 additions and 41 deletions

BIN
docs/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

1402
docs/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 868 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

BIN
docs/wallpapers/default.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 868 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

View File

@@ -0,0 +1,16 @@
setup-zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete
{echo 'plugins=(git'
echo 'zsh-autosuggestions'
echo 'zsh-syntax-highlighting'
echo 'fast-syntax-highlighting'
echo 'zsh-autocomplete'
echo ')'
} >> ~/.zshrc
@echo 'eval "$(oh-my-posh init zsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/refs/heads/main/themes/json.omp.json')"' >> ~/.zshrc

View File

@@ -0,0 +1,37 @@
first-run:
usermod -aG audio $USER
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete
{echo 'plugins=(git'
echo 'zsh-autosuggestions'
echo 'zsh-syntax-highlighting'
echo 'fast-syntax-highlighting'
echo 'zsh-autocomplete'
echo ')'
} >> ~/.zshrc
@echo 'eval "$(oh-my-posh init zsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/refs/heads/main/themes/json.omp.json')"' >> ~/.zshrc
@echo 'Adding /usr/lib64 to Reaper plugin paths...'
mkdir ~/.config/REAPER
touch ~/.config/REAPER/reaper.ini
sed -i '/^vstpath=/ s/$/;\/usr\/lib64\/vst3;\/usr\/lib64\/vst/' ~/.config/REAPER/reaper.ini
sed -i '/^lv2path=/ s/$/;\/usr\/lib64\/lv2/;' ~/.config/REAPER/reaper.ini
sed -i '/^clappath=/ s/$/;\/usr\/lib64\/clap/' ~/.config/REAPER/reaper.ini
@echo 'Paths updated. Please restart Reaper and clear cache/rescan'
export WINELOADER='/opt/wine-staging/bin/wine'
wineboot -u
yabridgectl add "$HOME/.wine/drive_c/Program Files/Common Files/VST3"
yabridgectl sync

View File

@@ -0,0 +1,11 @@
route-plugins:
@echo 'Adding /usr/lib64 to Reaper plugin paths...'
mkdir ~/.config/REAPER
touch ~/.config/REAPER/reaper.ini
sed -i '/^vstpath=/ s/$/;\/usr\/lib64\/vst3;\/usr\/lib64\/vst/' ~/.config/REAPER/reaper.ini
sed -i '/^lv2path=/ s/$/;\/usr\/lib64\/lv2/;' ~/.config/REAPER/reaper.ini
sed -i '/^clappath=/ s/$/;\/usr\/lib64\/clap/' ~/.config/REAPER/reaper.ini
@echo 'Paths updated. Please restart Reaper and clear cache/rescan'

View File

@@ -0,0 +1,10 @@
# Setup yabridge paths and sync plugins for the current user
setup-audio:
#!/usr/bin/env bash
export WINELOADER='/opt/wine-staging/bin/wine'
wineboot -u
yabridgectl add "$HOME/.wine/drive_c/Program Files/Common Files/VST3"
yabridgectl sync

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -oue pipefail
./install-divested.sh 20250714
./install-divested.sh https://divested.dev/rpm/fedora/divested-release-20250714-1.noarch.rpm
BASE_URL='https://divested.dev/rpm/fedora'
PKG_PREFIX='divested-release'
ARCH='noarch'
RPM_SUFFIX='-1' # adjust if upstream uses a different release number
RETRY_OPTS=(--retry 3 --retry-delay 5 -S -L -O)
if [ "${#}" -eq 0 ]; then
echo "Usage: $0 YYYYMMDD | FULL_RPM_URL" >&2
exit 2
fi
INPUT="$1"
case "$INPUT" in
http:// | https://)
RPM_URL="$INPUT"
;;
[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
RELEASE_VERSION="$INPUT"
FILENAME="${PKG_PREFIX}-${RELEASE_VERSION}${RPM_SUFFIX}.${ARCH}.rpm"
RPM_URL="${BASE_URL}/${FILENAME}"
;;
*)
echo "Invalid argument. Provide a date (YYYYMMDD) or a full URL." >&2
exit 1
;;
esac
TMPDIR="$(mktemp -d)"
trap 'rm -rf "$TMPDIR"' EXIT
RPM_PATH="${TMPDIR}/$(basename "$RPM_URL")"
echo "Downloading ${RPM_URL} ..."
if command -v curl >/dev/null 2>&1; then
curl "${RETRY_OPTS[@]}" -o "$RPM_PATH" "$RPM_URL"
elif command -v wget >/dev/null 2>&1; then
wget --tries=3 --wait=5 -O "$RPM_PATH" "$RPM_URL"
else
echo "Neither curl nor wget available." >&2
exit 1
fi
echo "Installing ${RPM_PATH} ..."
sudo dnf install -y "$RPM_PATH"
echo "Installed $(basename "$RPM_PATH")"

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -oue pipefail
mv /tmp/files/assets/images/distributor-logo.svg /usr/share/icons/hicolor/scalable/places/distributor-logo.svg
mv /tmp/files/assets/splash/default.jxl /usr/share/backgrounds/default.jxl
mv /tmp/files/assets/splash/default-dark.jxl /usr/share/backgrounds/default-dark.jxl
mv /tmp/files/assets/images/watermark.png /usr/share/plymouth/themes/spinner/watermark.png

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -oue pipefail
systemctl enable realtime-setup.service
systemctl enable realtime-entsk.service

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Tell this script to exit if there are any errors.
# You should have this in every custom script, to ensure that your completed
# builds actually ran successfully without any errors!
set -oue pipefail
# Your code goes here.
echo 'This is an example shell script'
echo 'Scripts here will run during build if specified in recipe.yml'

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
curl -L -o /tmp/reaper.tar.xz "https://www.reaper.fm/files/7.x/reaper765_linux_x86_64.tar.xz"
tar -xJf /tmp/reaper.tar.xz -C /tmp
cd /tmp/reaper_linux_x86_64
./install-reaper.sh --install /usr/lib --integrate-desktop
if [ -f "/root/.local/share/applications/cockos-reaper.desktop" ]; then
mkdir -p /usr/share/applications/
mv /root/.local/share/applications/cockos-reaper.desktop /usr/share/applications/
sed -i 's|/root/opt/REAPER|/usr/lib/REAPER|g' /usr/share/applications/cockos-reaper.desktop
fi
rm -rf /tmp/reaper*

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
curl -L -o /tmp/renoise.tar.gz "https://files.renoise.com/demo/Renoise_3_5_4_Demo_Linux_x86_64.tar.gz"
tar xvf /tmp/renoise.tar.gz -C /tmp
cd /tmp/Renoise_3_5_4_Demo_Linux_x86_64
./install.sh || echo "Installer finished with minor warnings (likely desktop-integration related)"
rm -rf /tmp/renoise.tar.gz /tmp/Renoise* || true
exit 0

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
rpm_url="https://github.com/surge-synthesizer/releases-xt/releases/download/1.3.4/surge-xt-x86_64-1.3.4.rpm"
dnf install -y --nogpgcheck "$rpm_url"

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

View File

@@ -0,0 +1,40 @@
[terminal]
shell = {program = "/bin/zsh", args = ["--login", "-c", "tmux attach -t main || tmux new -s main"]}
# Kanagawa Dragon Alacritty Colors
[colors.primary]
background = '#181616'
foreground = '#c5c9c5'
[colors.normal]
black = '#0d0c0c'
red = '#c4746e'
green = '#8a9a7b'
yellow = '#c4b28a'
blue = '#8ba4b0'
magenta = '#a292a3'
cyan = '#8ea4a2'
white = '#c8c093'
[colors.bright]
black = '#a6a69c'
red = '#e46876'
green = '#87a987'
yellow = '#e6c384'
blue = '#7fb4ca'
magenta = '#938aa9'
cyan = '#7aa89f'
white = '#c5c9c5'
[colors.selection]
background = '#2d4f67'
foreground = '#c8c093'
[[colors.indexed_colors]]
index = 16
color = '#b6927b'
[[colors.indexed_colors]]
index = 17
color = '#b98d7b'

View File

@@ -0,0 +1,15 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
}
}

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,4 @@
# 💤 LazyVim
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.

View File

@@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View File

@@ -0,0 +1,37 @@
{
"LazyVim": { "branch": "main", "commit": "6055e59613b406f9c4312c95e56f604fb839a97e" },
"blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "384f304c8b04664c9e0091fbfb3923c5f97c1bcf" },
"conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" },
"grug-far.nvim": { "branch": "main", "commit": "dc4684e163971bb1f5bfb93fbd4bb3e892bf9b15" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "a676ab7282da8d651e175118bcf54483ca11e46d" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"mini.ai": { "branch": "main", "commit": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4" },
"mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" },
"mini.pairs": { "branch": "main", "commit": "b7fde3719340946feb75017ef9d75edebdeb0566" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lint": { "branch": "master", "commit": "606b823a57b027502a9ae00978ebf4f5d5158098" },
"nvim-lspconfig": { "branch": "master", "commit": "e057806776c8bed91971338d96a78a0f6a313dae" },
"nvim-tree.lua": { "branch": "master", "commit": "dfeeb12aaae37f23285101cf875416c29052b22a" },
"nvim-treesitter": { "branch": "main", "commit": "2b50ab5ccbcd9e5708deb351308edd738adbf84c" },
"nvim-treesitter-textobjects": { "branch": "main", "commit": "7359dfcefa38db632541e1f9b5b5f291626a1d47" },
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"snacks.nvim": { "branch": "main", "commit": "a049339328e2599ad6e85a69fa034ac501e921b2" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@@ -0,0 +1,10 @@
{
"extras": [
],
"install_version": 8,
"news": {
"NEWS.md": "11866"
},
"version": 8
}

View File

@@ -0,0 +1,8 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
--
-- Add any additional autocmds here
-- with `vim.api.nvim_create_autocmd`
--
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")

View File

@@ -0,0 +1,84 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
--
-- set leader key to space
vim.g.mapleader = " "
local keymap = vim.keymap -- for conciseness
---------------------
-- General Keymaps -------------------
-- use jk to exit insert mode
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
--make navigation a bit more logical
keymap.set("n", "1", "0", { desc = "Jump to beginning of line" })
keymap.set("n", "0", "$", { desc = "jump to end of line" })
--same navigation but for visual mode
keymap.set("v", "1", "0", { desc = "Jump to beginning of line" })
keymap.set("v", "0", "$", { desc = "jump to end of line" })
--make yanking and deleting whole words more logical
keymap.set("n", "yw", "yiw", { desc = "Yanks current word under cursor" })
keymap.set("n", "ye", "yw", { desc = "Yanks from cursor placement to the end of the word" })
--make yanking and deleting whole words more logical
keymap.set("v", "yw", "yiw", { desc = "Yanks current word under cursor" })
keymap.set("v", "ye", "yw", { desc = "Yanks from cursor placement to the end of the word" })
--make yanking and deleting whole words more logical
keymap.set("n", "dw", "diw", { desc = "Deletes current word under cursor" })
keymap.set("n", "de", "dw", { desc = "Deletes from cursor placement to the end of the word" })
--make yanking and deleting whole words more logical
keymap.set("v", "dw", "diw", { desc = "Deletes current word under cursor" })
keymap.set("v", "de", "dw", { desc = "Deletes from cursor placement to the end of the word" })
-- clear search highlights
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
-- fix control V keymap
--keymap.set("n","<leader>vl","C-v", { desc = "visual in start of line"} )
-- delete single character without copying into register
-- keymap.set("n", "x", '"_x')
-- increment/decrement numbers
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
-- window management
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
keymap.set("n", "[", "}", { desc = "next paragraph down" })
keymap.set("n", "]", "{", { desc = "next paragraph up" })
--terminal mode keymap
keymap.set("t", "jk", "<C-\\><C-N>")
--set focus back to opened file
keymap.set("n", "<leader>fe", "<C-w>l", { noremap = true, silent = true })
keymap.set("n", "<leader>vb", "<C-q>", { desc = "visual block because control v is used by paste" })
--refactor keymaps
keymap.set("x", "<leader>re", ":Refactor extract<CR> ")
keymap.set("x", "<leader>rf", ":Refactor extract_to_file <CR>")
keymap.set("x", "<leader>rv", ":Refactor extract_var <CR>")
keymap.set({ "n", "x" }, "<leader>ri", ":Refactor inline_var<CR>")
keymap.set("n", "<leader>rI", ":Refactor inline_func<CR>")
keymap.set("n", "<leader>rb", ":Refactor extract_block<CR>")
keymap.set("n", "<leader>rbf", ":Refactor extract_block_to_file<CR>")

View File

@@ -0,0 +1,53 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@@ -0,0 +1,3 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here

View File

@@ -0,0 +1,6 @@
return {
-- disable trouble
{ "nvim-neo-tree/neo-tree.nvim", enabled = false },
{ "nvim-tree/nvim-tree.lua" },
-- -- { "neovim/nvim-lspconfig", enabled = false },
}

View File

@@ -0,0 +1,14 @@
return {
"stevearc/oil.nvim",
lazy = false,
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = {
{ "<leader>fl", "<cmd>Oil<CR>", desc = "File Explorer" },
},
opts = {
default_file_explorer = true,
view_options = {
show_hidden = true,
},
},
}

View File

@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120

View File

@@ -0,0 +1,20 @@
{
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
"ghcr.io/devcontainers/features/common-utils": {
"installZsh": true,
"configureZshAsDefaultShell": true,
"username": "vscode",
"userUid": 1000,
"userGid": 1000
}
},
"postCreateCommand": "dir=/workspaces/ohmyzsh; rm -rf $HOME/.oh-my-zsh && ln -s $dir $HOME/.oh-my-zsh && cp $dir/templates/minimal.zshrc $HOME/.zshrc && chgrp -R 1000 $dir && chmod g-w,o-w $dir",
"customizations": {
"codespaces": {
"openFiles": [
"README.md"
]
}
}
}

View File

@@ -0,0 +1,15 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_size = 2
indent_style = space
[*.py]
indent_size = 4
[devcontainer.json]
indent_size = 4
indent_style = tab

View File

@@ -0,0 +1,4 @@
{
"printWidth": 110,
"proseWrap": "always"
}

View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers 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, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at ohmyzsh@planetargon.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -0,0 +1,270 @@
# CONTRIBUTING GUIDELINES
Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated.
It is also essential for the development of the project.
First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md).
These guidelines are an attempt at better addressing the huge amount of pending
issues and pull requests. Please read them closely.
Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution
you would make is not already covered.
<!-- TOC updateonsave:true depthfrom:2 -->
- [Reporting Issues](#reporting-issues)
- [You have a problem](#you-have-a-problem)
- [You have a suggestion](#you-have-a-suggestion)
- [Submitting Pull Requests](#submitting-pull-requests)
- [Getting started](#getting-started)
- [You have a solution](#you-have-a-solution)
- [You have an addition](#you-have-an-addition)
- [A note on AI-assisted contributions](#a-note-on-ai-assisted-contributions)
- [Use the Search, Luke](#use-the-search-luke)
- [Commit Guidelines](#commit-guidelines)
- [Format](#format)
- [Style](#style)
- [Volunteer](#volunteer)
<!-- /TOC -->
## Reporting Issues
### You have a problem
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
your problem.
If you find one, comment on it, so we know more people are experiencing it.
If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting)
page for instructions on how to gather data to better debug your problem.
Then, you can go ahead and create an issue with as much detail as you can provide.
It should include the data gathered as indicated above, along with the following:
1. How to reproduce the problem
2. What the correct behavior should be
3. What the actual behavior is
Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle
(starting with `@`) in your message.
We will do our very best to help you.
### You have a suggestion
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
your suggestion.
If you find one, comment on it, so we know more people are supporting it.
If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
## Submitting Pull Requests
### Getting started
You should be familiar with the basics of
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices).
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
If you create your own PR, please make sure you do it right. Also be so kind as to reference
any issue that would be solved in the PR description body,
[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/)
_"Fixes #XXXX"_ for issue number XXXX.
### You have a solution
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution.
If the solution is already reported, try it out and +1 the pull request if the
solution works ok. On the other hand, if you think your solution is better, post
it with reference to the other one so we can have both solutions to compare.
If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
### You have an addition
Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
send themes for now.
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
covering or related to what you want to add.
If you find one, try it out and work with the author on a common solution.
If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
For any extensive change, such as a new plugin, you will have to find testers to +1 your PR.
### New plugin aliases
We acknowledge that aliases are a core part of Oh My Zsh. There are plugins that have +100 aliases!
This has become an issue for two opposing reasons:
- Some users want to have their personal aliases in Oh My Zsh.
- Some users don't want any aliases at all and feel that there are too many.
Because of this, from now on, we require that new aliases follow these conditions:
1. They will be used by many people, not just a few.
2. The aliases will be used many times and for common tasks.
3. Prefer one generic alias over many specific ones.
4. When justifying the need for an alias, talk about workflows where you'll use it,
preferably in combination with other aliases.
5. If a command with the same name exists, look for a different alias name.
This list is not exhaustive! Please remember that your alias will be in the machines of many people,
so it should be justified why they should have it.
## A note on AI-assisted contributions
We'll admit it: AI tools can be pretty helpful for coding tasks, and we're not here to gatekeep how you get your work done. We use these tools ourselves! 🤖
But here's the thing—Oh My Zsh is maintained by a small team of volunteers who do this in their spare time. We already have hundreds of pending PRs, and we want to make sure we're spending our limited time effectively.
If you used AI tools meaningfully in your contribution (code generation, agentic coding assistants, etc.), please mention it in your PR description. Basic autocomplete doesn't count, but if an AI wrote substantial parts of your code, just let us know.
**Examples of good disclosure:**
- "Used ChatGPT to help generate the initial regex pattern for parsing git status output"
- "Claude assisted with writing the unit tests for this feature"
- "Generated with Gemini and then reviewed/tested manually"
- Or simply: "AI-assisted" in your PR description
Here's what we're looking for:
- **You understand your code**: You should be able to explain what your contribution does and how it works. We want to collaborate with humans who are invested in the project.
- **Context matters**: Tell us what problem you're solving, how you tested it, and link to relevant docs. Small, incremental changes work better than massive generated overhauls.
- **Quality over quantity**: We'd rather have one thoughtful, well-tested contribution than ten AI-generated PRs that need extensive review.
The disclosure helps us know how much guidance to offer. If we're just reviewing AI output that you can't explain or improve, that changes the dynamic—and frankly, it's not a great use of anyone's time.
As always, we reserve the right to decline any contribution. PRs that appear to be unreviewed AI output, or code the contributor can't explain, may be closed without extensive feedback.
----
## Use the Search, Luke
_May the Force (of past experiences) be with you_
GitHub offers [many search features](https://help.github.com/articles/searching-github/)
to help you check whether a similar contribution to yours already exists. Please search
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
that works 90% of the time.
You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ)
to be sure your contribution has not already come up.
If all fails, your thing has probably not been reported yet, so you can go ahead
and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests).
----
## Commit Guidelines
Oh My Zsh uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
specification. The automatic changelog tool uses these to automatically generate
a changelog based on the commit messages. Here's a guide to writing a commit message
to allow this:
### Format
```
type(scope)!: subject
```
- `type`: the type of the commit is one of the following:
- `feat`: new features.
- `fix`: bug fixes.
- `docs`: documentation changes.
- `refactor`: refactor of a particular code section without introducing
new features or bug fixes.
- `style`: code style improvements.
- `perf`: performance improvements.
- `test`: changes to the test suite.
- `ci`: changes to the CI system.
- `build`: changes to the build system (we don't yet have one so this shouldn't apply).
- `chore`: for other changes that don't match previous types. This doesn't appear
in the changelog.
- `scope`: section of the codebase that the commit makes changes to. If it makes changes to
many sections, or if no section in particular is modified, leave blank without the parentheses.
Examples:
- Commit that changes the `git` plugin:
```
feat(git): add alias for `git commit`
```
- Commit that changes many plugins:
```
style: fix inline declaration of arrays
```
For changes to plugins or themes, the scope should be the plugin or theme name:
- ✅ `fix(agnoster): commit subject`
- ❌ `fix(theme/agnoster): commit subject`
- `!`: this goes after the `scope` (or the `type` if scope is empty), to indicate that the commit
introduces breaking changes.
Optionally, you can specify a message that the changelog tool will display to the user to indicate
what's changed and what they can do to deal with it. You can use multiple lines to type this message;
the changelog parser will keep reading until the end of the commit message or until it finds an empty
line.
Example (made up):
```
style(agnoster)!: change dirty git repo glyph
BREAKING CHANGE: the glyph to indicate when a git repository is dirty has
changed from a Powerline character to a standard UTF-8 emoji. You can
change it back by setting `ZSH_THEME_DIRTY_GLYPH`.
Fixes #420
Co-authored-by: Username <email>
```
- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need
to specify other details, you can use the commit body, but it won't be visible.
Formatting tricks: the commit subject may contain:
- Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool:
```
feat(archlinux): add support for aura AUR helper (#9467)
```
- Formatted inline code by using backticks: the text between backticks will also be highlighted by
the changelog tool:
```
feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774)
```
### Style
Try to keep the first commit line short. It's harder to do using this commit style but try to be
concise, and if you need more space, you can use the commit body. Try to make sure that the commit
subject is clear and precise enough that users will know what changed by just looking at the changelog.
----
## Volunteer
Very nice!! :)
Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
page for instructions on where to start and more.

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2009-2026 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,564 @@
<p align="center"><img src="https://ohmyzsh.s3.amazonaws.com/omz-ansi-github.png" alt="Oh My Zsh"></p>
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/)
configuration.
Sounds boring. Let's try again.
**Oh My Zsh will not make you a 10x developer...but you may feel like one.**
Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke
in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes.
Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll
use the time that you're saving to start flossing more often. 😬
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://x.com/ohmyzsh) on X (formerly
Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10713/badge)](https://www.bestpractices.dev/projects/10713)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ohmyzsh?label=%40ohmyzsh&logo=x&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
[![Mastodon Follow](https://img.shields.io/mastodon/follow/111169632522566717?label=%40ohmyzsh&domain=https%3A%2F%2Fmstdn.social&logo=mastodon&style=flat)](https://mstdn.social/@ohmyzsh)
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
<details>
<summary>Table of Contents</summary>
- [Getting Started](#getting-started)
- [Operating System Compatibility](#operating-system-compatibility)
- [Prerequisites](#prerequisites)
- [Basic Installation](#basic-installation)
- [Manual Inspection](#manual-inspection)
- [Using Oh My Zsh](#using-oh-my-zsh)
- [Plugins](#plugins)
- [Enabling Plugins](#enabling-plugins)
- [Using Plugins](#using-plugins)
- [Themes](#themes)
- [Selecting A Theme](#selecting-a-theme)
- [FAQ](#faq)
- [Advanced Topics](#advanced-topics)
- [Advanced Installation](#advanced-installation)
- [Custom Directory](#custom-directory)
- [Unattended Install](#unattended-install)
- [Installing From A Forked Repository](#installing-from-a-forked-repository)
- [Manual Installation](#manual-installation)
- [Installation Problems](#installation-problems)
- [Custom Plugins And Themes](#custom-plugins-and-themes)
- [Enable GNU ls In macOS And FreeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
- [Skip Aliases](#skip-aliases)
- [Async git prompt](#async-git-prompt)
- [Getting Updates](#getting-updates)
- [Updates Verbosity](#updates-verbosity)
- [Manual Updates](#manual-updates)
- [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh)
- [How Do I Contribute To Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh)
- [Do Not Send Us Themes](#do-not-send-us-themes)
- [Contributors](#contributors)
- [Follow Us](#follow-us)
- [Merchandise](#merchandise)
- [License](#license)
- [About Planet Argon](#about-planet-argon)
</details>
## Getting Started
### Operating System Compatibility
| O/S | Status |
| :------------- | :----: |
| Android | ✅ |
| FreeBSD | ✅ |
| LCARS | 🛸 |
| Linux | ✅ |
| macOS | ✅ |
| OS/2 Warp | ❌ |
| Windows (WSL2) | ✅ |
### Prerequisites
- [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and
newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here:
[Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
- `curl` or `wget` should be installed
- `git` should be installed (recommended v2.4.11 or higher)
### Basic Installation
Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the
command-line with either `curl`, `wget` or another similar tool.
| Method | Command |
| :-------- | :------------------------------------------------------------------------------------------------ |
| **curl** | `sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
Alternatively, the installer is also mirrored outside GitHub. Using this URL instead may be required if you're
in a country like China or India (for certain ISPs), that blocks `raw.githubusercontent.com`:
| Method | Command |
| :-------- | :------------------------------------------------ |
| **curl** | `sh -c "$(curl -fsSL https://install.ohmyz.sh/)"` |
| **wget** | `sh -c "$(wget -O- https://install.ohmyz.sh/)"` |
| **fetch** | `sh -c "$(fetch -o - https://install.ohmyz.sh/)"` |
_Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move
the configuration you want to preserve into the new `.zshrc`._
#### Manual Inspection
It's a good idea to inspect the install script from projects you don't yet know. You can do that by
downloading the install script first, looking through it so everything looks normal, then running it:
```sh
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh
```
If the above URL times out or otherwise fails, you may have to substitute the URL for
`https://install.ohmyz.sh` to be able to get the script.
## Using Oh My Zsh
### Plugins
Oh My Zsh comes with a shitload of plugins for you to take advantage of. You can take a look in the
[plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the
[wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
#### Enabling Plugins
Once you spot a plugin (or several) that you'd like to use with Oh My Zsh, you'll need to enable them in the
`.zshrc` file. You'll find the zshrc file in your `$HOME` directory. Open it with your favorite text editor
and you'll see a spot to list all the plugins you want to load.
```sh
vi ~/.zshrc
```
For example, this might begin to look like this:
```sh
plugins=(
git
bundler
dotenv
macos
rake
rbenv
ruby
)
```
_Note that the plugins are separated by whitespace (spaces, tabs, new lines...). **Do not** use commas between
them or it will break._
#### Using Plugins
Each built-in plugin includes a **README**, documenting it. This README should show the aliases (if the plugin
adds any) and extra goodies that are included in that particular plugin.
### Themes
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme-happy. We have over one
hundred and fifty themes now bundled. Most of them have
[screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!).
Check them out!
#### Selecting A Theme
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right
one (for him)._
Once you find a theme that you'd like to use, you will need to edit the `~/.zshrc` file. You'll see an
environment variable (all caps) in there that looks like:
```sh
ZSH_THEME="robbyrussell"
```
To use a different theme, simply change the value to match the name of your desired theme. For example:
```sh
ZSH_THEME="agnoster" # (this is one of the fancy ones)
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
```
<!-- prettier-ignore-start -->
> [!NOTE]
> You will many times see screenshots for a zsh theme, and try it out, and find that it doesn't look the same for you.
>
> This is because many themes require installing a [Powerline Font](https://github.com/powerline/fonts) or a
> [Nerd Font](https://github.com/ryanoasis/nerd-fonts) in order to render properly. Without them, these themes
> will render weird prompt symbols. Check out
> [the FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-have-a-weird-character-in-my-prompt) for more
> information.
>
> Also, beware that themes only control what your prompt looks like. This is, the text you see before or after
> your cursor, where you'll type your commands. Themes don't control things such as the colors of your
> terminal window (known as _color scheme_) or the font of your terminal. These are settings that you can
> change in your terminal emulator. For more information, see
> [what is a zsh theme](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#what-is-a-zsh-theme).
<!-- prettier-ignore-end -->
Open up a new terminal window and your prompt should look something like this:
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
In case you did not find a suitable theme for your needs, please have a look at the wiki for
[more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes).
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new
terminal window.
```sh
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
```
And if you want to pick a random theme from a list of your favorite themes:
```sh
ZSH_THEME_RANDOM_CANDIDATES=(
"robbyrussell"
"agnoster"
)
```
If you only know which themes you don't like, you can add them similarly to an ignored list:
```sh
ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
```
### FAQ
If you have some more questions or issues, you might find a solution in our
[FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
## Advanced Topics
If you're the type that likes to get their hands dirty, these sections might resonate.
### Advanced Installation
Some users may want to manually install Oh My Zsh, or change the default path or other settings that the
installer accepts (these settings are also documented at the top of the install script).
#### Custom Directory
The default location is `~/.oh-my-zsh` (hidden in your home directory, you can access it with
`cd ~/.oh-my-zsh`)
If you'd like to change the install directory with the `ZSH` environment variable, either by running
`export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
```sh
ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
```
#### Unattended Install
If you're running the Oh My Zsh install script as part of an automated install, you can pass the
`--unattended` flag to the `install.sh` script. This will have the effect of not trying to change the default
shell, and it also won't run `zsh` when the installation has finished.
```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
```
If you're in China, India, or another country that blocks `raw.githubusercontent.com`, you may have to
substitute the URL for `https://install.ohmyz.sh` for it to install.
#### Installing From A Forked Repository
The install script also accepts these variables to allow the installation of a different repository:
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set this variable,
the installer will look for a repository at `https://github.com/{owner}/{repository}`.
- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository clone. You
can use this setting if you want to install from a fork that is not on GitHub (GitLab, Bitbucket...) or if
you want to clone with SSH instead of HTTPS (`git@github.com:user/project.git`).
_NOTE: it's incompatible with setting the `REPO` variable. This setting will take precedence._
- `BRANCH` (default: `master`): you can use this setting if you want to change the default branch to be
checked out when cloning the repository. This might be useful for testing a Pull Request, or if you want to
use a branch other than `master`.
For example:
```sh
REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
```
#### Manual Installation
##### 1. Clone The Repository <!-- omit in toc -->
```sh
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
```
##### 2. _Optionally_, Backup Your Existing `~/.zshrc` File <!-- omit in toc -->
```sh
cp ~/.zshrc ~/.zshrc.orig
```
##### 3. Create A New Zsh Configuration File <!-- omit in toc -->
You can create a new zsh config file by copying the template that we have included for you.
```sh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
```
##### 4. Change Your Default Shell <!-- omit in toc -->
```sh
chsh -s $(which zsh)
```
You must log out from your user session and log back in to see this change.
##### 5. Initialize Your New Zsh Configuration <!-- omit in toc -->
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.
### Installation Problems
If you have any hiccups installing, here are a few common fixes.
- You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after
switching to `oh-my-zsh`.
- If you installed manually or changed the install location, check the `ZSH` environment variable in
`~/.zshrc`.
### Custom Plugins And Themes
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/`
directory.
If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the
`custom/plugins/` directory and then enable this plugin.
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the
same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
### Enable GNU ls In macOS And FreeBSD Systems
<a name="enable-gnu-ls"></a>
The default behaviour in Oh My Zsh is to use BSD `ls` in macOS and FreeBSD systems. If GNU `ls` is installed
(as `gls` command), you can choose to use it instead. To do it, you can use zstyle-based config before
sourcing `oh-my-zsh.sh`:
```zsh
zstyle ':omz:lib:theme-and-appearance' gnu-ls yes
```
_Note: this is not compatible with `DISABLE_LS_COLORS=true`_
### Skip Aliases
<a name="remove-directories-aliases"></a>
If you want to skip default Oh My Zsh aliases (those defined in `lib/*` files) or plugin aliases, you can use
the settings below in your `~/.zshrc` file, **before Oh My Zsh is loaded**. Note that there are many different
ways to skip aliases, depending on your needs.
```sh
# Skip all aliases, in lib files and enabled plugins
zstyle ':omz:*' aliases no
# Skip all aliases in lib files
zstyle ':omz:lib:*' aliases no
# Skip only aliases defined in the directories.zsh lib file
zstyle ':omz:lib:directories' aliases no
# Skip all plugin aliases
zstyle ':omz:plugins:*' aliases no
# Skip only the aliases from the git plugin
zstyle ':omz:plugins:git' aliases no
```
You can combine these in other ways taking into account that more specific scopes take precedence:
```sh
# Skip all plugin aliases, except for the git plugin
zstyle ':omz:plugins:*' aliases no
zstyle ':omz:plugins:git' aliases yes
```
A previous version of this feature was using the setting below, which has been removed:
```sh
zstyle ':omz:directories' aliases no
```
Instead, you can now use the following:
```sh
zstyle ':omz:lib:directories' aliases no
```
#### Notice <!-- omit in toc -->
> This feature is currently in a testing phase and it may be subject to change in the future. It is also not
> currently compatible with plugin managers such as zpm or zinit, which don't source the init script
> (`oh-my-zsh.sh`) where this feature is implemented in.
> It is also not currently aware of "aliases" that are defined as functions. Example of such are `gccd`,
> `ggf`, or `ggl` functions from the git plugin.
### Async git prompt
Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render
prompt information asynchronously. This can improve prompt rendering performance, but it might not work well
with some setups. We hope that's not an issue, but if you're seeing problems with this new feature, you can
turn it off by setting the following in your .zshrc file, before Oh My Zsh is sourced:
```sh
zstyle ':omz:alpha:lib:git' async-prompt no
```
If your problem is that the git prompt just stopped appearing, you can try to force it by setting the following
configuration before `oh-my-zsh.sh` is sourced. If it still does not work, please open an issue with your
case.
```sh
zstyle ':omz:alpha:lib:git' async-prompt force
```
## Getting Updates
By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by
adding a line to your `~/.zshrc` file, **before Oh My Zsh is loaded**:
1. Automatic update without confirmation prompt:
```sh
zstyle ':omz:update' mode auto
```
2. Just offer a reminder every few days, if there are updates available:
```sh
zstyle ':omz:update' mode reminder
```
3. To disable automatic updates entirely:
```sh
zstyle ':omz:update' mode disabled
```
NOTE: you can control how often Oh My Zsh checks for updates with the following setting:
```sh
# This will check for updates every 7 days
zstyle ':omz:update' frequency 7
# This will check for updates every time you open the terminal (not recommended)
zstyle ':omz:update' frequency 0
```
### Updates Verbosity
You can also limit the update verbosity with the following settings:
```sh
zstyle ':omz:update' verbose default # default update prompt
zstyle ':omz:update' verbose minimal # only few lines
zstyle ':omz:update' verbose silent # only errors
```
### Manual Updates
If you'd like to update at any point in time (maybe someone just released a new plugin and you don't want to
wait a week?) you just need to run:
```sh
omz update
```
> [!NOTE]
> If you want to automate this process in a script, you should call directly the `upgrade` script, like this:
>
> ```sh
> $ZSH/tools/upgrade.sh
> ```
>
> See more options in the [FAQ: How do I update Oh My Zsh?](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#how-do-i-update-oh-my-zsh).
>
> **USE OF `omz update --unattended` HAS BEEN REMOVED, AS IT HAS SIDE EFFECTS**.
Magic! 🎉
## Uninstalling Oh My Zsh
Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup.
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove
itself and revert your previous `bash` or `zsh` configuration.
## How Do I Contribute To Oh My Zsh?
Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve if you
have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send
pull requests!
We also need people to test out pull requests. So take a look through
[the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
See [Contributing](CONTRIBUTING.md) for more details.
### Do Not Send Us Themes
We have (more than) enough themes for the time being. Please add your theme to the
[external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
## Contributors
Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help
from our contributors, it wouldn't be so awesome.
Thank you so much!
<a href="https://github.com/ohmyzsh/ohmyzsh/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ohmyzsh/ohmyzsh" width="100%"/>
</a>
## Follow Us
We're on social media:
- [@ohmyzsh](https://x.com/ohmyzsh) on X (formerly Twitter). You should follow it.
- [Facebook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us.
- [Instagram](https://www.instagram.com/_ohmyzsh/) tag us in your post showing Oh My Zsh!
- [Discord](https://discord.gg/ohmyzsh) to chat with us!
## Merchandise
We have
[stickers, shirts, and coffee mugs available](https://commitgoods.com/collections/oh-my-zsh?utm_source=github)
for you to show off your love of Oh My Zsh. Again, you will become the talk of the town!
## License
Oh My Zsh is released under the [MIT license](LICENSE.txt).
## About Planet Argon
![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg)
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a
[Ruby on Rails development agency](https://www.planetargon.com/services/ruby-on-rails-development?utm_source=github).
Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github).

View File

@@ -0,0 +1,23 @@
# Security Policy
## Supported Versions
At the moment Oh My Zsh only considers the very latest commit to be supported.
We combine that with our fast response to incidents and the automated updates
to minimize the time between vulnerability publication and patch release.
| Version | Supported |
|:-------------- |:------------------ |
| master | :white_check_mark: |
| other commits | :x: |
In the near future we will introduce versioning, so expect this section to change.
## Reporting a Vulnerability
**Do not submit an issue or pull request**: this might reveal the vulnerability.
Instead, you should use the form to [privately report a vulnerability to us via GitHub](https://github.com/ohmyzsh/ohmyzsh/security/advisories/new)
or email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh).
We will deal with the vulnerability privately and submit a patch as soon as possible.

View File

@@ -0,0 +1 @@
LAST_EPOCH=20532

View File

@@ -0,0 +1,3 @@
alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox,.venv,venv}'
alias egrep='grep -E'
alias fgrep='grep -F'

View File

@@ -0,0 +1,12 @@
# Put files in this folder to add your own custom functionality.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
#
# Files in the custom/ directory will be:
# - loaded automatically by the init script, in alphabetical order
# - loaded last, after all built-ins in the lib/ directory, to override them
# - ignored by git by default
#
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
#
# brainstormr=~/Projects/development/planetargon/brainstormr
# cd $brainstormr

View File

@@ -0,0 +1,3 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-plugins

View File

@@ -0,0 +1,132 @@
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# Almost all code borrowed from Zshell's _make function
#
# Copyright (c) 2018 Sebastian Gniazdowski
local -a TARGETS
.make-expandVars() {
local open close var val front='' rest=$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
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
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
fi
rest=${rest//\$$open$var$close/$val}
done
print -- ${front}${rest}
}
.make-parseMakefile () {
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
}
# Cache generated parsing for 1sec per session or globally if configured, per Makefile path.
if [[ -n "${FAST_HIGHLIGHT[chroma-make-cache-global]}" ]]; then
# Determine Makefile path.
# TODO: find a way to expand path and resolve alias - this cause deduplicated cache file.
local makefile_path
makefile_path=${FAST_HIGHLIGHT[chroma-make-custom-dir]%/}/${FAST_HIGHLIGHT[chroma-make-custom-file]}
# If not absolute, resolve to absolute path
[[ $makefile_path != /* ]] && makefile_path="$PWD/$makefile_path"
# Generate a safe hash for the cache file name using sha1sum
local makefile_hash
makefile_hash=$(print -n -- "$makefile_path" | sha1sum | awk '{print $1}')
# Generate a sha1sum hash from the input variable
local input var val target dep TAB=$'\t' tmp IFS=
local input_hash
input_hash=$(print -n -- "$input" | sha1sum | awk '{print $1}')
# Generate the cache file path.
local cache_file
cache_file="/tmp/fast-highlight-make-cache-${makefile_hash}-${input_hash}"
if [[ ! -f $cache_file ]]; then
# Clean up old cache files.
rm -rf /tmp/fast-highlight-make-cache-${makefile_hash}-*
# Generate new cache file.
.make-parseMakefile "$input"
print -r -- "${(j:;:)TARGETS}" >| "$cache_file"
fi
FAST_HIGHLIGHT[chroma-make-cache]="$(<$cache_file)"
FAST_HIGHLIGHT[chroma-make-cache-born-at]="0"
else
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}"
fi
fi
reply2=( "${(s:;:)FAST_HIGHLIGHT[chroma-make-cache]}" )
# vim:ft=zsh:et

View File

@@ -0,0 +1,30 @@
# Copyright (c) 2018 Sebastian Gniazdowski
#
# $1 - path to the ini file to parse
# $2 - name of output hash (INI by default)
# $3 - prefix for keys in the hash (can be empty)
#
# Writes to given hash under keys built in following way: ${3}<section>_field.
# Values are values from ini file.
local __ini_file="$1" __out_hash="${2:-INI}" __key_prefix="$3"
local IFS='' __line __cur_section="void" __access_string
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
done < "$__ini_file"
return 0
# vim:ft=zsh:sw=4:sts=4:et

View File

@@ -0,0 +1,37 @@
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# Copyright (c) 2018 Sebastian Gniazdowski
#
# FAST_HIGHLIGHT hash serves as container for variables that
# prevents creating them in global scope. (P) flag is not used,
# output array is fixed (__lines_list).
#
# $1 - the command, e.g. "git remote"; 2>/dev/null redirection is
# added automatically
# $2 - FAST_HIGHLIGHT field name, e.g. "chroma-git-branches"; two
# additional fields will be used, $2-cache, $2-cache-born-at
# $3 - what to remove from beginning of the lines returned by the
# command
# $4 - cache validity time, default 5 (seconds)
#
# Output: array __lines_list, with output of the command ran
# User should not forget to define this array, the below code
# will only ensure that it's array (can also define a global)
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}"
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]}" )
fi
# vim:ft=zsh:et:sw=4

View File

@@ -0,0 +1,60 @@
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# Copyright (c) 2018 Sebastian Gniazdowski
#
# It runs given command, which in general will be a git command,
# automatically looking at cache first (a field named *-cache,
# in FAST_HIGHLIGHT), which is valid for 5 seconds, and in case
# of outdated or not existing cache, runs the command, splitting
# on new-lines, first checking if PWD is inside git repository.
#
# FAST_HIGHLIGHT hash serves as container for variables that
# prevents creating them in global scope. (P) flag is not used,
# output array is fixed (__lines_list).
#
# $1 - the command, e.g. "git remote"; 2>/dev/null redirection is
# added automatically
# $2 - FAST_HIGHLIGHT field name, e.g. "chroma-git-branches"; two
# additional fields will be used, $2-cache, $2-cache-born-at
# $3 - what to remove from beginning of the lines returned by the
# command
# $4 - cache validity time, default 5 (seconds)
#
# Output: array __lines_list, with output of the (git) command ran
# User should not forget to define this array, the below code
# will only ensure that it's array (can also define a global)
typeset -ga __lines_list
local -a __response
if [[ $1 == --status ]] {
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}"
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]}" )
fi
# vim:ft=zsh:et:sw=4

View File

@@ -0,0 +1,17 @@
# $1 - file-descriptor to be read from
# $2 - name of output variable (default: REPLY)
local __in_fd=${1:-0} __out_var=${2:-REPLY}
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; }
done
: ${(P)__out_var::="${(j::)__tmp}"}
return __ret
# vim: ft=zsh:et:sw=4:sts=4

View File

@@ -0,0 +1,8 @@
tap: false
directories:
tests: tests
output: tests/_output
support: tests/_support
time_limit: 0
fail_fast: false
allow_risky: false

View File

@@ -0,0 +1,147 @@
# News On Updates in F-Sy-H
**2018-08-09**
Added ideal string highlighting FSH now handles any legal quoting and combination of `"`,`'` and `\` when highlighting
program arguments. See the introduction for an example (item #14).
**2018-08-02**
Global aliases are now supported:
![image](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/global-alias.png)
**2018-08-01**
Hint how to customize styles when using Zplugin and turbo mode:
```zsh
zplugin ice wait"1" atload"set_fast_theme"
zplugin light zdharma/fast-syntax-highlighting
set_fast_theme() {
FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}paired-bracket]='bg=blue'
FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}bracket-level-1]='fg=red,bold'
FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}bracket-level-2]='fg=magenta,bold'
FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}bracket-level-3]='fg=cyan,bold'
}
```
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)).
**2018-07-30**
Ideal highlighting of brackets (pairing, etc.) no quoting can disturb the result:
![image](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/brackets.gif)
`FAST_HIGHLIGHT[use_brackets]=1` to enable this feature (**2018-07-31**: not needed anymore, this highlighting is active
by default).
**2018-07-21**
Chroma architecture now supports aliases. You can have `alias mygit="git commit"` and when `mygit` 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 for this, it's pushed to
master.
Second, asynchronous path checking (useful on e.g. slow network drives, or when there are many files in directory) is
now optional. Set `FAST_HIGHLIGHT[use_async]=1` to enable it. This saves some users from Zshell crashes there's an
unknown bug in Zsh.
**2018-06-09**
New chroma functions: `awk`, `make`, `perl`, `vim`. Checkout the [video](https://asciinema.org/a/186234), it shows
functionality of `awk` compiling of code and NOT running it. Perl can do this too:
[video](https://asciinema.org/a/186098).
**2018-06-06**
FSH 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
[example chroma](https://github.com/zdharma/fast-syntax-highlighting/blob/master/chroma/-example.ch) if you would like
to highlight a command.
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/git_chroma.png)
**2018-06-01**
Highlighting of command substitution (i.e. `$(...)`) with alternate theme two themes at once! It was just white
before:
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/cmdsubst.png)
To select which theme to use for `$(...)` set the key `secondary=` in
[theme ini file](https://github.com/zdharma/fast-syntax-highlighting/blob/master/themes/free.ini#L7). All shipped themes
have this key set (only the `default` theme doesn't use second theme).
Also added correct highlighting of descriptor-variables passed to `exec`:
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/execfd.png)
**2018-05-30**
For-loop is highlighted, it has separate settings in
[theme file](https://github.com/zdharma/fast-syntax-highlighting/blob/master/themes/free.ini).
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/for-loop.png)
**2018-05-27**
Added support for 256-color themes. There are six themes shipped with FSH. 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.
**2018-05-25**
Hash holding paths that shouldn't be grepped (globbed) blacklist for slow disks, mounts, etc.:
```zsh
typeset -gA FAST_BLIST_PATTERNS
FAST_BLIST_PATTERNS[/mount/nfs1/*]=1
FAST_BLIST_PATTERNS[/mount/disk2/*]=1
```
**2018-05-23**
Assign colorizing now spans to variables defined by `typeset`, `export`, `local`, etc.:
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/typeset.png)
Also, `zcalc` has a separate math mode and specialized highlighting no more light-red colors because of treating
`zcalc` like a regular command-line:
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/zcalc.png)
**2018-05-22**
Array assignments were still boring, so I throwed in bracked colorizing:
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/array-assign.png)
**2018-05-22**<a name="assign-update"></a>
Assignments are no more one-colour default-white. When used in assignment, highlighted are:
- variables (outside strings),
- strings (double-quoted and single-quoted),
- math-mode (`val=$(( ... ))`).
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/assign.png)
**2018-01-06**
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/master/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.
![animation](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/math.gif)

View File

@@ -0,0 +1,166 @@
# Chroma Guide for F-Sy-H
## Motivation
Someone might want to create a detailed highlighting for a **specific program**
and this document helps achieving this. It explains how chroma functions the
code behind such detailed highlighting are constructed and used.
## Keywords
- `chroma` - a shorthand for `chroma function` the thing that literally colorizes selected commands, like `git`, `grep`, etc. invocations, see `chroma function` below,
- `big loop` - main highlighting code, a loop over tokens and at least 2 large structular constructs (big `if` and `case`);
it is advanced, e.g. parses `case` statements, here-string, it basically constitutes 90% of the F-Sy-H project,
- `chroma function` - a plugin-function that is called when a specific command occurs (e.g. when user enters `git` at
command line) suppressing activity of `big loop` (i.e. no standard highlighting unless requested),
- `token` - result of splitting whole command line (i.e. `$BUFFER`, the Zle variable) into bits called tokens, which are
words in general, separated by spaces on the command line.
## Overview Of Functioning
1. Big loop is working token by token processes command line, changes states (e.g. enters state "inside case
statement") and in the end decides on color of the token currently processed.
2. Big loop occurs a command that has a chroma, e.g. `git`.
3. Big loop enters "chroma" state, calls associated chroma function.
4. Chroma takes care of "chroma" state, ensures it will be set also for next token.
5. "chroma" state is active, so all following tokens are routed to the chroma (in general skipping big-loop, see next items),
6. When processing of a single token is complete, the associated chroma returns 0
(shell-truth) to request no further processing by the big loop.
7. It can also return 1 so that single, current token will be passed into big-loop
for processing (to do a standard highlighting).
## Chroma-Function Arguments
- `$1` - 0 or 1, denoting if it's the first call to the chroma, or a following one,
- `$2` - the current token, also accessible by `$\__arg` from the upper 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* applied onto command line buffer (e.g.
`from-10 to-13 fg=red`),
- `$4` - a private copy of `$_end_pos` from the upper scope; denotes where current token
ends (at which index in the string being the command line).
So example invocation could look like this:
----
chroma/-example.ch 1 "grep" "$_start_pos" "$_end_pos"
----
Big-loop will be doing such calls for the user, after occurring a specific chroma-enabled command (like e.g. `awk`), and then until chroma will detect end of this chroma-enabled command (end of whole invocation, with arguments, etc.; in other words, when e.g. new line or `;`-character occurs, etc.).
## Example Chroma-Function
[source,zsh]
----
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# Copyright (c) 2018 Sebastian Gniazdowski
#
# 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).
#
# $1 - 0 or 1, denoting if it's first call to the chroma, or following one
#
# $2 - like above document says
#
# $3 - ...
#
# $4 - ...
#
# Other tips are:
# - $CURSOR holds cursor position
# - $BUFFER holds whole command line buffer
# - $LBUFFER holds command line buffer that is left from the cursor, i.e. it's a
# BUFFER substring 1 .. $CURSOR
# - $RBUFFER is the same as LBUFFER but holds part of BUFFER right to the cursor
#
# The function receives $BUFFER but via sequence of tokens, which are shell words,
# e.g. "a b c" is a shell word, while a b c are 3 shell words.
#
# FAST_HIGHLIGHT is a friendly hash array which allows to store strings without
# creating global parameters (variables). If you need hash, go ahead and use it,
# declaring first, under some distinct name like: typeset -gA CHROMA_EXPLE_DICT.
# 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.
# So the below 8192 assignment takes care that next token will be routed to chroma.
(( 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 string variables.
FAST_HIGHLIGHT[chroma-example-counter]=0
# Set style for region_highlight entry. It is used below in
# '[[ -n "$__style" ]] ...' line, which adds highlight entry,
# like "10 12 fg=green", through `reply' array.
#
# Could check if command `example' exists and set `unknown-token'
# style instead of `command'
__style=${FAST_THEME_NAME}command
} || {
# 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-example-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-example-counter] ))
# 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!
return 1
else
__style=${FAST_THEME_NAME}builtin
fi
else
__style=${FAST_THEME_NAME}globbing
fi
fi
}
# Add region_highlight entry (via `reply' array).
# If 1 will be added to __start_pos, this will highlight "oken".
# If 1 will be subtracted from __end_pos, this will highlight "toke".
# $PREBUFFER is for specific situations when users does command \<ENTER>
# i.e. when multi-line command using backslash is entered.
#
# 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]}")
# We aren't passing-through, do obligatory things ourselves.
# _start_pos=$_end_pos advainces pointers in command line buffer.
(( this_word = next_word ))
_start_pos=$_end_pos
return 0
----

View File

@@ -0,0 +1,23 @@
Copyright (c) 2010-2016 zsh-syntax-highlighting contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
may be used to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,283 @@
# Fast Syntax Highlighting (F-Sy-H) [![Gitter][gitter-image]][gitter-link]
Feature rich syntax highlighting for Zsh.
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/highlight-much.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Table of Contents
- [News](#news)
- [Installation](#installation)
- [Features](#features)
- [Performance](#performance)
### Other Contents
- [License](https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/LICENSE)
- [Changelog](https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/CHANGELOG.md)
- [Theme Guide](https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/THEME_GUIDE.md)
- [Chroma Guide](https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/CHROMA_GUIDE.adoc)
# News
- 15-06-2019
- A new architecture for defining the highlighting for **specific commands**: it now uses **abstract definitions**
instead of **top-down, regular code**. The first effect is the highlighting for the `git` command it is now
**maximally faithful**, it follows the `git` command almost completely. [Screencast](https://asciinema.org/a/253411)
# Installation
### Manual
Clone the Repository.
```zsh
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting ~/path/to/fsh
```
And add the following to your `zshrc` file.
```zsh
source ~/path/to/fsh/fast-syntax-highlighting.plugin.zsh
```
### Zinit
Add the following to your `zshrc` file.
```zsh
zinit light zdharma-continuum/fast-syntax-highlighting
```
Here's an example of how to load the plugin together with a few other popular ones with the use of
[Turbo](https://zdharma-continuum.org/zinit/wiki/INTRODUCTION/#turbo_mode_zsh_62_53), i.e.: speeding up the Zsh startup
by loading the plugin right after the first prompt, in background:
```zsh
zinit wait lucid for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions
```
### Antigen
Add the following to your `zshrc` file.
```zsh
antigen bundle zdharma-continuum/fast-syntax-highlighting
```
### Fig
[Fig](https://fig.io) adds apps, shortcuts, and autocomplete to your existing terminal.
Install `fast-syntax-highlighting` in just one click.
<a href="https://fig.io/plugins/other/fast-syntax-highlighting_zdharma-continuum" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" /></a>
### Zgen
Add the following to your `.zshrc` file in the same place you're doing your other `zgen load` calls in.
```zsh
zgen load zdharma-continuum/fast-syntax-highlighting
```
### Oh-My-Zsh
Clone the Repository.
```zsh
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
```
And add `fast-syntax-highlighting` to your plugin list.
# Features
### Themes
Switch themes via `fast-theme {theme-name}`.
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/theme.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
Run `fast-theme -t {theme-name}` option to obtain the snippet above.
Run `fast-theme -l` to list available themes.
### Variables
Comparing to the project `zsh-users/zsh-syntax-highlighting` (the upper line):
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/parameter.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/in_string.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Brackets
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/brackets.gif"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Conditions
Comparing to the project `zsh-users/zsh-syntax-highlighting` (the upper line):
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/cplx_cond.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Strings
Exact highlighting that recognizes quotings.
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/ideal-string.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### here-strings
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/herestring.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### `exec` descriptor-variables
Comparing to the project `zsh-users/zsh-syntax-highlighting` (the upper line):
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/execfd_cmp.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### for-loops and alternate syntax (brace `{`/`}` blocks)
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/for-loop-cmp.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Function definitions
Comparing to the project `zsh-users/zsh-syntax-highlighting` (the upper 2 lines):
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/function.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Recursive `eval` and `$( )` highlighting
Comparing to the project `zsh-users/zsh-syntax-highlighting` (the upper line):
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/eval_cmp.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Chroma functions
Highlighting that is specific for a given command.
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/git_chroma.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
The [chromas](https://github.com/zdharma-continuum/fast-syntax-highlighting/tree/master/%E2%86%92chroma) that are
enabled by default can be found
[here](https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/fast-highlight#L166).
### Math-mode highlighting
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/math.gif"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
### Zcalc highlighting
<div style="width:100%;background-color:black;border:3px solid black;border-radius:6px;margin:5px 0;padding:2px 5px">
<img
src="https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/zcalc.png"
alt="image could not be loaded"
style="color:red;background-color:black;font-weight:bold"
/>
</div>
# Performance
Performance differences can be observed in this Asciinema recording, where a `10 kB` function is being edited.
<div style="width:100%;background-color:#121314;border:3px solid #121314;border-radius:6px;margin:5px 0;padding:2px 5px">
<a href="https://asciinema.org/a/112367">
<img src="https://asciinema.org/a/112367.png" alt="asciicast">
</a>
</div>
[gitter-image]: https://badges.gitter.im/zdharma-continuum/community.svg
[gitter-link]: https://gitter.im/zdharma-continuum/community

View File

@@ -0,0 +1,73 @@
# Theme Guide for F-Sy-H
`fast-theme` tool is used to select a theme. There are 6 shipped themes, they can be listed with `fast-theme -l`. Themes
are basic [INI files](https://github.com/zdharma/fast-syntax-highlighting/tree/master/themes) where each key is a
*style*. Besides shipped themes, user can point this tool to any other theme, by simple `fast-theme ~/mytheme.ini`. To
obtain template to work on when creating own theme, issue `fast-theme --copy-shipped-theme {theme-name}`.
To alter just a few styles and not create a whole new theme, use **overlay**. What is overlay? It is in the same format
as full theme, but can have only a few styles defined, and these styles will overwrite styles in main-theme. Example
overlay file:
```ini
; overlay.ini
[base]
commandseparator = yellow,bold
comment = 17
[command-point]
function = green
command = 180
```
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/
```
So for example, issue `fast-theme XDG:overlay` to load `~/.config/fsh/overlay.ini` as overlay. The `.ini` extension is
optional.
## Secondary Theme
Each theme has key `secondary`, e.g. for theme `free`:
```ini
; free.ini
[base]
default = none
unknown-token = red,bold
; ...
; ...
; ...
secondary = zdharma
```
Secondary theme (`zdharma` in the example) will be used for highlighting of argument for `eval` and of `$( ... )`
interior (i.e. of interior of command substitution). Basically, recursive highlighting uses alternate theme to make the
highlighted code distinct:
![sshot](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/cmdsubst.png)
In the above screen-shot the interior of `$( ... )` uses different colors than the rest of the code. Example for `eval`:
![image](https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/images/eval_cmp.png)
First line doesn't use recursive highlighting, highlights `eval` argument as regular string. Second line switches theme
to `zdharma` and does full recursive highlighting of eval argument.
## Custom Working Directory
Set `$FAST_WORK_DIR` before loading the plugin to have e.g. processed theme files (ready to load, in Zsh format, not
INI) kept under specified location. This is handy if e.g. you install 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).

View File

@@ -0,0 +1,39 @@
#compdef fast-theme
#
# Copyright (c) 2018 Sebastian Gniazdowski
#
# Completion for theme-switching function, fast-theme,
# part of zdharma/fast-syntax-highlighting.
#
integer ret=1
local -a arguments
arguments=(
{-h,--help}'[display help text]'
{-l,--list}'[list available themes]'
{-r,--reset}'[unset any theme (revert to default highlighting)]'
{-R,--ov-reset}'[unset overlay, use styles only from main-theme (requires restart)]'
{-q,--quiet}'[no default messages]'
{-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)]'
)
typeset -a themes
themes=( "$FAST_WORK_DIR"/themes/*.ini(:t:r) )
if [[ -d ${XDG_CONFIG_HOME:-$HOME/.config}/fsh ]] {
typeset -a themes2
themes2=( "${XDG_CONFIG_HOME:-$HOME/.config}"/fsh/*.ini(:t:r) )
themes+=( XDG:${^themes2[@]} )
}
_wanted themes expl "Themes" \
compadd "$@" -a - themes && ret=0
_arguments -s $arguments && ret=0
return $ret

View File

@@ -0,0 +1,77 @@
# vim:ft=zsh:sw=4:sts=4
#
# $1 - PREBUFFER
# $2 - BUFFER
#
function -fast-highlight-string-process {
emulate -LR zsh
setopt extendedglob warncreateglobal typesetsilent
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
}

View File

@@ -0,0 +1,384 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2016 zsh-syntax-highlighting contributors
# Copyright (c) 2017-2019 Sebastian Gniazdowski (modifications)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- 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,
# regardless of functionargzero and posixargzero,
# and with an option for a plugin manager to alter
# the plugin directory (i.e. set ZERO parameter)
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
typeset -g FAST_HIGHLIGHT_VERSION=1.55
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
typeset -g FAST_WORK_DIR=${FAST_WORK_DIR:-${XDG_CACHE_HOME:-~/.cache}/fast-syntax-highlighting}
: ${FAST_WORK_DIR:=${FAST_BASE_DIR-}}
# Expand any tilde in the (supposed) path.
FAST_WORK_DIR=${~FAST_WORK_DIR}
# Last (currently, possibly) loaded plugin isn't "fast-syntax-highlighting"?
# And FPATH isn't containing plugin dir?
if [[ ${zsh_loaded_plugins[-1]-} != */fast-syntax-highlighting && -z ${fpath[(r)${0:h}]-} ]]
then
fpath+=( "${0:h}" )
fi
if [[ ! -w $FAST_WORK_DIR ]]; then
FAST_WORK_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/fsh"
command mkdir -p "$FAST_WORK_DIR"
fi
# Invokes each highlighter that needs updating.
# This function is supposed to be called whenever the ZLE state changes.
_zsh_highlight()
{
# Store the previous command return code to restore it whatever happens.
local ret=$?
# Remove all highlighting in isearch, so that only the underlining done by zsh itself remains.
# For details see FAQ entry 'Why does syntax highlighting not work while searching history?'.
if [[ $WIDGET == zle-isearch-update ]] && ! (( $+ISEARCHMATCH_ACTIVE )); then
region_highlight=()
return $ret
fi
emulate -LR zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops
local REPLY # don't leak $REPLY into global scope
local -a reply
# Do not highlight if there are more than 300 chars in the buffer. It's most
# likely a pasted command or a huge list of files in that case..
[[ -n ${ZSH_HIGHLIGHT_MAXLENGTH:-} ]] && [[ $#BUFFER -gt $ZSH_HIGHLIGHT_MAXLENGTH ]] && return $ret
# Do not highlight if there are pending inputs (copy/paste).
[[ $PENDING -gt 0 ]] && return $ret
# Reset region highlight to build it from scratch
# may need to remove path_prefix highlighting when the line ends
if [[ $WIDGET == zle-line-finish ]] || _zsh_highlight_buffer_modified; then
-fast-highlight-init
-fast-highlight-process "$PREBUFFER" "$BUFFER" 0
(( FAST_HIGHLIGHT[use_brackets] )) && {
_FAST_MAIN_CACHE=( $reply )
-fast-highlight-string-process "$PREBUFFER" "$BUFFER"
}
region_highlight=( $reply )
else
local char="${BUFFER[CURSOR+1]}"
if [[ "$char" = ["{([])}"] || "${FAST_HIGHLIGHT[prev_char]}" = ["{([])}"] ]]; then
FAST_HIGHLIGHT[prev_char]="$char"
(( FAST_HIGHLIGHT[use_brackets] )) && {
reply=( $_FAST_MAIN_CACHE )
-fast-highlight-string-process "$PREBUFFER" "$BUFFER"
region_highlight=( $reply )
}
fi
fi
{
local cache_place
local -a region_highlight_copy
# Re-apply zle_highlight settings
# region
if (( REGION_ACTIVE == 1 )); then
_zsh_highlight_apply_zle_highlight region standout "$MARK" "$CURSOR"
elif (( REGION_ACTIVE == 2 )); then
() {
local needle=$'\n'
integer min max
if (( MARK > CURSOR )) ; then
min=$CURSOR max=$(( MARK + 1 ))
else
min=$MARK max=$CURSOR
fi
(( min = ${${BUFFER[1,$min]}[(I)$needle]} ))
(( max += ${${BUFFER:($max-1)}[(i)$needle]} - 1 ))
_zsh_highlight_apply_zle_highlight region standout "$min" "$max"
}
fi
# yank / paste (zsh-5.1.1 and newer)
(( $+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"
# suffix
(( $+SUFFIX_ACTIVE )) && (( SUFFIX_ACTIVE )) && _zsh_highlight_apply_zle_highlight suffix bold "$SUFFIX_START" "$SUFFIX_END"
return $ret
} always {
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER="$BUFFER"
typeset -g _ZSH_HIGHLIGHT_PRIOR_RACTIVE="$REGION_ACTIVE"
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR
}
}
# Apply highlighting based on entries in the zle_highlight array.
# This function takes four arguments:
# 1. The exact entry (no patterns) in the zle_highlight array:
# region, paste, isearch, or suffix
# 2. The default highlighting that should be applied if the entry is unset
# 3. and 4. Two integer values describing the beginning and end of the
# range. The order does not matter.
_zsh_highlight_apply_zle_highlight() {
local entry="$1" default="$2"
integer first="$3" second="$4"
# read the relevant entry from zle_highlight
local region="${zle_highlight[(r)${entry}:*]}"
if [[ -z "$region" ]]; then
# entry not specified at all, use default value
region=$default
else
# strip prefix
region="${region#${entry}:}"
# no highlighting when set to the empty string or to 'none'
if [[ -z "$region" ]] || [[ "$region" == none ]]; then
return
fi
fi
integer start end
if (( first < second )); then
start=$first end=$second
else
start=$second end=$first
fi
region_highlight+=("$start $end $region")
}
# -------------------------------------------------------------------------------------------------
# API/utility functions for highlighters
# -------------------------------------------------------------------------------------------------
# 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 ]] }
}
# Whether the cursor has moved or not.
#
# Returns 0 if the cursor has moved since _zsh_highlight was last called.
_zsh_highlight_cursor_moved()
{
[[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (($_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR))
}
# -------------------------------------------------------------------------------------------------
# Setup functions
# -------------------------------------------------------------------------------------------------
# Helper for _zsh_highlight_bind_widgets
# $1 is name of widget to call
_zsh_highlight_call_widget()
{
integer ret
builtin zle "$@"
ret=$?
_zsh_highlight
return $ret
}
# Rebind all ZLE widgets to make them invoke _zsh_highlights.
_zsh_highlight_bind_widgets()
{
setopt localoptions noksharrays
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.'
return 1
}
# Override ZLE widgets to make them invoke _zsh_highlight.
local -U widgets_to_bind
widgets_to_bind=(${${(k)widgets}:#(.*|run-help|which-command|beep|set-local-history|yank|zle-line-pre-redraw|zle-keymap-select)})
# Always wrap special zle-line-finish widget. This is needed to decide if the
# current line ends and special highlighting logic needs to be applied.
# E.g. remove cursor imprint, don't highlight partial paths, ...
widgets_to_bind+=(zle-line-finish)
# Always wrap special zle-isearch-update widget to be notified of updates in isearch.
# This is needed because we need to disable highlighting in that case.
widgets_to_bind+=(zle-isearch-update)
local cur_widget
for cur_widget in $widgets_to_bind; do
case ${widgets[$cur_widget]-} in
# Already rebound event: do nothing.
user:_zsh_highlight_widget_*);;
# The "eval"'s are required to make $cur_widget a closure: the value of the parameter at function
# definition time is used.
#
# We can't use ${0/_zsh_highlight_widget_} because these widgets are always invoked with
# NO_function_argzero, regardless of the option's setting here.
# User defined widget: override and rebind old one with prefix "orig-".
user:*) zle -N -- $prefix-$cur_widget ${widgets[$cur_widget]#*:}
eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget ${(q)prefix}-${(q)cur_widget} -- \"\$@\" }"
zle -N -- $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;;
# Completion widget: override and rebind old one with prefix "orig-".
completion:*) zle -C $prefix-$cur_widget ${${(s.:.)widgets[$cur_widget]}[2,3]}
eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget ${(q)prefix}-${(q)cur_widget} -- \"\$@\" }"
zle -N -- $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;;
# Builtin widget: override and make it call the builtin ".widget".
builtin) eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget .${(q)cur_widget} -- \"\$@\" }"
zle -N -- $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;;
# Incomplete or nonexistent widget: Bind to z-sy-h directly.
*)
if [[ $cur_widget == zle-* ]] && [[ -z ${widgets[$cur_widget]-} ]]; then
_zsh_highlight_widget_${cur_widget}() { :; _zsh_highlight }
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}"
fi
esac
done
}
# -------------------------------------------------------------------------------------------------
# Setup
# -------------------------------------------------------------------------------------------------
# Try binding widgets.
_zsh_highlight_bind_widgets || {
print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.'
return 1
}
# Reset scratch variables when commandline is done.
_zsh_highlight_preexec_hook()
{
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=0
typeset -ga _FAST_MAIN_CACHE
_FAST_MAIN_CACHE=()
}
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.'
}
/fshdbg() {
print -r -- "$@" >>! /tmp/reply
}
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 .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/-podman.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/-zinit.ch
source "${0:h}/fast-highlight"
source "${0:h}/fast-string-highlight"
local __fsyh_theme
zstyle -s :plugin:fast-syntax-highlighting theme __fsyh_theme
[[ ( "${+termcap}" != 1 || "${termcap[Co]}" != <-> || "${termcap[Co]}" -lt "256" ) && "$__fsyh_theme" = (default|) ]] && {
FAST_HIGHLIGHT_STYLES[defaultvariable]="none"
FAST_HIGHLIGHT_STYLES[defaultglobbing-ext]="fg=blue,bold"
FAST_HIGHLIGHT_STYLES[defaulthere-string-text]="bg=blue"
FAST_HIGHLIGHT_STYLES[defaulthere-string-var]="fg=cyan,bg=blue"
FAST_HIGHLIGHT_STYLES[defaultcorrect-subtle]="bg=blue"
FAST_HIGHLIGHT_STYLES[defaultsubtle-bg]="bg=blue"
[[ "${FAST_HIGHLIGHT_STYLES[variable]}" = "fg=113" ]] && FAST_HIGHLIGHT_STYLES[variable]="none"
[[ "${FAST_HIGHLIGHT_STYLES[globbing-ext]}" = "fg=13" ]] && FAST_HIGHLIGHT_STYLES[globbing-ext]="fg=blue,bold"
[[ "${FAST_HIGHLIGHT_STYLES[here-string-text]}" = "bg=18" ]] && FAST_HIGHLIGHT_STYLES[here-string-text]="bg=blue"
[[ "${FAST_HIGHLIGHT_STYLES[here-string-var]}" = "fg=cyan,bg=18" ]] && FAST_HIGHLIGHT_STYLES[here-string-var]="fg=cyan,bg=blue"
[[ "${FAST_HIGHLIGHT_STYLES[correct-subtle]}" = "fg=12" ]] && FAST_HIGHLIGHT_STYLES[correct-subtle]="bg=blue"
[[ "${FAST_HIGHLIGHT_STYLES[subtle-bg]}" = "bg=18" ]] && FAST_HIGHLIGHT_STYLES[subtle-bg]="bg=blue"
}
unset __fsyh_theme
alias fsh-alias=fast-theme
-fast-highlight-fill-option-variables
if [[ ! -e $FAST_WORK_DIR/secondary_theme.zsh ]] {
if { type curl &>/dev/null } {
curl -fsSL -o "$FAST_WORK_DIR/secondary_theme.zsh" \
https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/share/free_theme.zsh \
&>/dev/null
} elif { type wget &>/dev/null } {
wget -O "$FAST_WORK_DIR/secondary_theme.zsh" \
https://raw.githubusercontent.com/zdharma-continuum/fast-syntax-highlighting/master/share/free_theme.zsh \
&>/dev/null
}
touch "$FAST_WORK_DIR/secondary_theme.zsh"
}
if [[ $(uname -a) = (#i)*darwin* ]] {
typeset -gA FAST_HIGHLIGHT
FAST_HIGHLIGHT[chroma-man]=
}
[[ ${COLORTERM-} == (24bit|truecolor) || ${terminfo[colors]} -eq 16777216 ]] || zmodload zsh/nearcolor &>/dev/null || true

View File

@@ -0,0 +1,385 @@
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# Copyright (c) 2018 Sebastian Gniazdowski
# Copyright (c) 2018, 2019 Philippe Troin (F-i-f on GitHub)
#
# Theme support using ini-files.
#
zmodload zsh/zutil 2>/dev/null
emulate -LR zsh
setopt extendedglob typesetsilent warncreateglobal
autoload colors; colors
typeset -g FAST_WORK_DIR
: ${FAST_WORK_DIR:=$FAST_BASE_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/"
)
FAST_WORK_DIR=${${FAST_WORK_DIR/(#m)(#s)(XDG|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_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; }
(( ${+opthash[-h]} + ${+opthash[--help]} )) && OPT_HELP="-h"
(( ${+opthash[-v]} + ${+opthash[--verbose]} )) && OPT_VERBOSE="-v"
(( ${+opthash[-q]} + ${+opthash[--quiet]} )) && OPT_QUIET="-q"
(( ${+opthash[-r]} + ${+opthash[--reset]} )) && OPT_RESET="-r"
(( ${+opthash[-l]} + ${+opthash[--list]} )) && OPT_LIST="-l"
(( ${+opthash[-t]} + ${+opthash[--test]} )) && OPT_TEST="-t"
(( ${+opthash[--secondary]} )) && OPT_SECONDARY="--secondary"
(( ${+opthash[-s]} + ${+opthash[--show]} )) && OPT_SHOW="-s"
(( ${+opthash[--copy-shipped-theme]} )) && OPT_COPY="${opthash[--copy-shipped-theme]}"
(( ${+opthash[-R]} + ${+opthash[--ov-reset]} )) && OPT_OV_RESET="-R"
(( ${+opthash[-p]} + ${+opthash[--palette]} )) && OPT_PALETTE="-p"
(( ${+opthash[-w]} + ${+opthash[--workdir]} )) && OPT_CDWD="-w"
(( ${+opthash[-x]} + ${+opthash[--xchg]} )) && OPT_XCHG="-x"
(( ${+opthash[-y]} + ${+opthash[--ov-xchg]} )) && OPT_OV_XCHG="-y"
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
[[ -n "$OPT_CDWD" ]] && {
builtin cd $FAST_WORK_DIR
return 0
}
[[ -n "$OPT_PALETTE" ]] && {
local n
local -a __colors
for n in {000..255}
do
__colors+=("%F{$n}$n%f")
done
print -cP $__colors
return
}
[[ -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"; )
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; }
[[ -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; }
[[ -n "$OPT_LIST" ]] && {
[[ -z "$OPT_QUIET" ]] && print -r -- "Available themes:"
print -rl -- "$FAST_BASE_DIR"/themes/*.ini(:t:r)
return 0
}
[[ -n "$OPT_HELP" ]] && {
print -r -- "Usage: fast-theme [-h/--help] [-v/--verbose] [-q/--quiet] [-t/--test] <theme-name|theme-path>"
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 <theme-name> or <theme-path>) is to switch"
print -r -- "current session and any future sessions to the new theme. Using <theme-path>,"
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/<theme>.ini"
print -r -- "(or \$XDG_CONFIG_HOME/fsh/<theme>.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."
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 -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
}
[[ -z "$1" ]] && { print -u2 "Provide a theme (its name or path to its file) to switch to, aborting (see -h/--help)"; return 1; }
# FAST_HIGHLIGHT_STYLES key onto ini-file key
map=(
default "-"
unknown-token "-"
reserved-word "-"
subcommand "- reserved-word"
alias "- command builtin"
suffix-alias "- alias command builtin"
builtin "-"
function "- builtin command"
command "-"
precommand "- command"
commandseparator "-"
hashed-command "- command"
path "-"
path_pathseparator "pathseparator"
globbing "- back-or-dollar-double-quoted-argument" # fallback: variable in string "text $var text"
globbing-ext "- double-quoted-argument" # fallback: the string "abc..."
history-expansion "-"
single-hyphen-option "- single-quoted-argument"
double-hyphen-option "- double-quoted-argument"
back-quoted-argument "-"
single-quoted-argument "-"
double-quoted-argument "-"
dollar-quoted-argument "-"
back-or-dollar-double-quoted-argument "- back-dollar-quoted-argument"
back-dollar-quoted-argument "- back-or-dollar-double-quoted-argument"
assign "- reserved-word"
redirection "- reserved-word"
comment "-"
variable "-"
mathvar "- forvar variable"
mathnum "- fornum"
matherr "- incorrect-subtle"
assign-array-bracket "-"
for-loop-variable "forvar mathvar variable"
for-loop-number "fornum mathnum"
for-loop-operator "foroper reserved-word"
for-loop-separator "forsep commandseparator"
exec-descriptor "- reserved-word"
here-string-tri "-"
here-string-text "- subtle-bg"
here-string-var "- back-or-dollar-double-quoted-argument"
secondary "-"
recursive-base "- default"
case-input "- variable"
case-parentheses "- reserved-word"
case-condition "- correct-subtle"
correct-subtle "-"
incorrect-subtle "-"
subtle-separator "- commandseparator"
subtle-bg "- correct-subtle"
path-to-dir "- path"
paired-bracket "- subtle-bg correct-subtle"
bracket-level-1 "-"
bracket-level-2 "-"
bracket-level-3 "-"
global-alias "- alias suffix-alias"
single-sq-bracket "-"
double-sq-bracket "-"
double-paren "-"
optarg-string "- double-quoted-argument"
optarg-number "- mathnum"
)
# 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
)
[[ -n "$OPT_VERBOSE" ]] && print "Number of styles available for customization: ${#order}"
# Named colors
local -a color
color=( red green blue yellow cyan magenta black white default )
#
# Execution starts here
#
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 ""
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; }
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"
[[ -z "$OPT_XCHG" && -z "$OPT_OV_XCHG" ]] && command rm -f "$FAST_WORK_DIR"/"$outfile"
# 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"
}
elif [[ -z "$OPT_XCHG" && -z "$OPT_OV_XCHG" ]]; then
local FAST_THEME_NAME="$THEME_NAME"
fi
# Store from which file the theme or overlay is being loaded
[[ "$THEME_NAME" != *"overlay" && -z "$OPT_OV_XCHG" ]] && FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}-path]="$THEME_PATH" || FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}-ov-path]="$THEME_PATH"
# Generate current_theme.zsh or secondary_theme.zsh, traversing ini-file associative array
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
[[ "$kk" = "-" ]] && kk="$k"
(( first )) && first_val="$kk"
inikey="${out[(i)<*>_${kk}]}"
[[ -n "$inikey" ]] && {
(( !first )) && [[ -z "$OPT_QUIET" ]] && {
[[ $kk = default ]] && {
[[ "$THEME_NAME" != *"overlay"* ]] && print "Missing style: $first_val"
} || print "For style $first_val, went for fallback style $kk"
}
break
}
first=0
[[ "$THEME_NAME" = *"overlay"* ]] && break
done
# ORIG: Clear orig-style when loading a new theme, not overlay
[[ -z "$OPT_OV_XCHG" ]] && unset "FAST_HIGHLIGHT_STYLES[orig-style-$k]"
# ORIG: Restore orig-style when loading a new overlay
[[ -n "$OPT_OV_XCHG" && -n "${FAST_HIGHLIGHT_STYLES[orig-style-$k]}" ]] && { FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}$k]="${FAST_HIGHLIGHT_STYLES[orig-style-$k]}"; unset "FAST_HIGHLIGHT_STYLES[orig-style-$k]"; }
# Set only the keys provided in theme
[[ -z "$inikey" ]] && { [[ -z "$OPT_QUIET" && "$THEME_NAME" != *"overlay"* ]] && print "Missing style $first_val"; continue; }
inival="${out[$inikey]}"
if [[ "$k" = "secondary" && -z "$OPT_SECONDARY" && -n "$inival" ]]; then
fast-theme -q --secondary "$inival"
fi
result=""
if [[ $k = secondary ]]; then
result="$inival"
else
for kk in ${(s:,:)inival}
do
if [[ $kk = (none|(no-|)(bold|blink|conceal|reverse|standout|underline)) ]]; then
result+="${result:+,}$kk"
else
isbg=0
if [[ $kk = bg:* ]]; then
isbg=1
kk=${kk#bg:}
fi
if [[ $kk = (${(~j:|:)color}) || $kk = [0-9]## || $kk = \#[0-9a-fA-F](#c6,6) ]]; then
result+="${result:+,}"
(( isbg )) && result+="bg=" || result+="fg="
result+="$kk"
else
print "cannot parse style $k: unknown color or style element $kk"
fi
fi
done
fi
if [[ "$THEME_NAME" = *"overlay"* || -n "$OPT_OV_XCHG" ]]; then
(( ++ ov_counter ))
[[ -z "$OPT_XCHG$OPT_OV_XCHG" ]] && print -r -- ': ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}'"$k"']::='"$result"'}' >>! "$FAST_WORK_DIR"/"$outfile"
# ORIG: Save original value of the overwritten style
FAST_HIGHLIGHT_STYLES[orig-style-$k]=${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}$k]}
# Overwrite theme's style
FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}$k]="$result"
else
[[ -z "$OPT_XCHG$OPT_OV_XCHG" ]] && print -r -- ': ${FAST_HIGHLIGHT_STYLES['"${FAST_THEME_NAME}$k"']:='"$result"'}' >>! "$FAST_WORK_DIR"/"$outfile"
FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}$k]="$result"
fi
done
# This can overwrite some of *_STYLES fields
# Re-apply overlay on top of the theme we switched to
[[ "$THEME_NAME" != *"overlay"* ]] && [[ -r "$FAST_WORK_DIR"/theme_overlay.zsh ]] && source "$FAST_WORK_DIR"/theme_overlay.zsh
zcompile $FAST_WORK_DIR/$outfile 2>/dev/null
[[ -z "$OPT_QUIET" ]] && {
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
}
[[ -n "$OPT_TEST" ]] && {
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
# 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
}
'
}
return 0
# vim:ft=zsh:et:sw=4:sts=4

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +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[freebuiltin]:=fg=180}
: ${FAST_HIGHLIGHT_STYLES[freefunction]:=fg=180}
: ${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[freedouble-hyphen-option]:=fg=110}
: ${FAST_HIGHLIGHT_STYLES[freeback-quoted-argument]:=none}
: ${FAST_HIGHLIGHT_STYLES[freesingle-quoted-argument]:=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[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[freehere-string-text]:=bg=19}
: ${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[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[freeoptarg-number]:=fg=166}
: ${FAST_HIGHLIGHT_STYLES[freerecursive-base]:=fg=183}

Some files were not shown because too many files have changed in this diff Show More