From 63ecba605fa53bad08f099979b3c5aa41be432fc Mon Sep 17 00:00:00 2001 From: cyteen Date: Thu, 12 Feb 2026 12:47:27 +0000 Subject: [PATCH] Updaes and a couple of new installers. --- 020_batcat.sh | 274 ++++++++++++++++++ 020_neovim-lazyvim_plugins.sh | 56 ++++ 020_rustup.sh | 69 +++++ 020_rustup_checkinstall.sh | 33 ++- 020_tmux.sh | 35 ++- 020_yazi-file-manager.sh | 7 - 020_yazi-filemanager.sh | 510 ++++++++++++++++++++++++++++++++++ 020_zsh_aliases.d.sh | 36 +-- 020_zsh_quickstart.sh | 39 +-- 9 files changed, 991 insertions(+), 68 deletions(-) create mode 100644 020_batcat.sh create mode 100644 020_rustup.sh delete mode 100644 020_yazi-file-manager.sh create mode 100644 020_yazi-filemanager.sh diff --git a/020_batcat.sh b/020_batcat.sh new file mode 100644 index 0000000..93085c7 --- /dev/null +++ b/020_batcat.sh @@ -0,0 +1,274 @@ +#!/usr/bin/env bash + +DEST=${1:-/etc/skel} +BAT_HOME=${DEST}/.config/bat +BAT_THEMES=${BAT_HOME}/themes +BAT_SYNTAX=${BAT_HOME}/syntaxes + +sudo apt install bat + +# +# wget -P "${BAT_SYNTAX}" "https://raw.githubusercontent.com/Sublime-Instincts/BetterJinja/refs/heads/master/Syntaxes/YAML/YAML%20(Jinja).sublime-syntax" +# wget -P "${BAT_SYNTAX}" "https://raw.githubusercontent.com/Sublime-Instincts/BetterJinja/refs/heads/master/Syntaxes/Text/Text%20(Jinja).sublime-syntax" + +conf_print_jinja_syntax() { + cat <<'EOF' +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/syntax.html +name: YAML (Jinja) +scope: source.yaml.jinja +version: 2 + +#extends: Packages/YAML/YAML.sublime-syntax +extends: YAML + +file_extensions: + - yaml.jinja + - yaml.jinja2 + - yaml.j2 + - jinja.yaml + - jinja2.yaml + - j2.yaml + - yml.jinja + - yml.jinja2 + - yml.j2 + - jinja.yml + - jinja2.yml + - j2.yml + # Django + - djyml + - dj.yml + - yml.djt + - djyaml + - dj.yaml + - yaml.djt + - yaml.sls + +variables: + ns_plain_first_plain_in: |- # c=plain-in + (?x: + {{yaml_ns_plain_first_plain_in}} + | (?:[?:-] )?{{ # begins with interpolation + ) + + # original value from YAML + yaml_ns_plain_first_plain_in: |- # c=plain-in + (?x: + [^\s{{c_indicator}}] + | [?:-] [^\s{{c_flow_indicator}}] + ) + + ns_plain_first_plain_out: |- # c=plain-out + (?x: + {{yaml_ns_plain_first_plain_out}} + | (?:[?:-] )?{{ # begins with interpolation + ) + + # original value from YAML + yaml_ns_plain_first_plain_out: |- # c=plain-out + (?x: + [^\s{{c_indicator}}] + | [?:-] \S + ) + + _flow_key_in_lookahead: |- + (?x: + (?= + ( + (?: + {{yaml_ns_plain_first_plain_in}} + | {{jinja_interpolation}} # begins with interpolation + ) + ( [^\s:{{c_flow_indicator}}] + | : [^\s{{c_flow_indicator}}] + | \s+ (?![#\s]) + | {{jinja_interpolation}} # ignore interpolation + )* + | \".*\" # simplified + | \'.*\' + ) + \s* + : + (?:\s|$) + ) + ) + + _flow_key_out_lookahead: |- + (?x: + (?= + + ( + (?: + {{yaml_ns_plain_first_plain_out}} + | {{jinja_interpolation}} # begins with interpolation + ) + ( [^\s:] + | : \S + | \s+ (?![#\s]) + | {{jinja_interpolation}} # ignore interpolation + )* + | \".*\" # simplified + | \'.*\' + ) + \s* + : + (?:\s|$) + ) + ) + + jinja_interpolation: '{{.*?}}' + +contexts: + + main: + - meta_prepend: true + - meta_scope: meta.template.jinja + + block-scalar-body: + - meta_prepend: true + - include: Text (Jinja).sublime-syntax#interpolations + + flow-scalar-plain-in-body: + - meta_prepend: true + - include: Text (Jinja).sublime-syntax#interpolations + + flow-scalar-plain-out-body: + - meta_prepend: true + - include: Text (Jinja).sublime-syntax#interpolations + + flow-scalar-double-quoted-body: + - meta_prepend: true + - include: Text (Jinja).sublime-syntax#interpolations + + flow-scalar-single-quoted-body: + - meta_prepend: true + - include: Text (Jinja).sublime-syntax#interpolations + + flow-collection: + - meta_prepend: true + - include: Text (Jinja).sublime-syntax#jinja-comment-tags + - include: Text (Jinja).sublime-syntax#jinja-statement-tags + + flow-mapping: + - match: \{(?![{%#]) + scope: punctuation.definition.mapping.begin.yaml + push: flow-mapping-body + +EOF +} +#conf_print_jinja_syntax | tee ${BAT_SYNTAX}/YAML_jinja.sublime-syntax + +conf_print_jinja_syntax() { + cat <<'EOF' +%YAML 1.2 +--- +name: YAML with Jinja2 +scope: source.yaml.jinja +file_extensions: + - yaml + - yml +extends: YAML + +contexts: + main: + - include: jinja-variables + - include: jinja-blocks + - include: jinja-comments + + jinja-variables: + - match: '\{\{' + scope: punctuation.section.embedded.begin.jinja + push: + - meta_scope: source.jinja.embedded + - match: '\}\}' + scope: punctuation.section.embedded.end.jinja + pop: true + + jinja-blocks: + - match: '\{%' + scope: punctuation.section.embedded.begin.jinja + push: + - meta_scope: source.jinja.embedded + - match: '%\}' + scope: punctuation.section.embedded.end.jinja + pop: true + + jinja-comments: + - match: '\{#' + scope: punctuation.definition.comment.begin.jinja + push: + - meta_scope: comment.block.jinja + - match: '#\}' + scope: punctuation.definition.comment.end.jinja + pop: true +EOF +} +#conf_print_jinja_syntax | tee ${BAT_SYNTAX}/YAML_jinja.sublime-syntax + +# Built in themes. +# echo $(bat --list-themes) +# 1337 Coldark-Cold Coldark-Dark DarkNeon Dracula GitHub Monokai Extended (default dark) Monokai Extended Bright Monokai Extended Light (default light) Monokai Extended Origin Nord OneHalfDark OneHalfLight Solarized (dark) Solarized (light) Sublime Snazzy TwoDark Visual Studio Dark+ ansi base16 base16-256 gruvbox-darkgruvbox-light zenburn + +conf_print_bat_config() { + cat <<'EOF' +# This is $(bat)s configuration file. Each line either contains a comment or +# a command-line option that you want to pass to $(bat) by default. You can +# run $(bat --help) to get a list of all possible configuration options. + +# Specify desired highlighting theme (e.g. "TwoDark"). Run $(bat --list-themes) +# for a list of all available themes +#--theme="Solarized (dark)" +--theme="Catppuccin Mocha" + +# Enable this to use italic text on the terminal. This is not supported on all +# terminal emulators (like tmux, by default): +#--italic-text=always + +# Uncomment the following line to disable automatic paging: +#--paging=never + +# Uncomment the following line if you are using less version >= 551 and want to +# enable mouse scrolling support in $(bat) when running inside tmux. This might +# disable text selection, unless you press shift. +--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse" + +# Syntax mappings: map a certain filename pattern to a language. +# Example 1: use the C++ syntax for Arduino .ino files +# Example 2: Use ".gitignore"-style highlighting for ".ignore" files +#--map-syntax "*.ino:C++" +#--map-syntax ".ignore:Git Ignore" +EOF +} +conf_print_bat_config | tee ${BAT_HOME}/config + +conf_print_bat_aliases() { + cat </dev/null; then + alias bat='bat' +else + alias bat='batcat' +fi + +export MANPAGER="sh -c 'col -bx | bat -l man -p'" +export MANROFFOPT="-c" +EOF +} +conf_print_bat_aliases | tee ${DEST}/.zsh_aliases.d/004_batcat.sh + +source ${DEST}/.zsh_aliases.d/004_batcat.sh + +batcat cache --build +batcat --list-themes | grep "Catppuccin Mocha" +batcat --list-languages | grep -i jinja diff --git a/020_neovim-lazyvim_plugins.sh b/020_neovim-lazyvim_plugins.sh index 9184695..cfb7b9e 100644 --- a/020_neovim-lazyvim_plugins.sh +++ b/020_neovim-lazyvim_plugins.sh @@ -4,6 +4,62 @@ DEST=${1:-/etc/skel} LAZY_DEST=${DEST}/.config/nvim/lua/plugins LAZY_SYNTAX=${DEST}/.config/nvim/after/queries +# Yazi tui filemanager +# For extra configuration options see: +# https://github.com/mikavilpas/yazi.nvim +# https://github.com/mikavilpas/yazi.nvim#%EF%B8%8F%EF%B8%8F-advanced-configuration +conf_print_yazi() { + cat <-", + mode = { "n", "v" }, + "Yazi", + desc = "Open yazi at the current file", + }, + { + -- Open in the current working directory + "cw", + "Yazi cwd", + desc = "Open the file manager in nvim's working directory", + }, + { + "", + "Yazi toggle", + desc = "Resume the last yazi session", + }, + }, + ---@type YaziConfig | {} + opts = { + -- if you want to open yazi instead of netrw, see below for more info + open_for_directories = false, + keymaps = { + show_help = "", + }, + }, + -- 👇 if you use $(open_for_directories=true), this is recommended + init = function() + -- mark netrw as loaded so it's not loaded at all. + -- + -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802 + vim.g.loaded_netrwPlugin = 1 + end, + } +} +EOF +} +conf_print_yazi | tee ${LAZY_DEST}/yazi.lua + # Use triple backtick for code blocks rather than tab # set code-block-style: or MD046: om ~/.markdownlint-cli2.yaml conf_print_markdownlint_yaml() { diff --git a/020_rustup.sh b/020_rustup.sh new file mode 100644 index 0000000..b09cded --- /dev/null +++ b/020_rustup.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +# Rustup is available in debian and will install the latest rustc and cargo + +DEST=${1:-/etc/skel} +RUSTUP_HOME=${DEST}/.rustup +CARGO_HOME=${DEST}/.cargo + +sudo apt install rustup lldb # cargo-debstatus + +if [[ -d ${RUSTUP_HOME} ]]; then + mv ${RUSTUP_HOME} ${RUSTUP_HOME}-backup +fi + +if [[ -d ${CARGO_HOME} ]]; then + mv ${CARGO_HOME} ${CARGO_HOME}-backup +fi + +mkdir -p ${DEST}/.cargo ${DEST}/.rustup +# sudo chown -R $(whoami) ${DEST}/.cargo ${DEST}/.rustup + +# RUSTC_BOOTSTRAP = "1" allows nightly features; use cautiously. +conf_print_cargo_config() { + cat <= 0.53.0) +# zoxide (for historical directories navigation, requires fzf) +# resvg (for SVG preview) +# ImageMagick (for Font, HEIC, and JPEG XL preview, >= 7.1.1) +# xclip / wl-clipboard / xsel (for Linux clipboard support) + +ARCH=$(dpkg-architecture -qDEB_HOST_GNU_CPU) +INSTALL_TYPE="${2:-deb_stable}" # Default to deb_stable: deb_stable, deb_nightly, cargo, cargo-git, skip_build + +case "$INSTALL_TYPE" in +"deb_stable") + RELEASE=$(lastversion --format tag sxyazi/yazi) + URL="https://github.com/sxyazi/yazi/releases/download/${RELEASE}/yazi-${ARCH}-unknown-linux-gnu.deb" + wget -c -P /var/tmp "$URL" + sudo dpkg -i /var/tmp/yazi-"${ARCH}"-unknown-linux-gnu.deb + ;; + +"deb_nightly") + URL="https://github.com/sxyazi/yazi/releases/download/nightly/yazi-${ARCH}-unknown-linux-gnu.deb" + wget -c -P /var/tmp "$URL" + sudo dpkg -i /var/tmp/yazi-"${ARCH}"-unknown-linux-gnu.deb + ;; + +# These are a big one, the build in ${HOME}/.cargo grows to over 1GB +"cargo") + cargo install --force yazi-build + ;; + +"cargo-git") + cargo install --force --git https://github.com/sxyazi/yazi.git yazi-build + ;; + +"skip_build") ;; +*) + echo "Usage: $0 [deb_stable|deb_nightly|cargo|cargo-git|skip_build]" + exit 1 + ;; +esac + +sudo apt-get update +sudo apt-get -f install +sudo apt install -y ffmpeg 7zip jq poppler-utils fd-find ripgrep fzf glow zoxide \ + imagemagick xclip xsel wl-clipboard mediainfo resvg + +# Install supporting cargo packages +cargo install ouch + +# Configuration +# +conf_print_readme() { + cat <<'EOF' +# nico-yazi-config + +The files I am currently using (18-01-2026) for my yazi configuration. Please +note that many software need to be installed for it to all work properly (I +might have forgotten a thing or two... let me know if you see something missing ^^) + +Yazi plugins installed: + + + +- fg ya pkg add lpnh/fr git clone https://github.com/lpnh/fr.yazi ${YAZI_PLUGINS}/fr.yazi +- zoxide +# git clone https://github.com/yazi-rs/plugins.git ${YAZI_PLUGINS}/yazi-rs/ +- git ya pkg add yazi-rs/plugins:git https://github.com/yazi-rs/plugins/tree/main/git.yazi +- smart-enter ya pkg add yazi-rs/plugins:smart-enter https://github.com/yazi-rs/plugins/blob/main/smart-enter.yazi +- chmod ya pkg add yazi-rs/plugins:chmod https://github.com/yazi-rs/plugins/tree/main/chmod.yazi +- full-border ya pkg add yazi-rs/plugins:full-border https://github.com/yazi-rs/plugins/tree/main/full-border.yazi +- piper ya pkg add yazi-rs/plugins:piper https://github.com/yazi-rs/plugins/tree/main/piper.yazi + +- ouch ya pkg add ndtoan96/ouch git clone https://github.com/ndtoan96/ouch.yazi.git ${YAZI_PLUGINS}/ouch.yazi +- glow ya pack -a Reledia/glow git clone https://github.com/Reledia/glow.yazi ${YAZI_PLUGINS}/glow.yazi +- office ya pkg add macydnah/office git clone https://github.com/macydnah/office.yazi ${YAZI_PLUGINS}/office.yazi +- lazygit ya pkg add Lil-Dank/lazygit git clone https://github.com/Lil-Dank/lazygit.yazi ${YAZI_PLUGINS}/lazygit.yazi + +Preview and CLI tools: + +- glow Render md apt-get install glow +- piper https://github.com/yazi-rs/plugins/tree/main/piper.yazi +- imagemagick (magick) apt-get install imagemagick +- mediainfo apt-get install mediainfo +- ouch compression cargo install ouch +- fzf apt-get install fzf +- ripgrep apt-get install ripgrep + +Optional desktop integration: + +- Typora - Paid Markdown reader/writer with preview +- VLC - video player +- Xreader +- Xviewer +- ripdrag + +EOF +} +conf_print_readme | tee "${YAZI_HOME}"/README.md + +# Install the plugins - avoiding ya so that base plugins can be installed to +# /etc/skel as well. +git clone --depth 1 https://github.com/yazi-rs/plugins.git "${TMP_DIR}"/yazi-rs/ + +for plugin_dir in "$TMP_DIR/yazi-rs"/*.yazi; do + if [ -d "$plugin_dir" ]; then + plugin_name=$(basename "$plugin_dir") + cp -r "$plugin_dir" "$YAZI_PLUGINS/$plugin_name" + fi +done + +rm -rf "$TMP_DIR/yazi-rs" + +git clone https://github.com/lpnh/fr.yazi "${YAZI_PLUGINS}"/fr.yazi +git clone https://github.com/ndtoan96/ouch.yazi.git "${YAZI_PLUGINS}"/ouch.yazi +git clone https://github.com/Reledia/glow.yazi "${YAZI_PLUGINS}"/glow.yazi +git clone https://github.com/macydnah/office.yazi "${YAZI_PLUGINS}"/office.yazi + +# https://github.com/sxyazi/yazi/tree/shipped/yazi-config/preset +conf_print_yazi_init() { + cat <<'EOF' +-- Official Git Symbol Overrides +th.git = th.git or {} +th.git.modified_sign = "M" +th.git.untracked_sign = "U" +th.git.added_sign = "A" + +-- 1. Official Git Plugin Setup +require("git"):setup() + +-- 2. FZF Plugin Setup (Default to jump/reveal) +require("fg"):setup({ + default_action = "jump", +}) + +-- 3. Zoxide Setup (Update database on navigation) +require("zoxide"):setup({ + update_db = true, +}) + +require("full-border"):setup { + type = ui.Border.ROUNDED, +} + +-- Helper to get the current Git branch +local function get_branch() + local output = io.popen("git branch --show-current 2>/dev/null"):read("*l") + return (output and output ~= "") and (" (" .. output .. ")") or "" +end + +local branch_name = get_branch() + +-- 1. Disable the Header (to hide the top-left date) +function Header:render() return ui.Line {} end + +-- 2. Official-style Custom Linemode (Permissions, Size, Date, Branch) +function Linemode:size_and_mtime() + local year = os.date("%Y") + local time = math.floor(self._file.cha.mtime or 0) + local time_str = os.date(os.date("%Y", time) == year and "%b %d %H:%M" or "%b %d %Y", time) + local size_str = self._file:size() and ya.readable_size(self._file:size()) or "-" + + -- Convert mode to permissions string (rwxr-xr-x format) + local function mode_to_perm(mode) + if not mode then return "" end + local perm = "" + local bits = {"r", "w", "x"} + for i = 8, 0, -1 do + local bit = math.floor(mode / (2 ^ i)) % 2 + perm = perm .. (bit == 1 and bits[(8 - i) % 3 + 1] or "-") + end + return perm + end + + local perm_str = "" + if ya.target_family() == "unix" and self._file.cha.mode then + local perms = mode_to_perm(self._file.cha.mode) + local user = ya.user_name(self._file.cha.uid) or tostring(self._file.cha.uid) + local group = ya.group_name(self._file.cha.gid) or tostring(self._file.cha.gid) + perm_str = perms .. " " .. user .. ":" .. group .. " " + end + + return ui.Line { + ui.Span(perm_str):fg("magenta"), -- Permissions (rwxr-xr-x user:group) + ui.Span(size_str .. " "), -- Size + ui.Span(time_str):fg("gray"), -- Date + ui.Span(branch_name or ""):fg("blue"), -- Git Branch + } +end +EOF +} +conf_print_yazi_init | tee "${YAZI_HOME}"/yazi.toml + +conf_print_yazi_toml() { + cat <<'EOF' +[manager] +linemode = "size_and_mtime" + +[mgr] +linemode = "size_and_mtime" +show_header = true +sort_dir_first = true +sort_by = "alphabetical" +show_symlink = true +show_hidden = true + +[plugin] +prepend_fetchers = [ + { id = "git", url = "*", run = "git" }, + { id = "git", url = "*/", run = "git" }, +] + +[[plugin.prepend_fetchers]] +id = "git" +url = "*" +run = "git" + +[[plugin.prepend_fetchers]] +id = "git" +url = "*/" +run = "git" + +# --- Official Piper Previewers --- + +[[plugin.prepend_previewers]] +url = "*.md" +run = 'piper -- CLICOLOR_FORCE=1 /usr/bin/glow -w=$w -s=dark "$1"' + +# KRA (Krita) preview - extracts mergedimage.png from the archive +[[plugin.prepend_previewers]] +url = "*.{kra,KRA}" +run = "kra" + +# TIFF preview using built-in magick (requires ImageMagick) +[[plugin.prepend_previewers]] +mime = "image/tiff" +run = "magick" + +[[plugin.prepend_previewers]] +url = "*.{tif,tiff,TIF,TIFF}" +run = "magick" + +[[plugin.prepend_previewers]] +url = "*.{docx,xlsx,pptx,odt,ods,odp}" +run = "office" + +[[plugin.prepend_previewers]] +mime = "{image,audio,video}/*" +run = "mediainfo" + +[[plugin.prepend_previewers]] +mime = "application/x-subrip" +run = "mediainfo" + +[[plugin.prepend_previewers]] +mime = "application/{*zip,tar,bzip2,7z*,rar,xz,zstd,java-archive}" +run = "ouch" + +# -------------------------------- + +[preview] +max_width = 10000 +max_height = 10000 + +[tasks] +image_bound = [65535, 65535] + + +[opener] +pdf = [{ run = 'xreader "$@"', desc = "Open PDF with Xreader", detach = true }] +img = [ + { run = 'xviewer "$@"', desc = "Open Image with Xviewer", detach = true }, +] +extract = [ + { run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" }, +] +view-viu = [{ run = 'viu "$@"', desc = "View with viu", block = true }] +vlc = [ + { run = 'flatpak run org.videolan.VLC "$@"', desc = "Open with VLC", detach = true }, +] +typora = [ + { run = 'flatpak run io.typora.Typora "$@"', desc = "Open with Typora", detach = true }, +] +# Define your editor here +edit = [{ run = '${EDITOR:-vim} "$@"', desc = "Edit", block = true }] + +[open] +prepend_rules = [ + # Markdown files with Typora (prepended to ensure it matches first) + { url = "*.{md,MD,markdown}", use = "typora" }, +] + +rules = [ + # 0. PDF opening + { mime = "application/pdf", use = "pdf" }, + { name = "*.{pdf,PDF}", use = "pdf" }, + + # 1. Image opening + { mime = "image/*", use = "img" }, + { name = "*.{jpg,jpeg,png,webp,gif,tif,tiff,TIF,TIFF,JPG,JPEG,PNG,WEBP,GIF}", use = "img" }, + + # 2. Video opening + { mime = "video/*", use = "vlc" }, + { name = "*.{mp4,mkv,avi,mov,wmv,flv,webm}", use = "vlc" }, + + # 3. Archive extraction + { mime = "application/{*zip,tar,bzip2,7z*,rar,xz,zstd,java-archive}", use = "extract" }, + + # 4. Other text files with editor + { mime = "text/*", use = "edit" }, + { name = "*.{yml,yaml,toml,lua}", use = "edit" }, +] +EOF +} +conf_print_yazi_toml | tee "${YAZI_HOME}"/yazi.toml + +conf_print_yazi_keymap_toml() { + cat <<'EOF' +[[mgr.prepend_keymap]] +on = "l" +run = "plugin smart-enter" +desc = "Enter child directory or open file" + +[[mgr.prepend_keymap]] +on = "" +run = "plugin smart-enter" +desc = "Enter child directory or open file" + +[[mgr.prepend_keymap]] +on = "f" +run = "plugin fg -- fzf" +desc = "find file by fzf" + +[[mgr.prepend_keymap]] +on = "F" +run = "plugin fg -- rg" +desc = "find file by fzf content" + +[[mgr.prepend_keymap]] +on = "z" +run = "plugin zoxide" +desc = "Jump to a directory using zoxide" + +[[mgr.prepend_keymap]] +on = "e" +run = "open" +desc = "Extract archive" + +[[mgr.prepend_keymap]] +on = "C" +run = "plugin ouch" +desc = "Compress with ouch" + +[[mgr.prepend_keymap]] +on = "" +run = 'shell "ripdrag \"$@\"" --confirm' +desc = "Drag and Drop" + +[[mgr.prepend_keymap]] +on = "M" +run = "plugin chmod" +desc = "Chmod" + +[[mgr.prepend_keymap]] +on = [ "g", "i" ] +run = "plugin lazygit" +desc = "run lazygit" + +# Create new directory with Shift+A +[[mgr.prepend_keymap]] +on = "A" +run = "create --dir" +desc = "Create a new directory" + +# NOTE: Yazi doesn't have "undo" for file operations (copy/move/rename) +# These are real filesystem changes. To cancel ongoing operations: +# 1. Press 'w' to open task manager +# 2. Navigate to the task +# 3. Press 'x' to cancel it (only works if task hasn't completed yet) + +# Task management - cancel ongoing operations +[[tasks.prepend_keymap]] +on = "x" +run = "cancel" +desc = "Cancel selected tasks" + +[[tasks.prepend_keymap]] +on = "" +run = "cancel" +desc = "Cancel selected tasks" +EOF +} +conf_print_yazi_keymap_toml | tee "${YAZI_HOME}/keymap.toml" + +# Install themes +# https://yazi-rs.github.io/schemas/theme.json +if [[ -f ${YAZI_HOME}/theme.toml ]]; then + cp "${YAZI_HOME}"/theme.toml "${YAZI_HOME}/theme-backup.toml" +fi + +# using ya pkg add will install into the user .local not $DEST +# The manual approach usong git, use ya pkg and then find the .git/config + +if [[ ! -d "${YAZI_THEMES}"/vscode-dark-modern.yazi ]]; then + git clone \ + --recurse-submodules \ + "https://github.com/956MB/vscode-dark-modern.yazi.git" \ + "${YAZI_THEMES}"/vscode-dark-modern.yazi +fi + +set -x +git clone \ + --depth 1 \ + --recurse-submodules \ + "https://github.com/yazi-rs/flavors.git" \ + "$TMP_DIR/yazi-rs_flavors" + +for theme_dir in "$TMP_DIR/yazi-rs_flavors"/*.yazi; do + if [ -d "$theme_dir" ]; then + theme_name=$(basename "$theme_dir") + cp -r "$theme_dir" "$YAZI_THEMES/$theme_name" + fi +done +rm -rf "${TMP_DIR}/yasi-rs_flavors" +set +x + +# ${DEST}/.local/state/yazi/packages +# ya pkg add 956MB/vscode-dark-modern +# ya pkg add yazi-rs/flavors:catppuccin-mocha + +conf_print_yazi_theme_toml() { + cat <<'EOF' +[flavor] +# dark = "vscode-dark-modern" +dark = "catppuccin-mocha" + +[icon] +prepend_rules = [{ name = "*.md", text = "", fg = "#61afef" }] +EOF +} +conf_print_yazi_theme_toml | tee "${YAZI_HOME}"/theme.toml + +conf_print_permissions-cheat-sheet() { + cat <<'EOF' +| Octal | Special Bit | Owner | Group | Others | Symbolic | Meaning / Typical Use | +| -----: | ----------- | ----- | ----- | ------ | ------------ | --------------------- | +| `0000` | – | --- | --- | --- | `----------` | no access | +| `0644` | – | rw- | r-- | r-- | `rw-r--r--` | normal file | +| `0664` | – | rw- | rw- | r-- | `rw-rw-r--` | shared group file | +| `0600` | – | rw- | --- | --- | `rw-------` | private file | +| `0700` | – | rwx | --- | --- | `rwx------` | private executable | +| `0755` | – | rwx | r-x | r-x | `rwxr-xr-x` | programs / dirs | +| `0775` | – | rwx | rwx | r-x | `rwxrwxr-x` | shared directory | +| `0777` | – | rwx | rwx | rwx | `rwxrwxrwx` | ⚠️ world-writable | + + +| Special | Octal | Effect | Symbol | +| ---------- | ------ | ---------------------------- | ----------------- | +| **setuid** | `4xxx` | run as file owner | `s` in owner `x` | +| **setgid** | `2xxx` | run as group / inherit group | `s` in group `x` | +| **sticky** | `1xxx` | only owner can delete | `t` in others `x` | + + +| Octal | Symbolic | Applies To | What It Does | +| -----: | ----------- | ---------- | ------------------------------- | +| `4755` | `rwsr-xr-x` | binary | run as **root** (e.g. `passwd`) | +| `2755` | `rwxr-sr-x` | directory | files inherit **group** | +| `1777` | `rwxrwxrwt` | directory | shared, but safe (e.g. `/tmp`) | +| `2775` | `rwxrwsr-x` | directory | group-shared project dir | +| `4711` | `rws--x--x` | binary | restricted privileged exec | + +EOF +} +conf_print_permissions-cheat-sheet | tee "${YAZI_HOME}"/permissions-cheat-sheet.md + +# https://yazi-rs.github.io/docs/quick-start/#shell-wrapper +# shell wrapper that provides the ability to change the current working directory when exiting Yazi. +conf_print_zsh_shell_wrapper() { + cat <<'EOF' +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + command yazi "$@" --cwd-file="$tmp" + IFS= read -r -d '' cwd < "$tmp" + [ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" + rm -f -- "$tmp" +} +EOF +} +conf_print_zsh_shell_wrapper | tee "${DEST}"/.zshrc.d/005_yazi_shell.zsh diff --git a/020_zsh_aliases.d.sh b/020_zsh_aliases.d.sh index a53a0e6..47c2a6e 100755 --- a/020_zsh_aliases.d.sh +++ b/020_zsh_aliases.d.sh @@ -127,31 +127,31 @@ EOF ALIAS_FILE="${DEST}/${ALIAS_DIR}/003_local.sh" cat >"${ALIAS_FILE}" <<-'EOF' -`` alias grep='GREP_COLOR="mt=1;37;41" LANG=C grep --color=auto'/ - alias plocate='plocate --existing --basename --ignore-case' - alias wget="wget --content-disposition -c -U 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0'" - alias tswget='torsocks wget' - alias leech="wget -e robots=off -c -r --level=0 -nc -np --random-wait" + alias baobab='dbus-run-session baobab' alias bc='bc -lq' - alias shred='ionice -c3 /usr/bin/shred -fuzv' - alias wipe='ionice -c3 /usr/bin/wipe -l1 -v -r' + alias leech="wget -e robots=off -c -r --level=0 -nc -np --random-wait" alias less="less -R" - alias youtube-dl='yt-dlp --downloader=aria2c' #alias mpv='mpv --ao=alsa --force-window -af "crossfeed=strength=0.2:range=0.5:slope=0.5:level_in=0.9:level_out=1:block_size=1024"' alias mpv='mpv --ao=pipewire --pipewire-buffer=47 --force-window' + alias odc='~/bin/odysee-dl_low.sh hls-215' + alias pastebinit='pastebinit -b paste.debian.net' + alias plocate='plocate --existing --basename --ignore-case' + alias shred='ionice -c3 /usr/bin/shred -fuzv' + alias tree='tree -CAFa -I "CVS|*.package|.svn|.git" --dirsfirst' + alias tsleech='torsocks leech' alias tsmpv='torsocks mpv' - alias ytmpv='torsocks mpv --ytdl-format=18' - alias wtmpv='webtorrent --mpv --blocklist https://dbl.oisd.nl/ --upload-limit 20' - alias yt-dlp='yt-dlp --downloader=aria2c' - alias ytfzf='ytfzf --ytdl-pref=18' - alias tsy-dlp='torsocks yt-dlp' + alias tspastebinit='torsocks pastebinit -b paste.debian.net' + alias tswget='torsocks wget' alias tsyoutube-dl='torsocks yt-dlp' alias tsy='tsy-dlp' - alias odc='~/bin/odysee-dl_low.sh hls-215' - alias tsleech='torsocks leech' - alias pastebinit='pastebinit -b paste.debian.net' - alias tspastebinit='torsocks pastebinit -b paste.debian.net' - alias baobab='dbus-run-session baobab' + alias tsy-dlp='torsocks yt-dlp' + alias wget="wget --content-disposition -c -U 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0'" + alias wipe='ionice -c3 /usr/bin/wipe -l1 -v -r' + alias wtmpv='webtorrent --mpv --blocklist https://dbl.oisd.nl/ --upload-limit 20' + alias youtube-dl='yt-dlp --downloader=aria2c' + alias ytmpv='torsocks mpv --ytdl-format=18' + alias yt-dlp='yt-dlp --downloader=aria2c' + alias ytfzf='ytfzf --ytdl-pref=18' EOF ALIAS_FILE="${DEST}/${ALIAS_DIR}/004_iotop.sh" diff --git a/020_zsh_quickstart.sh b/020_zsh_quickstart.sh index a00c866..106f7a7 100755 --- a/020_zsh_quickstart.sh +++ b/020_zsh_quickstart.sh @@ -78,7 +78,7 @@ sed -i -e "s|zgenom load srijanshetty/docker-zsh|# zgenom load srijanshetty/dock # zsh quickstart created this file if missing expecting fzf to be installed in ${HOME} # we have it installed via apt so the executables are in the path and the key-bindings # and completitions are in examples fom the package. -cat <<-EOF | sudo tee "${DEST}/.fzf.zsh" +cat <<-EOF | tee "${DEST}/.fzf.zsh" # Setup fzf # --------- #if [[ ! "\$PATH" == *\${HOME}/.vim/bundle/fzf/bin/* ]]; then @@ -337,29 +337,29 @@ EOF #git clone http://github.com/bhilburn/powerlevel9k.git "${DEST}"/.zgen/robbyrussell/ohmyzsh-master/themes/powerlevel9k ## add a separate zsh aliases directory -ALIAS_DIR=.zsh_aliases.d -mkdir -p "${DEST}"/"${ALIAS_DIR}" -cat <<-EOF | sudo tee -a "${DEST}"/.zshrc >/dev/null - # Make it easy to append your own aliases - # loading all files from "${ALIAS_DIR}" directory - ALIAS_DIR=${ALIAS_DIR} +cat <<'EOF' | tee "${DEST}"/"${ALIAS_DIR}"/000_enable-aliases-directory.zsh +# Enable ${ALIAS_DIR} to keep aliases separate from env variables +if [ -d ~/.zsh_aliases.d ]; then + for f in ~/.zsh_aliases.d/**/*.zsh(N); do + source "$f" + done +fi +EOF - if [ -n "\${HOME}/\${ALIAS_DIR}" ]; then - for dotfile in \${HOME}/"${ALIAS_DIR}"/* - do - if [ -r "\${dotfile}" ]; then - source "\${dotfile}" - fi - done - fi +ALIASES_HOME=".zsh_aliases.d" +mkdir -p "${DEST}"/"${ALIASES_HOME}" + +# Set the path to the pipx bin directory +cat <<'EOF' | tee "${DEST}"/"${ALIAS_DIR}"/001_pipx-path.zsh +export PATH="$PATH:$HOME/.local/bin" EOF # tell bash to check the next word after the alias (i.e sudo) by adding a space to the end of the alias value. echo "# tell bash to check the next word after the alias (i.e sudo) by adding a space to the end of the alias value." >"${DEST}"/"${ALIAS_DIR}"/002_sudo.zsh echo 'alias sudo="sudo "' >>"${DEST}"/"${ALIAS_DIR}"/002_sudo.zsh -cat <<-EOF | sudo tee "\${DEST}"/"\${ALIAS_DIR}"/003_py_aliases.zsh +cat <<-EOF | tee "${DEST}"/"${ALIAS_DIR}"/003_py_aliases.zsh _py_version() { PY_VERSIONS=(2 3) @@ -397,7 +397,7 @@ cat <<-EOF | sudo tee "\${DEST}"/"\${ALIAS_DIR}"/003_py_aliases.zsh EOF mkdir -p "${DEST}"/"${ALIAS_DIR}"/ -cat <<-EOF | sudo tee "${DEST}"/"${ALIAS_DIR}"/003_transfer.zsh +cat <<-EOF | tee "${DEST}"/"${ALIAS_DIR}"/003_transfer.zsh # # Defines transfer alias and provides easy command line file and folder sharing. # @@ -466,5 +466,10 @@ cat <<-EOF | sudo tee "${DEST}"/"${ALIAS_DIR}"/003_transfer.zsh } EOF +cat <