Updates and formating from bashls suggestions.
This commit is contained in:
parent
6c49e78867
commit
6b0122913d
|
|
@ -251,23 +251,23 @@ conf_print_bat_config() {
|
|||
#--map-syntax ".ignore:Git Ignore"
|
||||
EOF
|
||||
}
|
||||
conf_print_bat_config | tee ${BAT_HOME}/config
|
||||
conf_print_bat_config | tee "${BAT_HOME}/config"
|
||||
|
||||
conf_print_bat_aliases() {
|
||||
cat <<EOF
|
||||
if command -v bat >/dev/null; then
|
||||
cat <<'EOF'
|
||||
if [ -x "$(command -v bat)" ]; then
|
||||
alias bat='bat'
|
||||
else
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
elif [ -x "$(command -v batcat)" ]; then
|
||||
alias bat='batcat'
|
||||
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
|
||||
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
|
||||
conf_print_bat_aliases | tee "${DEST}/.zsh_aliases.d/004_batcat.zsh"
|
||||
|
||||
source ${DEST}/.zsh_aliases.d/004_batcat.sh
|
||||
source "${DEST}/.zsh_aliases.d/004_batcat.sh"
|
||||
|
||||
batcat cache --build
|
||||
batcat --list-themes | grep "Catppuccin Mocha"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
set -euo pipefail
|
||||
|
||||
sudo apt-get update -qqq
|
||||
sudo apt install -y kitty kitty-terminfo kitty-shell-integration fonts-firacode -q
|
||||
|
||||
sudo apt install -y kitty kitty-terminfo kitty-shell-integration fonts-firacode fonts-noto-color-emoji -q
|
||||
fc-cache -fv
|
||||
# https://sw.kovidgoyal.net/kitty/overview/
|
||||
|
||||
# Paths
|
||||
|
|
@ -18,28 +18,39 @@ mkdir -p "${KITTY_HOME}" "${ALIASES_D}" "${ZSHRC_D}" "${SESSIONS_D}"
|
|||
|
||||
ALIAS_FILE="${ALIASES_D}/003_kitty.zsh"
|
||||
|
||||
# Helper function to run functions with sudo
|
||||
ssudo() {
|
||||
[[ "$(type -t "$1")" == "function" ]] || {
|
||||
echo "Not a function" >&2
|
||||
return 1
|
||||
}
|
||||
local func="$1"
|
||||
shift
|
||||
sudo bash -c "$(declare -f "$func"); $func $(printf '%q ' "$@")"
|
||||
}
|
||||
#
|
||||
# OpenGL detection → decide if we force software rendering
|
||||
# Necessary is opengl is <=3.2
|
||||
should_use_software() {
|
||||
local gl_version=""
|
||||
local es_version=""
|
||||
|
||||
# local gl_version=""
|
||||
# if command -v glxinfo >/dev/null 2>&1; then
|
||||
# gl_version=$(glxinfo | grep -i "OpenGL version string" | head -n 1 | awk -F: '{print $2}')
|
||||
# if [[ "$gl_version" =~ ^([4-9]\.|3\.[3-9]) ]]; then
|
||||
# return 1 # hardware ok
|
||||
# fi
|
||||
# fi
|
||||
|
||||
local max_core=$(glxinfo -B 2>/dev/null | grep "Max core profile" | awk '{print $5}')
|
||||
printf "max_core: $max_core\n"
|
||||
local max_core
|
||||
max_core=$(glxinfo -B 2>/dev/null | grep "Max core profile" | awk '{print $5}')
|
||||
printf "max_core: %s\n" "${max_core}"
|
||||
if [[ "$max_core" =~ ^([4-9]\.|3\.[3-9]) ]]; then
|
||||
return 1 # Hardware supports OpenGL 3.2+
|
||||
fi
|
||||
|
||||
if command -v eglinfo >/dev/null 2>&1; then
|
||||
es_version=$(eglinfo -B 2>/dev/null | grep -i "OpenGL ES profile version" | head -n 1 | grep -oE '[0-9]+\.[0-9]+' || true)
|
||||
printf "es_version $es_version\n"
|
||||
printf "es_version %s\n" "${es_version}"
|
||||
if [[ "$es_version" =~ ^[3-9]\. ]]; then
|
||||
return 1 # GLES 3+ usually good enough
|
||||
fi
|
||||
|
|
@ -63,8 +74,8 @@ EOF
|
|||
}
|
||||
|
||||
conf_print_kitty_wrapper() {
|
||||
mkdir -p ~/.local/bin
|
||||
cat >~/.local/bin/kitty <<'EOF'
|
||||
mkdir -p /usr/local/bin/
|
||||
cat >/usr/local/bin/kitty-wrapper <<'EOF'
|
||||
#!/bin/sh
|
||||
export LIBGL_ALWAYS_SOFTWARE=1
|
||||
exec /usr/bin/kitty "$@"
|
||||
|
|
@ -76,12 +87,19 @@ if should_use_software; then
|
|||
echo "# Forced software rendering due to insufficient OpenGL support" | tee -a "${ALIAS_FILE}" >/dev/null
|
||||
|
||||
# For xfce4 that ignores user aliases
|
||||
conf_print_kitty_wrapper
|
||||
chmod +x ~/.local/bin/kitty
|
||||
ssudo conf_print_kitty_wrapper
|
||||
sudo chmod +x "/usr/local/bin/kitty-wrapper"
|
||||
|
||||
# Add to alternatives and select default
|
||||
# sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/kitty 100
|
||||
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/kitty-wrapper 60
|
||||
sudo update-alternatives --config x-terminal-emulator
|
||||
|
||||
else
|
||||
conf_print_kitty_alias_hw
|
||||
|
||||
echo "# Using hardware rendering" | tee -a "${ALIAS_FILE}" >/dev/null
|
||||
sudo update-alternatives --config x-terminal-emulator
|
||||
fi
|
||||
|
||||
# the terminfo used by kitty is not generally available on
|
||||
|
|
@ -123,8 +141,8 @@ EOF
|
|||
# for kitty terminal sessions
|
||||
# Environment variables to set and files to copy on connection.
|
||||
# https://sw.kovidgoyal.net/kitty/kittens/ssh/
|
||||
mkdir -p ${KITTY_HOME}
|
||||
cat <<-EOF | tee -a ${KITTY_HOME}/ssh.conf >/dev/null
|
||||
mkdir -p "${KITTY_HOME}"
|
||||
cat <<-EOF | tee -a "${KITTY_HOME}/ssh.conf" >/dev/null
|
||||
# Copy the files and directories needed to setup some common tools
|
||||
# copy .zshrc .vimrc .vim
|
||||
|
||||
|
|
@ -145,8 +163,8 @@ cat <<-EOF | tee -a ${KITTY_HOME}/ssh.conf >/dev/null
|
|||
EOF
|
||||
|
||||
# set up tmuxp like sessions
|
||||
mkdir -p ${KITTY_HOME}/sessions
|
||||
cat <<-EOF | tee ${DEST}/.config/kitty/sessions/startup.conf >/dev/null
|
||||
mkdir -p "${KITTY_HOME}/sessions"
|
||||
cat <<-EOF | tee "${DEST}/.config/kitty/sessions/startup.conf" >/dev/null
|
||||
# startup.conf
|
||||
new_tab devuan-sdk
|
||||
cd /space/code_repositories/decode-os/os-build-system
|
||||
|
|
@ -180,7 +198,7 @@ conf_print_kitty_shell() {
|
|||
fi
|
||||
EOF
|
||||
}
|
||||
conf_print_kitty_shell | tee ${DEST}/.zshrc.d/002_kitty-shell.zsh >/dev/null
|
||||
conf_print_kitty_shell | tee "${DEST}/.zshrc.d/002_kitty-shell.zsh" >/dev/null
|
||||
|
||||
# kitty specific zsh function eq load a session file on startup.
|
||||
conf_print_kitty_functions() {
|
||||
|
|
@ -193,10 +211,10 @@ conf_print_kitty_functions() {
|
|||
# }
|
||||
EOF
|
||||
}
|
||||
conf_print_kitty_functions | tee ${DEST}/.zshrc.d/002_kitty-functions.zsh >/dev/null
|
||||
conf_print_kitty_functions | tee "${DEST}/.zshrc.d/002_kitty-functions.zsh" >/dev/null
|
||||
|
||||
## KITTYCONF START
|
||||
mkdir -p ${KITTY_HOME}
|
||||
mkdir -p "${KITTY_HOME}"
|
||||
conf_print_kitty_base() {
|
||||
cat <<-EOF
|
||||
# vim:ft=kitty
|
||||
|
|
@ -245,7 +263,7 @@ conf_print_kitty_base() {
|
|||
# Advanced
|
||||
EOF
|
||||
}
|
||||
conf_print_kitty_base | tee ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_kitty_base | tee "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# Choose this if not using zsh or you don't want manual shell integration
|
||||
# # For manual shell integration above comment out the following
|
||||
|
|
@ -262,7 +280,7 @@ conf_print_no-manual_shell_int() {
|
|||
shell_integration disabled
|
||||
EOF
|
||||
}
|
||||
conf_print_no-manual_shell_int | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_no-manual_shell_int | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# A bunch of people want auto-update in every 'app'
|
||||
# and the others are unix users. Disable the update check completely.
|
||||
|
|
@ -271,7 +289,7 @@ conf_print_update_interval() {
|
|||
update_check_interval 0
|
||||
EOF
|
||||
}
|
||||
conf_print_update_interval | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_update_interval | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# default browser and other settings
|
||||
conf_print_defaults() {
|
||||
|
|
@ -287,7 +305,7 @@ conf_print_defaults() {
|
|||
background_opacity 0.85
|
||||
EOF
|
||||
}
|
||||
conf_print_defaults | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_defaults | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
conf_print_shortcuts() {
|
||||
cat <<-EOF
|
||||
|
|
@ -298,7 +316,7 @@ conf_print_shortcuts() {
|
|||
map kitty_mod+t new_tab_with_cwd
|
||||
EOF
|
||||
}
|
||||
conf_print_shortcuts | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_shortcuts | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# https://lyz-code.github.io/blue-book/kitty/#Movement
|
||||
config_print_movement() {
|
||||
|
|
@ -311,7 +329,7 @@ config_print_movement() {
|
|||
map kitty_mod+d scroll_page_down
|
||||
EOF
|
||||
}
|
||||
config_print_movement | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
config_print_movement | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# scrollback buffer ctrl+shift+h
|
||||
# https://lyz-code.github.io/blue-book/kitty/#the-scrollback-buffer
|
||||
|
|
@ -347,7 +365,7 @@ listen_on unix:/tmp/kitty-remote
|
|||
|
||||
EOF
|
||||
}
|
||||
conf_print_scrollback | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_scrollback | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# Scrollback (2026 style with kitty-scrollback.nvim)
|
||||
conf_print_scrollback_lines() {
|
||||
|
|
@ -358,7 +376,7 @@ scrollback_pager_history_size 4
|
|||
|
||||
EOF
|
||||
}
|
||||
conf_print_scrollback_lines | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_scrollback_lines | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
conf_print_scrollback_maps() {
|
||||
cat <<'EOF'
|
||||
|
|
@ -381,7 +399,7 @@ map kitty_mod+question kitty_scrollback_nvim --config search
|
|||
mouse_map kitty_mod+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
|
||||
EOF
|
||||
}
|
||||
conf_print_scrollback_maps | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_scrollback_maps | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
|
||||
# Some other mapping examples
|
||||
# conf_print_examples() {
|
||||
|
|
@ -444,16 +462,18 @@ conf_print_theme() {
|
|||
# END_KITTY_THEME
|
||||
EOF
|
||||
}
|
||||
conf_print_theme | tee -a ${KITTY_HOME}/kitty.conf >/dev/null
|
||||
conf_print_theme | tee -a "${KITTY_HOME}/kitty.conf" >/dev/null
|
||||
## KITTYCONF END
|
||||
|
||||
## Themes
|
||||
# The theme template for submissions.
|
||||
# if the theme doesn't exist, it will be downloaded
|
||||
# and put in the kitty themes directory
|
||||
if [ ! -f ${KITTY_HOME}/theme-template.conf ]; then
|
||||
if [ ! -f "${KITTY_HOME}/theme-template.conf" ]; then
|
||||
echo "Downloading theme template"
|
||||
wget -c -O ${KITTY_HOME}/theme-template.conf https://raw.githubusercontent.com/kovidgoyal/kitty-themes/master/template.conf
|
||||
wget -c \
|
||||
-O "${KITTY_HOME}/theme-template.conf" \
|
||||
https://raw.githubusercontent.com/kovidgoyal/kitty-themes/master/template.conf
|
||||
fi
|
||||
|
||||
conf_print_nord_theme() {
|
||||
|
|
@ -534,7 +554,7 @@ conf_print_nord_theme() {
|
|||
color15 #eceff4
|
||||
EOF
|
||||
}
|
||||
conf_print_nord_theme | tee ${KITTY_HOME}/Nord.conf >/dev/null
|
||||
conf_print_nord_theme | tee "${KITTY_HOME}/Nord.conf" >/dev/null
|
||||
|
||||
conf_print_nord_theme_custom() {
|
||||
cat <<-EOF
|
||||
|
|
@ -643,7 +663,7 @@ conf_print_nord_theme_custom() {
|
|||
# map kitty_mod+f4 detach_window ask
|
||||
EOF
|
||||
}
|
||||
conf_print_nord_theme_custom | tee ${KITTY_HOME}/Nord-custom.conf >/dev/null
|
||||
conf_print_nord_theme_custom | tee "${KITTY_HOME}/Nord-custom.conf" >/dev/null
|
||||
|
||||
conf_print_monokai_theme() {
|
||||
cat <<-EOF
|
||||
|
|
@ -672,7 +692,7 @@ conf_print_monokai_theme() {
|
|||
selection_foreground #1e1e1e
|
||||
EOF
|
||||
}
|
||||
conf_print_monokai_theme | tee ${KITTY_HOME}/Dimmed\ Monokai.conf >/dev/null
|
||||
conf_print_monokai_theme | tee "${KITTY_HOME}/Dimmed Monokai.conf" >/dev/null
|
||||
|
||||
conf_print_adwaita_theme() {
|
||||
cat <<-EOF
|
||||
|
|
@ -729,7 +749,7 @@ conf_print_adwaita_theme() {
|
|||
color15 #f6f5f4
|
||||
EOF
|
||||
}
|
||||
conf_print_adwaita_theme | tee ${KITTY_HOME}/Adwaita\ dark.conf >/dev/null
|
||||
conf_print_adwaita_theme | tee "${KITTY_HOME}/Adwaita dark.conf" >/dev/null
|
||||
|
||||
conf_print_macchiato_theme() {
|
||||
cat <<-EOF
|
||||
|
|
@ -815,7 +835,7 @@ conf_print_macchiato_theme() {
|
|||
color15 #A5ADCB
|
||||
EOF
|
||||
}
|
||||
conf_print_macchiato_theme | tee ${KITTY_HOME}/Catppuccin-Macchiato.config >/dev/null
|
||||
conf_print_macchiato_theme | tee "${KITTY_HOME}/Catppuccin-Macchiato.config" >/dev/null
|
||||
|
||||
conf_print_tokyo_night_theme() {
|
||||
cat <<-EOF
|
||||
|
|
@ -871,7 +891,7 @@ conf_print_tokyo_night_theme() {
|
|||
color17 #c53b53
|
||||
EOF
|
||||
}
|
||||
conf_print_tokyo_night_theme | tee ${KITTY_HOME}/Tokyo\ Night\ Moon.conf >/dev/null
|
||||
conf_print_tokyo_night_theme | tee "${KITTY_HOME}/Tokyo Night Moon.conf" >/dev/null
|
||||
|
||||
cat <<-EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,26 @@ CARGO_HOME=${DEST}/.cargo
|
|||
sudo apt install rustup lldb # cargo-debstatus
|
||||
|
||||
if [[ -d ${RUSTUP_HOME} ]]; then
|
||||
mv ${RUSTUP_HOME} ${RUSTUP_HOME}-backup
|
||||
mv "${RUSTUP_HOME}" "${RUSTUP_HOME}-backup"
|
||||
fi
|
||||
|
||||
if [[ -d ${CARGO_HOME} ]]; then
|
||||
mv ${CARGO_HOME} ${CARGO_HOME}-backup
|
||||
mv "${CARGO_HOME}" "${CARGO_HOME}-backup"
|
||||
fi
|
||||
|
||||
mkdir -p ${DEST}/.cargo ${DEST}/.rustup
|
||||
mkdir -p "${DEST}/.cargo" "${DEST}/.rustup"
|
||||
# sudo chown -R $(whoami) ${DEST}/.cargo ${DEST}/.rustup
|
||||
|
||||
# Add env to zsh
|
||||
# https://doc.rust-lang.org/cargo/reference/environment-variables.html
|
||||
conf_print_cargo_env_zshrc() {
|
||||
cat <<EOF
|
||||
RUSTUP_HOME=${DEST}/.rustup
|
||||
CARGO_HOME=${DEST}/.cargo
|
||||
EOF
|
||||
}
|
||||
conf_print_cargo_env_zshrc | tee -a "${DEST}/.zshrc/004_cargo_env"
|
||||
|
||||
# RUSTC_BOOTSTRAP = "1" allows nightly features; use cautiously.
|
||||
conf_print_cargo_config() {
|
||||
cat <<EOF
|
||||
|
|
@ -32,7 +42,7 @@ protocol = "sparse"
|
|||
git-fetch-with-cli = true
|
||||
EOF
|
||||
}
|
||||
conf_print_cargo_config | tee ${CARGO_HOME}/config.toml
|
||||
conf_print_cargo_config | tee "${CARGO_HOME}/config.toml"
|
||||
|
||||
## add this to ./cargo/config.toml
|
||||
conf_print_use_debian_packages() {
|
||||
|
|
@ -44,7 +54,7 @@ conf_print_use_debian_packages() {
|
|||
# replace-with = "debian-packages"
|
||||
EOF
|
||||
}
|
||||
conf_print_use_debian_packages | tee -a ${CARGO_HOME}/config.toml
|
||||
conf_print_use_debian_packages | tee -a "${CARGO_HOME}/config.toml"
|
||||
|
||||
conf_print_rustup_config() {
|
||||
cat <<EOF
|
||||
|
|
@ -55,7 +65,7 @@ version = "12"
|
|||
[overrides]
|
||||
EOF
|
||||
}
|
||||
conf_print_rustup_config | tee ${RUSTUP_HOME}/settings.toml
|
||||
conf_print_rustup_config | tee "${RUSTUP_HOME}/settings.toml"
|
||||
|
||||
rustup default stable
|
||||
|
||||
|
|
|
|||
|
|
@ -315,11 +315,13 @@ conf_print_tmux_conf-3() {
|
|||
cat <<-EOF
|
||||
|
||||
# Allows yazi image preview to work correctly in tmux
|
||||
set -g allow-passthrough on
|
||||
# set -g allow-passthrough on
|
||||
set -g allow-passthrough all
|
||||
set -ga update-environment TERM
|
||||
set -ga update-environment TERM_PROGRAM
|
||||
EOF
|
||||
}
|
||||
conf_print_tmux_conf-3 | tee -a "${TMUX_CONF_DIR}"/tmux.conf
|
||||
|
||||
# Last entry to the tmux.conf
|
||||
conf_print_tmux_conf-last() {
|
||||
|
|
|
|||
|
|
@ -47,10 +47,12 @@ case "$INSTALL_TYPE" in
|
|||
|
||||
# These are a big one, the build in ${HOME}/.cargo grows to over 1GB
|
||||
"cargo")
|
||||
printf "Using cargo to fetch, build and install, it's a rust thing."
|
||||
cargo install --force yazi-build
|
||||
;;
|
||||
|
||||
"cargo-git")
|
||||
printf "Using cargo to fetch, build and install, it's a rust thing."
|
||||
cargo install --force --git https://github.com/sxyazi/yazi.git yazi-build
|
||||
;;
|
||||
|
||||
|
|
@ -66,6 +68,9 @@ 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 tomato-toml for editing toml files from bash
|
||||
cargo install tomato-toml
|
||||
|
||||
# Install supporting cargo packages
|
||||
cargo install ouch
|
||||
|
||||
|
|
@ -121,7 +126,7 @@ 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/
|
||||
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
|
||||
|
|
@ -132,10 +137,30 @@ 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
|
||||
: Split out the plugin specific settings from the yazi toml files and <<TODO
|
||||
apply them using the tomato-toml command line tool.
|
||||
|
||||
# To update a value in yazi.toml, use the set command. For example, to change
|
||||
the show_hidden setting:
|
||||
tomato set yazi.toml mgr.show_hidden true
|
||||
|
||||
# To add the prepend_fetchers array of tables to the [plugin] section
|
||||
tomato append plugin.prepend_fetchers '{ id = "git", url = "*", run = "git" }' yazi.toml
|
||||
tomato append plugin.prepend_fetchers '{ id = "git", url = "*/", run = "git" }' yazi.toml
|
||||
|
||||
# To add the [[mgr.prepend_keymap]] block using tomato-toml, use the append command with an inline table:
|
||||
tomato append mgr.prepend_keymap '{ on = ["g", "i"], run = "plugin lazygit", desc = "run lazygit" }' keymap.toml
|
||||
TODO
|
||||
|
||||
git clone https://github.com/lpnh/fr.yazi "${YAZI_PLUGINS}/fr.yazi"
|
||||
git clone https://github.com/DreamMaoMao/fg.yazi.git "${YAZI_PLUGINS}/fg.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"
|
||||
git clone https://github.com/Lil-Dank/lazygit.yazi "${YAZI_PLUGINS}/lazygit.yazi"
|
||||
|
||||
git clone https://github.com/Rolv-Apneseth/starship.yazi "${YAZI_PLUGINS}/starship.yazi"
|
||||
|
||||
# https://github.com/sxyazi/yazi/tree/shipped/yazi-config/preset
|
||||
conf_print_yazi_init() {
|
||||
|
|
@ -147,7 +172,8 @@ th.git.untracked_sign = "U"
|
|||
th.git.added_sign = "A"
|
||||
|
||||
-- 1. Official Git Plugin Setup
|
||||
require("git"):setup()
|
||||
-- require("git"):setup()
|
||||
require("git"):setup({ order = 1500 })
|
||||
|
||||
-- 2. FZF Plugin Setup (Default to jump/reveal)
|
||||
require("fg"):setup({
|
||||
|
|
@ -162,6 +188,24 @@ require("zoxide"):setup({
|
|||
require("full-border"):setup {
|
||||
type = ui.Border.ROUNDED,
|
||||
}
|
||||
-- Starship prompt
|
||||
require("starship"):setup({
|
||||
-- Hide flags (such as filter, find and search). This can be beneficial for starship themes
|
||||
-- which are intended to go across the entire width of the terminal.
|
||||
hide_flags = false,
|
||||
-- Whether to place flags after the starship prompt. False means the flags will be placed before the prompt.
|
||||
flags_after_prompt = true,
|
||||
-- Custom starship configuration file to use
|
||||
config_file = "~/.config/starship.toml", -- Default: nil
|
||||
-- Whether to enable support for starship's right prompt (i.e. `starship prompt --right`).
|
||||
show_right_prompt = true,
|
||||
-- Whether to hide the count widget, in case you want only your right prompt to show up. Only has
|
||||
-- an effect when `show_right_prompt = true`
|
||||
hide_count = false,
|
||||
-- Separator to place between the right prompt and the count widget. Use `count_separator = ""`
|
||||
-- to have no space between the widgets.
|
||||
count_separator = " ",
|
||||
})
|
||||
|
||||
-- Helper to get the current Git branch
|
||||
local function get_branch()
|
||||
|
|
@ -171,16 +215,49 @@ end
|
|||
|
||||
local branch_name = get_branch()
|
||||
|
||||
-- Show symlink in status bar
|
||||
Status:children_add(function(self)
|
||||
local h = self._current.hovered
|
||||
if h and h.link_to then
|
||||
return " -> " .. tostring(h.link_to)
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end, 3300, Status.LEFT)
|
||||
|
||||
-- Show user/group of files in status bar
|
||||
Status:children_add(function()
|
||||
local h = cx.active.current.hovered
|
||||
if not h or ya.target_family() ~= "unix" then
|
||||
return ""
|
||||
end
|
||||
|
||||
return ui.Line {
|
||||
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
|
||||
":",
|
||||
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
|
||||
" ",
|
||||
}
|
||||
end, 500, Status.RIGHT)
|
||||
|
||||
-- Show username and hostname in header
|
||||
Header:children_add(function()
|
||||
if ya.target_family() ~= "unix" then
|
||||
return ""
|
||||
end
|
||||
return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
|
||||
end, 500, Header.LEFT)
|
||||
|
||||
-- 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()
|
||||
function Linemode:size_and_mtime_1()
|
||||
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
|
||||
|
|
@ -192,7 +269,7 @@ function Linemode:size_and_mtime()
|
|||
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)
|
||||
|
|
@ -208,21 +285,40 @@ function Linemode:size_and_mtime()
|
|||
ui.Span(branch_name or ""):fg("blue"), -- Git Branch
|
||||
}
|
||||
end
|
||||
|
||||
-- Active linemode
|
||||
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 "-"
|
||||
|
||||
return ui.Line {
|
||||
ui.Span(size_str .. " "),
|
||||
ui.Span(time_str):fg("gray"),
|
||||
ui.Span(branch_name or ""):fg("blue"),
|
||||
}
|
||||
end
|
||||
|
||||
-- detects that you're using Yazi in nvim, the preview is hidden by default
|
||||
if os.getenv("NVIM") then
|
||||
require("toggle-pane"):entry("min-preview")
|
||||
end
|
||||
|
||||
EOF
|
||||
}
|
||||
conf_print_yazi_init | tee "${YAZI_HOME}"/yazi.toml
|
||||
conf_print_yazi_init | tee "${YAZI_HOME}"/init.lua
|
||||
|
||||
conf_print_yazi_toml() {
|
||||
cat <<'EOF'
|
||||
[manager]
|
||||
linemode = "size_and_mtime"
|
||||
|
||||
[mgr]
|
||||
ratio = [ 1, 4, 3 ]
|
||||
linemode = "size_and_mtime"
|
||||
show_header = true
|
||||
sort_dir_first = true
|
||||
sort_by = "alphabetical"
|
||||
show_symlink = true
|
||||
sort_dir_first = false
|
||||
sort_by = "mtime"
|
||||
sort_reverse = true
|
||||
show_symlink = false
|
||||
show_hidden = true
|
||||
|
||||
[plugin]
|
||||
|
|
@ -231,16 +327,6 @@ prepend_fetchers = [
|
|||
{ 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]]
|
||||
|
|
@ -257,6 +343,11 @@ run = "kra"
|
|||
mime = "image/tiff"
|
||||
run = "magick"
|
||||
|
||||
# GIMP imagae format
|
||||
[[plugin.prepend_previewers]]
|
||||
mime = "image/x-xcf"
|
||||
run = "magick"
|
||||
|
||||
[[plugin.prepend_previewers]]
|
||||
url = "*.{tif,tiff,TIF,TIFF}"
|
||||
run = "magick"
|
||||
|
|
@ -265,13 +356,13 @@ run = "magick"
|
|||
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 = "{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}"
|
||||
|
|
@ -280,6 +371,7 @@ run = "ouch"
|
|||
# --------------------------------
|
||||
|
||||
[preview]
|
||||
previewer = "kitten icat --clear --transfer-mode=memory --scale-up --place=\"$COLUMNS\"x\"$LINES\"@(math $EXTERNAL_COLUMNS-$COLUMNS)x0 --align center --stdin=no {}"
|
||||
max_width = 10000
|
||||
max_height = 10000
|
||||
|
||||
|
|
@ -357,9 +449,23 @@ on = "F"
|
|||
run = "plugin fg -- rg"
|
||||
desc = "find file by fzf content"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["f", "r"]
|
||||
run = "plugin fr rg"
|
||||
desc = "Search file by content (rg)"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["f", "a"]
|
||||
run = "plugin fr rga"
|
||||
desc = "Search file by content (rga)"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "z"
|
||||
run = "plugin zoxide"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "j"
|
||||
run = "plugin zoxide"
|
||||
desc = "Jump to a directory using zoxide"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
|
|
@ -372,6 +478,16 @@ on = "C"
|
|||
run = "plugin ouch"
|
||||
desc = "Compress with ouch"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "T"
|
||||
run = "plugin toggle-pane min-preview"
|
||||
desc = "Show or hide the preview pane"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "T"
|
||||
run = "plugin toggle-pane max-preview"
|
||||
desc = "Maximize or restore the preview pane"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "<C-d>"
|
||||
run = 'shell "ripdrag \"$@\"" --confirm'
|
||||
|
|
@ -393,6 +509,12 @@ on = "A"
|
|||
run = "create --dir"
|
||||
desc = "Create a new directory"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "!"
|
||||
for = "unix"
|
||||
run = 'shell "$SHELL" --block'
|
||||
desc = "Open $SHELL here"
|
||||
|
||||
# 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
|
||||
|
|
@ -508,3 +630,28 @@ function y() {
|
|||
EOF
|
||||
}
|
||||
conf_print_zsh_shell_wrapper | tee "${DEST}"/.zshrc.d/005_yazi_shell.zsh
|
||||
|
||||
conf_print_yazi_desktop() {
|
||||
cat <<EOF
|
||||
[Desktop Entry]
|
||||
Name=Yazi
|
||||
Icon=${HOME}/.local/share/icons/hicolor/scalable/apps/yazi.png
|
||||
Comment=A terminal file manager written in Rust, based on async I/O
|
||||
Terminal=true
|
||||
TryExec=${HOME}/.cargo/bin/yazi
|
||||
Exec=${HOME}/.cargo/bin/yazi %u
|
||||
Type=Application
|
||||
MimeType=inode/directory
|
||||
Categories=System;FileManager;FileTools;ConsoleOnly
|
||||
Keywords=File;Manager;Explorer;Browser;Launcher
|
||||
EOF
|
||||
}
|
||||
conf_print_yazi_desktop | tee "${DEST}/.local/share/applications/yazi.desktop"
|
||||
|
||||
xfce4-panel --add=launcher "${DEST}/.local/share/applications/yazi.desktop"
|
||||
|
||||
# Add an icon
|
||||
# /home/default/.cargo/git/checkouts/yazi-9e90c7eb7501bc19/98b1614/assets/logo.png
|
||||
mkdir -p ~/.local/share/icons/hicolor/scalable/apps/
|
||||
curl -s -L -o "${DEST}/.local/share/icons/hicolor/scalable/apps/yazi.png" \
|
||||
https://raw.githubusercontent.com/sxyazi/yazi/main/assets/logo.png
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ echo "*** Getting Zephyr and installing Python dependencies. ***"
|
|||
# echo 'export PATH=${HOME}/.local/bin:”$PATH”' >>${HOME}/.bashrc
|
||||
|
||||
# if [[ -d ${HOME}/.zshrc.d ]]; then
|
||||
# echo 'export PATH=${HOME}/.local/bin:"$PATH"' >>${HOME}/.zshrc.d/001_dot_local_path.sh
|
||||
# echo 'export PATH=${HOME}/.local/bin:"$PATH"' >>${HOME}/.zshrc.d/001_dot_local_path.zsh
|
||||
# fi
|
||||
|
||||
# ensure a conda env exists for zephyr python requirements
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@ sudo apt install -y zoxide
|
|||
# * cd now uses zoxide's fuzzy logic.
|
||||
# * cd .. still goes up one directory.
|
||||
# * cd /tmp still goes to an absolute path.
|
||||
# * But cd foo will jump to your most frequent foo directory, even if it's deep in your file system.
|
||||
# * But cd foo will jump to your most frequent foo directory, even if it's
|
||||
# deep in your file system.
|
||||
#
|
||||
# Note: If you use this, the z command will still exist, but cd becomes your daily driver.
|
||||
# Note: If you use this, the z command will still exist, but cd becomes your
|
||||
# daily driver.
|
||||
|
||||
# Example: Zsh Lazy Load Script
|
||||
# z() {
|
||||
|
|
@ -27,22 +29,27 @@ sudo apt install -y zoxide
|
|||
# $0 "$@"
|
||||
# }
|
||||
|
||||
# ⚠️ Warning: The downside of lazy loading is that zoxide won't record directory changes until after you run z for the first time in that session. If you open a terminal, cd around manually, and then close it without ever running z, those paths won't be saved to the database.
|
||||
# ⚠️ Warning: The downside of lazy loading is that zoxide won't record directory
|
||||
# changes until after you run z for the first time in that session. If you open
|
||||
# a terminal, cd around manually, and then close it without ever running z, those
|
||||
# paths won't be saved to the database.
|
||||
|
||||
conf_print_zshrc() {
|
||||
cat <<-'EOF'
|
||||
eval "$(zoxide init zsh --cmd cd)"
|
||||
EOF
|
||||
}
|
||||
conf_print_zshrc | tee ${DEST}/.zshrc.d/004_zoxide.zsh
|
||||
conf_print_zshrc | tee "${DEST}/.zshrc.d/004_zoxide.zsh"
|
||||
|
||||
# z and zi aliaes are part of the eval above.
|
||||
# Alias for interactive selection using fzf
|
||||
# alias zi='__zoxide_zi'
|
||||
conf_print_zsh_alias() {
|
||||
cat <<-'EOF'
|
||||
alias z='__zoxide_z'
|
||||
alias zi='__zoxide_zi'
|
||||
alias j='z'
|
||||
alias jj='zi'
|
||||
EOF
|
||||
}
|
||||
conf_print_zsh_alias | tee ${DEST}/.zsh_aliases.d/004_zoxide.zsh
|
||||
conf_print_zsh_alias | tee "${DEST}/.zsh_aliases.d/004_zoxide.zsh"
|
||||
|
|
|
|||
Loading…
Reference in New Issue