commit b8233471ab16e997a6e0eacb7d26cf09352e5f9d Author: darkclip Date: Tue Jan 9 20:31:22 2024 +0800 update diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..1742af1 --- /dev/null +++ b/.zshrc @@ -0,0 +1,75 @@ +# Lines configured by zsh-newuser-install +HISTFILE=~/.zsh_history +SAVEHIST=500000 +HISTSIZE=$SAVEHIST+100000 + +setopt APPEND_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_IGNORE_SPACE +zshaddhistory() { whence ${${(z)1}[1]} >| /dev/null || return 1 } + +unsetopt beep +# cat > /dev/null test keys +# zle -al list all commands +bindkey -e #emacs +bindkey "^[[3~" delete-char #Delete +bindkey "^[[H" beginning-of-line #Home +bindkey "^[[F" end-of-line #End +bindkey "^[[5~" history-search-backward #PgUp +bindkey "^[[6~" history-search-forward #PgDn +bindkey "^[[1;5C" vi-forward-word #C-right +bindkey "^[[1;5D" vi-backward-word #C-left +bindkey "^H" vi-backward-kill-word #C-Backspace +bindkey "^[[3;5~" delete-word #C-Delete +# End of lines configured by zsh-newuser-install + + +# The following lines were added by compinstall +zstyle ':completion:*' menu select +zstyle ':completion::complete:*' gain-privileges 1 +zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'l:|=* r:|=*' 'r:|[._-]=* r:|=*' + +autoload -Uz compinit +compinit +# End of lines added by compinstall + + +autoload -Uz promptinit +promptinit + + +source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh +source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + + +export FZF_DEFAULT_COMMAND='fdfind --strip-cwd-prefix --hidden --exclude .git --exclude __pycache__ --exclude node_modules --exclude .cache' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND='fdfind --type d --strip-cwd-prefix --hidden --exclude .git --exclude __pycache__ --exclude node_modules --exclude .cache' +_fzf_compgen_path() { + fdfind --hidden --exclude .git --exclude __pycache__ --exclude node_modules --exclude .cache . "$1" +} +_fzf_compgen_dir() { + fdfind --type d --hidden --exclude .git --exclude __pycache__ --exclude node_modules --exclude .cache . "$1" +} +source /usr/share/doc/fzf/examples/completion.zsh +source /usr/share/doc/fzf/examples/key-bindings.zsh + +prompt fire + + +export PATH=$HOME/.yarn/bin:$HOME/.local/bin:$PATH + +export MANPAGER="sh -c 'col -bx|batcat -l man -p'" +alias cat="batcat -pp" +alias h="batcat -pl help" +help(){ + "$@" --help 2>&1 | h +} + +alias c=clear +alias ls=exa +alias l="ls -lhg" +alias ll="ls -alhg" + diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..335b570 --- /dev/null +++ b/init.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +set -e + +mirror_site="mirrors.tuna.tsinghua.edu.cn" +#mirror_site="mirrors.ustc.edu.cn" +packages_base="packages-base.txt" +packages_addon="packages-addon.txt" + +OS_ARCH=$(dpkg --print-architecture) +OS_CODE=$(. /etc/os-release && echo "$VERSION_CODENAME") +OS_VERSION="" +case $OS_CODE in + bullseye) OS_VERSION="11" ;; + bookworm) OS_VERSION="12" ;; +esac + +sed -i -r "s/.*set tabsize.*/set tabsize 4/g" /etc/nanorc +sed -i -r "s/.*set tabstospaces.*/set tabstospaces/g" /etc/nanorc + +echo -e "deb https://$mirror_site/debian/ $OS_CODE main contrib non-free non-free-firmware +deb https://$mirror_site/debian/ $OS_CODE-updates main contrib non-free non-free-firmware +deb https://$mirror_site/debian/ $OS_CODE-backports main contrib non-free non-free-firmware +deb https://$mirror_site/debian-security $OS_CODE-security main contrib non-free non-free-firmware +" | tee /etc/apt/sources.list + +command="nala" +apt update +apt install $command || command="apt" +test -f "$packages_base" +xargs -a <(awk '! /^ *(#|$)/' "$packages_base") -r $command install + + +if [[ $OS_VERSION=="12" ]]; then + OS_VERSION="Testing" +fi +echo "deb http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-completions/Debian_$OS_VERSION/ /" | \ + tee /etc/apt/sources.list.d/shells:zsh-users:zsh-completions.list +curl -fsSL "https://download.opensuse.org/repositories/shells:zsh-users:zsh-completions/Debian_$OS_VERSION/Release.key" | \ + gpg --dearmor | tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions.gpg > /dev/null + + +echo "deb [arch=$OS_ARCH] https://$mirror_site/docker-ce/linux/debian $OS_CODE stable" | \ + tee /etc/apt/sources.list.d/docker.list +curl -fsSL "https://download.docker.com/linux/debian/gpg" | \ + gpg --dearmor | tee /etc/apt/trusted.gpg.d/docker.gpg > /dev/null + + +$command update +test -f "$packages_addon" +xargs -a <(awk '! /^ *(#|$)/' "$packages_addon") -r $command install + +cp .zshrc $HOME + diff --git a/packages-addon.txt b/packages-addon.txt new file mode 100644 index 0000000..9bd8ef7 --- /dev/null +++ b/packages-addon.txt @@ -0,0 +1,7 @@ +zsh-completions +docker-ce +docker-ce-cli +containerd.io +docker-buildx-plugin +docker-compose-plugin + diff --git a/packages-base.txt b/packages-base.txt new file mode 100644 index 0000000..05ad83d --- /dev/null +++ b/packages-base.txt @@ -0,0 +1,18 @@ +ca-certificates +curl +gnupg +lsb-release +traceroute +bridge-utils +bind9-dnsutils +tcpdump +unrar +unzip +fd-find +exa +bat +fzf +zsh +zsh-autosuggestions +zsh-syntax-highlighting +