Updaes and a couple of new installers.

This commit is contained in:
cyteen 2026-02-12 12:47:27 +00:00
parent 539f36efe0
commit 63ecba605f
9 changed files with 991 additions and 68 deletions

274
020_batcat.sh Normal file
View File

@ -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
# <https://github.com/catppuccin/bat?
mkdir -p "${BAT_THEMES}"
mkdir -p "${BAT_SYNTAX}"
wget -P "${BAT_THEMES}" "https://github.com/catppuccin/bat/raw/main/themes/Catppuccin%20Mocha.tmTheme"
for theme in Latte Frappe Macchiato Mocha; do
wget \
-P "${BAT_THEMES}" \
"https://github.com/catppuccin/bat/raw/main/themes/Catppuccin%20${theme}.tmTheme"
done
# <https://github.com/Sublime-Instincts/BetterJinja/blob/master/Syntaxes/YAML/YAML%20(Jinja).sublime-syntax>
# 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 <<EOF
if command -v bat >/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

View File

@ -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 <<EOF
return {
---@type LazySpec
{
"mikavilpas/yazi.nvim",
version = "*", -- use the latest stable version
event = "VeryLazy",
dependencies = {
{ "nvim-lua/plenary.nvim", lazy = true },
},
keys = {
-- 👇 in this section, choose your own keymappings!
{
"<leader>-",
mode = { "n", "v" },
"<cmd>Yazi<cr>",
desc = "Open yazi at the current file",
},
{
-- Open in the current working directory
"<leader>cw",
"<cmd>Yazi cwd<cr>",
desc = "Open the file manager in nvim's working directory",
},
{
"<c-up>",
"<cmd>Yazi toggle<cr>",
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 = "<f1>",
},
},
-- 👇 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() {

69
020_rustup.sh Normal file
View File

@ -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 <<EOF
[env]
RUSTC_BOOTSTRAP = "0"
[registries.crates-io]
protocol = "sparse"
[net]
git-fetch-with-cli = true
EOF
}
conf_print_cargo_config | tee ${CARGO_HOME}/config.toml
## add this to ./cargo/config.toml
conf_print_use_debian_packages() {
cat <<EOF
# [source.debian-packages]
# directory = "/usr/share/cargo/registry"
# [source.crates-io]
# replace-with = "debian-packages"
EOF
}
conf_print_use_debian_packages | tee -a ${CARGO_HOME}/config.toml
conf_print_rustup_config() {
cat <<EOF
default_toolchain = "stable-x86_64-unknown-linux-gnu"
profile = "default"
version = "12"
[overrides]
EOF
}
conf_print_rustup_config | tee ${RUSTUP_HOME}/settings.toml
rustup default stable
rustup update
rustc --version
cargo --version
rustup show
# A TUI to assist in cleaning build artifacts.
cargo install cargo-cleaner

View File

@ -1,13 +1,19 @@
#!/usr/bin/env bash
echo "Rustup is available in debian and will install the latest rustc and cargo for a user account."
exit 0
cd /var/tmp
USER=rust-lang
PROJECT=rustup
PRERELEASE=false
RELEASE=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name')
# RELEASE=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name')
RELEASE=$(lastversion --format version ${USER}/${PROJECT})
# VERSION=$(echo "${RELEASE}" | cut -c 2- | cut -f1 -d"-")
VERSION=$(date +%Y-%m-%d_)git
# VERSION=$(date +%Y-%m-%d_)git
VERSION=${RELEASE}
DOWNLOAD_DIR=/tmp
RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom"
@ -42,9 +48,8 @@ echo "LATEST_URL: " "${LATEST_URL}"
# LICENSE_URL=$(curl "${LICENSE_PAGE_URL}" | jq --raw-output '.download_url')
# wget -c ${LICENSE_URL}
VERSION=$( date +%Y-%m-%d_ )git
#VERSION="1.0"
RELEASE="git"
VERSION=$(lastversion --format version ${BASE_USER}/${BASE_REPO})
RELEASE="1"
REQUIRES=""
# make a new temporary directory for this use
@ -75,31 +80,31 @@ export RUSTUP_HOME=${HOME}/.rustup
# RUSTUP_HOME (default: ~/.rustup or %USERPROFILE%/.rustup) Sets the root rustup folder, used for storing installed toolchains and configuration options.
RUSTUP_HOME
# RUSTUP_HOME
# RUSTUP_TOOLCHAIN (default: none) If set, will override the toolchain used for all rust tool invocations. A toolchain with this name should be installed, or invocations will fail.
RUSTUP_TOOLCHAIN
# RUSTUP_TOOLCHAIN
# RUSTUP_DIST_SERVER (default: https://static.rust-lang.org) Sets the root URL for downloading static resources related to Rust. You can change this to instead use a local mirror, or to test the binaries from the staging directory.
RUSTUP_DIST_SERVER
# RUSTUP_DIST_SERVER
# RUSTUP_DIST_ROOT (default: https://static.rust-lang.org/dist) Deprecated. Use RUSTUP_DIST_SERVER instead.
RUSTUP_DIST_ROOT
# RUSTUP_DIST_ROOT
# RUSTUP_UPDATE_ROOT (default https://static.rust-lang.org/rustup) Sets the root URL for downloading self-updates.
RUSTUP_UPDATE_ROOT
# RUSTUP_UPDATE_ROOT
# RUSTUP_IO_THREADS unstable (defaults to reported cpu count). Sets the number of threads to perform close IO in. Set to disabled to force single-threaded IO for troubleshooting, or an arbitrary number to override automatic detection.
RUSTUP_IO_THREADS
# RUSTUP_IO_THREADS
# RUSTUP_TRACE_DIR unstable (default: no tracing) Enables tracing and determines the directory that traces will be written too. Traces are of the form PID.trace. Traces can be read by the Catapult project tracing viewer.
RUSTUP_TRACE_DIR
# RUSTUP_TRACE_DIR
# RUSTUP_UNPACK_RAM unstable (default 400M, min 100M) Caps the amount of RAM rustup will use for IO tasks while unpacking.
RUSTUP_UNPACK_RAM
# RUSTUP_UNPACK_RAM
# RUSTUP_NO_BACKTRACE Disables backtraces on non-panic errors even when RUST_BACKTRACE is set.
RUSTUP_NO_BACKTRACE
# RUSTUP_NO_BACKTRACE
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

View File

@ -49,7 +49,7 @@ cat <<-EOF | sudo tee -a "${DEST}"/.profile
EOF
conf_print_tmux_default() {
cat <<-'EOF' | tee "${TMUX_CONF_DIR}"/default.sh
cat <<-'EOF' | tee "${TMUX_CONF_DIR}"/default.sh
# Default Theme
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD=""
TMUX_POWERLINE_SEPARATOR_LEFT_THIN=""
@ -122,7 +122,7 @@ conf_print_tmux_default() {
# wget -c --directory-prefix "${DEST}"/.config/tmux/ https://raw.githubusercontent.com/Netherdrake/Dotfiles/master/config/tmux/tmux.conf
conf_print_tmux_conf-1() {
cat <<-EOF
cat <<-EOF
# set-environment -g TMUX_PLUGIN_MANAGER_PATH '${TMUX_CONF_DIR}/plugins/tpm'
# from apt-get install powerline
@ -231,7 +231,7 @@ conf_print_tmux_conf-1 | tee "${TMUX_CONF_DIR}"/tmux.conf
# Overwrites the heredoc above.
conf_print_tmux_conf-2() {
cat <<-EOF
cat <<-EOF
# Start windows and panes at 1, not 0
set -g base-index 1
@ -310,15 +310,26 @@ conf_print_tmux_conf-2() {
}
conf_print_tmux_conf-2 | tee -a "${TMUX_CONF_DIR}"/tmux.conf
# Last entry to the tmux.conf
# Allows yazi image preview to work correctly in tmux
conf_print_tmux_conf-3() {
cat <<-EOF
cat <<-EOF
# Allows yazi image preview to work correctly in tmux
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
EOF
}
# Last entry to the tmux.conf
conf_print_tmux_conf-last() {
cat <<-EOF
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '/usr/share/tmux-plugin-manager/tpm'
EOF
}
conf_print_tmux_conf-3 | tee -a "${TMUX_CONF_DIR}"/tmux.conf
conf_print_tmux_conf-last | tee -a "${TMUX_CONF_DIR}"/tmux.conf
# Prefetch the plugins.
#/usr/share/tmux-plugin-manager/bin/install_plugins
@ -329,12 +340,12 @@ sudo apt-get install -y python3-shtab
# ZSH_COMPLETION_DIR="${DEST}"/.zshrc.d
ZSH_COMPLETION_DIR="/usr/share/zsh/vendor-completions/"
shtab --shell=zsh -u tmuxp.cli.create_parser |
sudo tee "${ZSH_COMPLETION_DIR}"/_tmuxp
sudo tee "${ZSH_COMPLETION_DIR}"/_tmuxp
# BASH_COMPLETION_DIR="${DEST}"/.bashrc.d
BASH_COMPLETION_DIR="/usr/share/bash-completions"
shtab --shell=bash -u tmuxp.cli.create_parser |
sudo tee "${BASH_COMPLETION_DIR}"/tmuxp
sudo tee "${BASH_COMPLETION_DIR}"/tmuxp
# HOME="${DEST}" TMUX_PLUGIN_MANAGER_PATH=""${DEST}"/.tmux/plugins" bash /usr/share/tmux-plugin-manager/bin/install_plugins
@ -343,7 +354,7 @@ shtab --shell=bash -u tmuxp.cli.create_parser |
# and load with 'tmuxp load .' or 'tmuxp.load {name}'
# see http://github.com/tony/tmuxp-config
conf_print_tmuxp_docker() {
cat <<-EOF
cat <<-EOF
session_name: docker
start_directory: ./
windows:
@ -394,7 +405,7 @@ conf_print_tmuxp_docker() {
conf_print_tmuxp_docker | tee "${DEST}"/.config/tmuxp/docker.yaml
conf_print_tmuxp_top() {
cat <<-EOF
cat <<-EOF
session_name: top
windows:
- window_name: dev window
@ -414,7 +425,7 @@ conf_print_tmuxp_top() {
conf_print_tmuxp_top | tee "${DEST}"/.config/tmuxp/top.yaml
conf_print_tmuxp_tmuxp() {
cat <<-EOF
cat <<-EOF
session_name: tmuxp
start_directory: ./ # load session relative to config location (project root).
before_script: ./.tmuxp-before-script.sh
@ -445,7 +456,7 @@ conf_print_tmuxp_tmuxp() {
conf_print_tmuxp_tmuxp | tee "${DEST}"/.config/tmuxp/tmuxp.yaml
conf_print_tmuxp_tmuxp_testing() {
cat <<-EOF | tee "${DEST}"/.config/tmuxp/tmuxp_testing.yaml
cat <<-EOF | tee "${DEST}"/.config/tmuxp/tmuxp_testing.yaml
language: python
sudo: false
dist: bionic # 18.04

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
# A TUI filemanager written in rust.
sudo apt install ffmpeg 7zip jq poppler-utils fd-find ripgrep fzf zoxide imagemagick
cargo install --force --git https://github.com/sxyazi/yazi.git yazi-build

510
020_yazi-filemanager.sh Normal file
View File

@ -0,0 +1,510 @@
#!/usr/bin/env bash
DEST=${1:-/etc/skel}
TMP_DIR="${TMPDIR:-/tmp}"
YAZI_HOME=${DEST}/.config/yazi
YAZI_PLUGINS=${DEST}/.config/yazi/plugins
YAZI_THEMES=${YAZI_HOME}/flavors
# YAZI_DATA=${DEST}/.local/state/yazi
mkdir -p "${YAZI_PLUGINS}"
mkdir -p "${YAZI_THEMES}"
# A TUI filemanager written in rust.
# The yazi neovim plugin is installed with /var/tmp/automate/020_neovim-lazyvim_plugins.sh
# https://github.com/mikavilpas/yazi.nvim
# Yazi can be optionally extended with other command-line tools to enable additional features.
#
# nerd-fonts (recommended)
# ffmpeg (for video thumbnails)
# 7-Zip (for archive extraction and preview, requires non-standalone version)
# jq (for JSON preview) apt-get install jq
# poppler (for PDF preview) apt-get install poppler-utils
# fd (for file searching)
# rg (for file content searching) ripgrep
# fzf (for quick file subtree navigation, >= 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
# <https://github.com/nbaud/nico-yazi-config/blob/main/README.md>
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:
<https://github.com/yazi-rs/plugins/tree/main>
<https://github.com/AnirudhG07/awesome-yazi>
- 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 = "<Enter>"
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 = "<C-d>"
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 = "<C-c>"
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

View File

@ -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"

View File

@ -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 <<EOF | tee "${DEST}"/"${ALIAS_DIR}"/002_nvm.zsh
plugins+=(nvm)
zstyle ':omz:plugins:nvm' lazy yes
EOF
sudo chown -R root:root /usr/local/share/zsh/site-functions
sudo chmod -R 755 /usr/local/share/zsh/site-functions