diff --git a/.editorconfig b/.editorconfig index da72dee..22f7ba5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,5 +2,5 @@ root = true [{*.sh,*.bash,*.zsh,.bashrc,.zshrc,install}] indent_style = space -indent_size = 2 +indent_size = 4 max_line_length = 80 diff --git a/profiles/base/.bash/conf.d/04-env.bash b/profiles/base/.bash/conf.d/04-env.bash index a78c69a..b24207f 100644 --- a/profiles/base/.bash/conf.d/04-env.bash +++ b/profiles/base/.bash/conf.d/04-env.bash @@ -1,8 +1,8 @@ # Set environment variables if command -v nvim >/dev/null 2>&1; then - export EDITOR="nvim" + export EDITOR="nvim" else - export EDITOR="vim" + export EDITOR="vim" fi # export EDITOR="ec" export VISUAL="${EDITOR}" @@ -22,6 +22,6 @@ export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB" # gpg-agent unset SSH_AGENT_PID if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne "$$" ]]; then - SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)" - export SSH_AUTH_SOCK + SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)" + export SSH_AUTH_SOCK fi diff --git a/profiles/base/.bash/conf.d/06-tool-integrations.bash b/profiles/base/.bash/conf.d/06-tool-integrations.bash index 524e352..f60e03f 100644 --- a/profiles/base/.bash/conf.d/06-tool-integrations.bash +++ b/profiles/base/.bash/conf.d/06-tool-integrations.bash @@ -1,45 +1,45 @@ # better ls if command -v eza >/dev/null 2>&1; then - alias ll="eza -bghHlS" + alias ll="eza -bghHlS" else - alias ll="exa -bghHlS" + alias ll="exa -bghHlS" fi # bat (debian) if command -v batcat >/dev/null 2>&1; then - alias bat=batcat + alias bat=batcat fi # HSTR configuration - add this to ~/.bashrc -alias hh="hstr" # hh to be alias for hstr -export HSTR_CONFIG="hicolor" # get more colors -shopt -s histappend # append new history items to .bash_history -export HISTCONTROL="ignorespace" # leading space hides commands from history -export HISTFILESIZE="10000" # increase history file size (default is 500) -export HISTSIZE="${HISTFILESIZE}" # increase history size (default is 500) +alias hh="hstr" # hh to be alias for hstr +export HSTR_CONFIG="hicolor" # get more colors +shopt -s histappend # append new history items to .bash_history +export HISTCONTROL="ignorespace" # leading space hides commands from history +export HISTFILESIZE="10000" # increase history file size (default is 500) +export HISTSIZE="$HISTFILESIZE" # increase history size (default is 500) # ensure synchronization between bash memory and history file export PROMPT_COMMAND=("history -a; history -n;" "${PROMPT_COMMAND[@]}") function hstrnotiocsti { - { READLINE_LINE="$({ &1 1>&3 3>&-)"; } 3>&1 - READLINE_POINT="${#READLINE_LINE}" + { READLINE_LINE="$({ &1 1>&3 3>&-)"; } 3>&1 + READLINE_POINT="${#READLINE_LINE}" } # if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc) if [[ $- =~ .*i.* ]]; then - bind -x '"\C-r": "hstrnotiocsti"' + bind -x '"\C-r": "hstrnotiocsti"' fi export HSTR_TIOCSTI="n" # ranger ranger_cd() { - temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")" - ranger --choosedir="${temp_file}" -- "${@:-${PWD}}" - if chosen_dir="$(cat -- "${temp_file}")" && - [[ -n "${chosen_dir}" ]] && - [[ "${chosen_dir}" != "${PWD}" ]]; then - cd -- "${chosen_dir}" || exit 1 - fi - rm -f -- "${temp_file}" + temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")" + ranger --choosedir="$temp_file" -- "${@:-$PWD}" + if chosen_dir="$(cat -- "$temp_file")" && + [[ -n "$chosen_dir" ]] && + [[ "$chosen_dir" != "$PWD" ]]; then + cd -- "$chosen_dir" || exit 1 + fi + rm -f -- "$temp_file" } alias ranger="ranger_cd" @@ -51,9 +51,9 @@ alias ranger="ranger_cd" # inside tmux, we don't know if Sway got restarted if [[ -v TMUX ]]; then - swaymsg() { - SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock" - export SWAYSOCK - command swaymsg "$@" - } + swaymsg() { + SWAYSOCK="$XDG_RUNTIME_DIR/sway-ipc.$UID.$(pgrep -x sway).sock" + export SWAYSOCK + command swaymsg "$@" + } fi diff --git a/profiles/base/.bash/conf.d/07-aliases.bash b/profiles/base/.bash/conf.d/07-aliases.bash index c1dce78..a5b67e3 100644 --- a/profiles/base/.bash/conf.d/07-aliases.bash +++ b/profiles/base/.bash/conf.d/07-aliases.bash @@ -8,13 +8,13 @@ alias sudo="sudo " alias rsync_copy="rsync -aAXUHvh --partial-dir=.rsync-partial --progress" alias rsync_copy_ssh="rsync_copy -e ssh" alias rsync_backup="rsync_copy --numeric-ids --delete --exclude={'/dev/*', \ - '/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}" + '/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}" alias rsync_backup_ssh="rsync_backup -e ssh" alias rsync_restore="rsync_copy --numeric-ids --delete --exclude='lost+found'" alias rsync_restore_ssh="rsync_restore -e ssh" alias glog="git log --oneline" alias emerge_world="emerge --ask --verbose --deep --newuse --update @world" alias sync_repo="rsync_copy_ssh --delete ~/arch_paczuchy/* \ - vps.paraboletancza.org:/srv/http/arch.paraboletancza.org" + vps.paraboletancza.org:/srv/http/arch.paraboletancza.org" alias aur_sync="aur sync --sign --chroot" alias aur_build="aur build --sign --chroot" diff --git a/profiles/base/.bash/conf.d/08-functions.bash b/profiles/base/.bash/conf.d/08-functions.bash index 696fb25..115cfcf 100644 --- a/profiles/base/.bash/conf.d/08-functions.bash +++ b/profiles/base/.bash/conf.d/08-functions.bash @@ -1,34 +1,34 @@ take() { - local -r directory="$1" - mkdir -p "${directory}" - cd "${directory}" || exit 1 + local -r directory="$1" + mkdir -p "$directory" + cd "$directory" || exit 1 } # downloading from youtube yt-dlp() { - local -a -r args=( - --cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser" - --extractor-args "youtube:player_client=default,web_safari;player_js_version=actual" - --fragment-retries infinite - ) - command yt-dlp "${args[@]}" "$@" + local -a -r args=( + --cookies-from-browser "chromium:$HOME/.local/share/qutebrowser" + --extractor-args "youtube:player_client=default,web_safari;player_js_version=actual" + --fragment-retries infinite + ) + command yt-dlp "${args[@]}" "$@" } yt_dl_mp3() { - yt-dlp -t mp3 --embed-thumbnail "$@" + yt-dlp -t mp3 --embed-thumbnail "$@" } yt_dl_channel() { - local -a -r args=( - --download-archive "archive.txt" - --output "%(upload_date)s.%(title)s.%(id)s.%(ext)s" - --merge-output-format mkv - --ignore-errors - --write-sub - --sub-langs "en,pl" - --write-description - --write-info-json - --write-thumbnail - ) - yt-dlp "${args[@]}" "$@" + local -a -r args=( + --download-archive "archive.txt" + --output "%(upload_date)s.%(title)s.%(id)s.%(ext)s" + --merge-output-format mkv + --ignore-errors + --write-sub + --sub-langs "en,pl" + --write-description + --write-info-json + --write-thumbnail + ) + yt-dlp "${args[@]}" "$@" } diff --git a/profiles/base/.bashrc b/profiles/base/.bashrc index df2a9b5..d1ccd16 100644 --- a/profiles/base/.bashrc +++ b/profiles/base/.bashrc @@ -3,13 +3,11 @@ # # load bash configuration -CONF_DIR="${HOME}/.bash/conf.d" -readonly CONF_DIR +readonly conf_dir="${HOME}/.bash/conf.d" -if [[ -d "${CONF_DIR}" ]]; then - for conf_file in "${CONF_DIR}"/*.bash; do - [[ -r "${conf_file}" ]] || continue - # shellcheck source=/dev/null - source "${conf_file}" - done +if [[ -d "${conf_dir}" ]]; then + for conf_file in "${conf_dir}"/*.bash; do + # shellcheck source=/dev/null + [[ -r "$conf_file" ]] && . "${conf_file}" + done fi diff --git a/profiles/base/.local/bin/.editorconfig b/profiles/base/.local/bin/.editorconfig index d8be63d..5ba5a3b 100644 --- a/profiles/base/.local/bin/.editorconfig +++ b/profiles/base/.local/bin/.editorconfig @@ -2,5 +2,5 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 max_line_length = 80 diff --git a/profiles/base/.local/bin/check_ip b/profiles/base/.local/bin/check_ip index e6c5a25..e4b5fd7 100755 --- a/profiles/base/.local/bin/check_ip +++ b/profiles/base/.local/bin/check_ip @@ -4,11 +4,11 @@ SCRIPT_NAME="${0##*/}" readonly SCRIPT_NAME check_deps() { - command -v curl >/dev/null 2>&1 || die "curl: command not found" + command -v curl >/dev/null 2>&1 || die "curl: command not found" } usage() { - cat <&2 - exit 1 + local -r message="$1" + printf "%s: %b\n" "${SCRIPT_NAME}" "${message}" >&2 + exit 1 } invalid_option() { - local -r option="$1" - die "invalid option $(shell_quote "${option}") + local -r option="$1" + die "invalid option $(shell_quote "${option}") Try '${SCRIPT_NAME} --help' for usage." } parse_args() { - family="auto" - while (($# > 0)); do - case "$1" in - -h | --help) - usage - exit 0 - ;; - --family) - ( (($# < 2)) || [[ -z "$2" ]]) && - die "--family requires an argument (auto, 4 or 6)" - family="$2" - shift 2 - ;; - --family=*) - family="${1#*=}" - [[ -z "${family}" ]] && - die "--family requires an argument (auto, 4 or 6)" - shift - ;; - *) invalid_option "$1" ;; - esac - done - validate_args + family="auto" + while (($# > 0)); do + case "$1" in + -h | --help) + usage + exit 0 + ;; + --family) + ( (($# < 2)) || [[ -z "$2" ]]) && + die "--family requires an argument (auto, 4 or 6)" + family="$2" + shift 2 + ;; + --family=*) + family="${1#*=}" + [[ -z "${family}" ]] && + die "--family requires an argument (auto, 4 or 6)" + shift + ;; + *) invalid_option "$1" ;; + esac + done + validate_args } validate_args() { - case "${family}" in - auto | 4 | 6) ;; - *) die "invalid value for family: '${family}' (expected auto, 4 or 6)" ;; - esac + case "${family}" in + auto | 4 | 6) ;; + *) die "invalid value for family: '${family}' (expected auto, 4 or 6)" ;; + esac } show_ip() { - local -a curl_args=() - [[ ${family} == "4" ]] && curl_args=("-4") - [[ ${family} == "6" ]] && curl_args=("-6") - curl "${curl_args[@]}" zx2c4.com/ip + local -a curl_args=() + [[ ${family} == "4" ]] && curl_args=("-4") + [[ ${family} == "6" ]] && curl_args=("-6") + curl "${curl_args[@]}" zx2c4.com/ip } main() { - check_deps - parse_args "$@" - show_ip + check_deps + parse_args "$@" + show_ip } main "$@" diff --git a/profiles/base/.zsh/conf.d/00-base.zsh b/profiles/base/.zsh/conf.d/00-base.zsh index fb703f4..8bda584 100644 --- a/profiles/base/.zsh/conf.d/00-base.zsh +++ b/profiles/base/.zsh/conf.d/00-base.zsh @@ -1,18 +1,18 @@ # Set PATH environment variable typeset -U path PATH path=( - "${HOME}/.local/bin" - "/usr/local/sbin" - "/usr/local/bin" - "/usr/sbin" - "/sbin" - "${path[@]}" + "$HOME/.local/bin" + "/usr/local/sbin" + "/usr/local/bin" + "/usr/sbin" + "/sbin" + "${path[@]}" ) export PATH # Configure shell history behavior -HISTFILE="${HOME}/.zsh_history" -HISTSIZE="10000" -SAVEHIST="10000" +HISTFILE="$HOME/.zsh_history" +HISTSIZE=10000 +SAVEHIST=10000 setopt appendhistory setopt HIST_IGNORE_SPACE diff --git a/profiles/base/.zsh/conf.d/01-vi-keybindings.zsh b/profiles/base/.zsh/conf.d/01-vi-keybindings.zsh index d6d7752..2e5659d 100644 --- a/profiles/base/.zsh/conf.d/01-vi-keybindings.zsh +++ b/profiles/base/.zsh/conf.d/01-vi-keybindings.zsh @@ -13,24 +13,24 @@ bindkey '^U' backward-kill-line # Change cursor shape for different vi modes zle-keymap-select() { - if [[ "${KEYMAP}" == "vicmd" ]] || - [[ "$1" == "block" ]]; then - echo -ne '\e[2 q' - psvar[1]="(cmd) " - elif [[ "${KEYMAP}" == "main" ]] || - [[ "${KEYMAP}" == "viins" ]] || - [[ -z "${KEYMAP}" ]] || - [[ "$1" == "beam" ]]; then - echo -ne '\e[6 q' - psvar[1]="(ins) " - fi - zle reset-prompt + if [[ $KEYMAP == "vicmd" ]] || + [[ $1 == "block" ]]; then + echo -ne '\e[2 q' + psvar[1]="(cmd) " + elif [[ $KEYMAP == "main" ]] || + [[ $KEYMAP == "viins" ]] || + [[ -z "$KEYMAP" ]] || + [[ $1 == "beam" ]]; then + echo -ne '\e[6 q' + psvar[1]="(ins) " + fi + zle reset-prompt } zle -N zle-keymap-select zle-line-init() { - zle -K viins # Initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) - echo -ne '\e[6 q' - psvar[1]="(ins) " + zle -K viins # Initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne '\e[6 q' + psvar[1]="(ins) " } zle -N zle-line-init echo -ne '\e[6 q' # Use beam shape cursor on startup diff --git a/profiles/base/.zsh/conf.d/02-prompt.zsh b/profiles/base/.zsh/conf.d/02-prompt.zsh index 612b914..5f322c1 100644 --- a/profiles/base/.zsh/conf.d/02-prompt.zsh +++ b/profiles/base/.zsh/conf.d/02-prompt.zsh @@ -1,19 +1,19 @@ -if [[ -z "${TMUX}" ]]; then - export REAL_TERM="${TERM}" +if [[ -z "$TMUX" ]]; then + export REAL_TERM="${TERM}" fi -if [[ "${REAL_TERM}" != "linux" ]]; then - # To customize prompt, run `p10k configure` or edit ~/.zsh/prompt/p10k.zsh. - . "${HOME}/.zsh/plugins/powerlevel10k/powerlevel10k.zsh-theme" +if [[ $REAL_TERM != "linux" ]]; then + # To customize prompt, run `p10k configure` or edit ~/.zsh/prompt/p10k.zsh. + . "$HOME/.zsh/plugins/powerlevel10k/powerlevel10k.zsh-theme" - # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. - # Initialization code that may require console input (password prompts, [y/n] - # confirmations, etc.) must go above this block; everything else may go below. - if [[ -r "${XDG_CACHE_HOME:-${HOME}/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - . "${XDG_CACHE_HOME:-${HOME}/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" - fi + # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. + # Initialization code that may require console input (password prompts, [y/n] + # confirmations, etc.) must go above this block; everything else may go below. + if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + . "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" + fi - [[ -f "${HOME}/.zsh/prompt/p10k.zsh" ]] && . "${HOME}/.zsh/prompt/p10k.zsh" + [[ -f "$HOME/.zsh/prompt/p10k.zsh" ]] && . "$HOME/.zsh/prompt/p10k.zsh" else - . "${HOME}/.zsh/prompt/fallback.zsh" + . "$HOME/.zsh/prompt/fallback.zsh" fi diff --git a/profiles/base/.zsh/conf.d/03-plugins.zsh b/profiles/base/.zsh/conf.d/03-plugins.zsh index 5b0dd60..d5138a1 100644 --- a/profiles/base/.zsh/conf.d/03-plugins.zsh +++ b/profiles/base/.zsh/conf.d/03-plugins.zsh @@ -1,10 +1,10 @@ ## Plugins configuration # Automatic suggestions -. "${HOME}/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" +. "$HOME/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" # Completions -fpath=("${HOME}/.zsh/plugins/zsh-completions/src" "${fpath[@]}") +fpath=("$HOME/.zsh/plugins/zsh-completions/src" "${fpath[@]}") autoload -U compinit promptinit compinit promptinit @@ -14,4 +14,4 @@ promptinit zstyle ":completion::complete:*" use-cache 1 # Syntax highlighting in zsh prompt -. "${HOME}/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" +. "$HOME/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" diff --git a/profiles/base/.zsh/conf.d/04-emacs.zsh b/profiles/base/.zsh/conf.d/04-emacs.zsh index c0b93f1..b60e00d 100644 --- a/profiles/base/.zsh/conf.d/04-emacs.zsh +++ b/profiles/base/.zsh/conf.d/04-emacs.zsh @@ -1,3 +1,2 @@ # emacs specific stuff -[[ -n "${EAT_SHELL_INTEGRATION_DIR}" ]] && - . "${EAT_SHELL_INTEGRATION_DIR}/zsh" +[[ -n "$EAT_SHELL_INTEGRATION_DIR" ]] && . "$EAT_SHELL_INTEGRATION_DIR/zsh" diff --git a/profiles/base/.zsh/conf.d/05-env.zsh b/profiles/base/.zsh/conf.d/05-env.zsh index 75723fb..2d33702 100644 --- a/profiles/base/.zsh/conf.d/05-env.zsh +++ b/profiles/base/.zsh/conf.d/05-env.zsh @@ -5,17 +5,17 @@ else export EDITOR="vim" fi # export EDITOR="ec" -export VISUAL="${EDITOR}" -export SUDO_EDITOR="${EDITOR}" +export VISUAL="$EDITOR" +export SUDO_EDITOR="$EDITOR" export VIRSH_DEFAULT_CONNECT_URI="qemu:///system" export BROWSER="chromium" export PAGER="less -R -F" -export BAT_PAGER="${PAGER}" +export BAT_PAGER="$PAGER" export MANPAGER="less -R --use-color -Dd+r -Du+b" [ -f "/usr/share/cowsay/cows" ] && export COWPATH="/usr/share/cowsay/cows" -export CHROOT="${HOME}/arch_chroot" +export CHROOT="$HOME/arch_chroot" export AUR_REPO="whiteman808" -export AURDEST="${HOME}/.cache/paru/clone" +export AURDEST="$HOME/.cache/paru/clone" export AUR_PAGER="ranger" export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB" diff --git a/profiles/base/.zsh/conf.d/06-color-output.zsh b/profiles/base/.zsh/conf.d/06-color-output.zsh index 18f397c..c30a812 100644 --- a/profiles/base/.zsh/conf.d/06-color-output.zsh +++ b/profiles/base/.zsh/conf.d/06-color-output.zsh @@ -8,15 +8,15 @@ export LESS='-R --use-color -Dd+r$Du+b$' zmodload zsh/zpty pty() { - zpty pty-${UID} ${1+$@} - if [[ ! -t 1 ]]; then - setopt local_traps - trap '' INT - fi - zpty -r pty-${UID} - zpty -d pty-${UID} + zpty pty-$UID ${1+$@} + if [[ ! -t 1 ]]; then + setopt local_traps + trap '' INT + fi + zpty -r pty-$UID + zpty -d pty-$UID } ptyless() { - pty "$@" | less + pty "$@" | less } diff --git a/profiles/base/.zsh/conf.d/07-tool-integrations.zsh b/profiles/base/.zsh/conf.d/07-tool-integrations.zsh index d8bc7c9..da3e7ee 100644 --- a/profiles/base/.zsh/conf.d/07-tool-integrations.zsh +++ b/profiles/base/.zsh/conf.d/07-tool-integrations.zsh @@ -1,44 +1,44 @@ # HSTR configuration - add this to ~/.zshrc if command -v hstr >/dev/null 2>&1; then - alias hh="hstr" # hh to be alias for hstr - setopt histignorespace # skip cmds w/ leading space from history - export HSTR_CONFIG="hicolor" # get more colors - hstr_no_tiocsti() { - zle -I - { HSTR_OUT="$( { &1 1>&3 3>&- )"; } 3>&1; - BUFFER="${HSTR_OUT}" - CURSOR="${#BUFFER}" - zle redisplay - } - zle -N hstr_no_tiocsti - bindkey '\C-r' hstr_no_tiocsti - export HSTR_TIOCSTI=n + alias hh="hstr" # hh to be alias for hstr + setopt histignorespace # skip cmds w/ leading space from history + export HSTR_CONFIG="hicolor" # get more colors + hstr_no_tiocsti() { + zle -I + { HSTR_OUT="$( { &1 1>&3 3>&- )"; } 3>&1; + BUFFER="${HSTR_OUT}" + CURSOR="${#BUFFER}" + zle redisplay + } + zle -N hstr_no_tiocsti + bindkey '\C-r' hstr_no_tiocsti + export HSTR_TIOCSTI=n else - bindkey '\C-r' history-incremental-search-backward + bindkey '\C-r' history-incremental-search-backward fi # better ls if command -v eza >/dev/null 2>&1; then - alias ll="eza -bghHlS" + alias ll="eza -bghHlS" else - alias ll="exa -bghHlS" + alias ll="exa -bghHlS" fi # bat (debian) if command -v batcat >/dev/null 2>&1; then - alias bat=batcat + alias bat="batcat" fi # ranger ranger_cd() { - temp_file=$(mktemp -t "ranger_cd.XXXXXXXXXX") - ranger --choosedir="${temp_file}" -- "${@:-${PWD}}" - if chosen_dir=$(cat -- "${temp_file}") && - [ -n "${chosen_dir}" ] && - [ "${chosen_dir}" != "${PWD}" ]; then - cd -- "${chosen_dir}" - fi - rm -f -- "${temp_file}" + temp_file=$(mktemp -t "ranger_cd.XXXXXXXXXX") + ranger --choosedir="$temp_file" -- "${@:-$PWD}" + if chosen_dir=$(cat -- "$temp_file") && + [ -n "$chosen_dir" ] && + [ $chosen_dir != "$PWD" ]; then + cd -- "$chosen_dir" + fi + rm -f -- "$temp_file" } alias ranger="ranger_cd" @@ -47,38 +47,38 @@ alias ranger="ranger_cd" [[ -f "/usr/lib/mc/mc.sh" ]] && . "/usr/lib/mc/mc.sh" # nix package manager -[[ -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && - . "${HOME}/.nix-profile/etc/profile.d/nix.sh" +[[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]] && + . "$HOME/.nix-profile/etc/profile.d/nix.sh" # nix shell if command -v nix-your-shell >/dev/null 2>&1; then - nix-your-shell zsh | . /dev/stdin + nix-your-shell zsh | . /dev/stdin fi # node.js -export NVM_DIR="${HOME}/.nvm" -[[ -s "${NVM_DIR}/nvm.sh" ]] && - . "${NVM_DIR}/nvm.sh" # This loads nvm -[[ -s "${NVM_DIR}/bash_completion" ]] && - . "${NVM_DIR}/bash_completion" # This loads nvm bash_completion +export NVM_DIR="$HOME/.nvm" +[[ -s "$NVM_DIR/nvm.sh" ]] && + . "$NVM_DIR/nvm.sh" # This loads nvm +[[ -s "$NVM_DIR/bash_completion" ]] && + . "$NVM_DIR/bash_completion" # This loads nvm bash_completion # rvm -[[ -s "${HOME}/.rvm/scripts/rvm" ]] && . "${HOME}/.rvm/scripts/rvm" +[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # pyenv -export PYENV_ROOT="${HOME}/.pyenv" -if [[ -d "${PYENV_ROOT}/bin" ]]; then - path=("${PYENV_ROOT}/bin" "${path[@]}") - export PATH - eval "$(pyenv init - zsh)" - eval "$(pyenv virtualenv-init -)" +export PYENV_ROOT="$HOME/.pyenv" +if [[ -d "$PYENV_ROOT/bin" ]]; then + path=("$PYENV_ROOT/bin" "${path[@]}") + export PATH + eval "$(pyenv init - zsh)" + eval "$(pyenv virtualenv-init -)" fi # inside tmux, we don't know if Sway got restarted if [[ -v TMUX ]]; then - swaymsg() { - SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock" - export SWAYSOCK - command swaymsg "$@" - } + swaymsg() { + SWAYSOCK="$XDG_RUNTIME_DIR/sway-ipc.$UID.$(pgrep -x sway).sock" + export SWAYSOCK + command swaymsg "$@" + } fi diff --git a/profiles/base/.zsh/conf.d/08-aliases.zsh b/profiles/base/.zsh/conf.d/08-aliases.zsh index ec4e972..1fdc8db 100644 --- a/profiles/base/.zsh/conf.d/08-aliases.zsh +++ b/profiles/base/.zsh/conf.d/08-aliases.zsh @@ -7,13 +7,13 @@ alias sudo="sudo " alias rsync_copy="rsync -aAXUHvh --partial-dir=.rsync-partial --progress" alias rsync_copy_ssh="rsync_copy -e ssh" alias rsync_backup="rsync_copy --numeric-ids --delete --exclude={'/dev/*', \ - '/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}" + '/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}" alias rsync_backup_ssh="rsync_backup -e ssh" alias rsync_restore="rsync_copy --numeric-ids --delete --exclude='lost+found'" alias rsync_restore_ssh="rsync_restore -e ssh" alias glog="git log --oneline" alias emerge_world="emerge --ask --verbose --deep --newuse --update @world" alias sync_repo="rsync_copy_ssh --delete ~/arch_paczuchy/* \ - vps.paraboletancza.org:/srv/http/repo.paraboletancza.org/arch" + vps.paraboletancza.org:/srv/http/repo.paraboletancza.org/arch" alias aur_sync="aur sync --sign --chroot" alias aur_build="aur build --sign --chroot" diff --git a/profiles/base/.zsh/conf.d/09-functions.zsh b/profiles/base/.zsh/conf.d/09-functions.zsh index 696fb25..8e62353 100644 --- a/profiles/base/.zsh/conf.d/09-functions.zsh +++ b/profiles/base/.zsh/conf.d/09-functions.zsh @@ -1,34 +1,35 @@ take() { - local -r directory="$1" - mkdir -p "${directory}" - cd "${directory}" || exit 1 + local -r directory="$1" + mkdir -p "$directory" + cd "$directory" || exit 1 } # downloading from youtube yt-dlp() { - local -a -r args=( - --cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser" - --extractor-args "youtube:player_client=default,web_safari;player_js_version=actual" - --fragment-retries infinite - ) - command yt-dlp "${args[@]}" "$@" + local -a -r args=( + --cookies-from-browser "chromium:$HOME/.local/share/qutebrowser" + --extractor-args "youtube:player_client=default,web_safari;player_js_version=actual" + --fragment-retries infinite + --remote-components "ejs:github" + ) + command yt-dlp "${args[@]}" "$@" } yt_dl_mp3() { - yt-dlp -t mp3 --embed-thumbnail "$@" + yt-dlp -t mp3 --embed-thumbnail "$@" } yt_dl_channel() { - local -a -r args=( - --download-archive "archive.txt" - --output "%(upload_date)s.%(title)s.%(id)s.%(ext)s" - --merge-output-format mkv - --ignore-errors - --write-sub - --sub-langs "en,pl" - --write-description - --write-info-json - --write-thumbnail - ) - yt-dlp "${args[@]}" "$@" + local -a -r args=( + --download-archive "archive.txt" + --output "%(upload_date)s.%(title)s.%(id)s.%(ext)s" + --merge-output-format mkv + --ignore-errors + --write-sub + --sub-langs "en,pl" + --write-description + --write-info-json + --write-thumbnail + ) + yt-dlp "${args[@]}" "$@" } diff --git a/profiles/base/.zshrc b/profiles/base/.zshrc index eb02ccf..d893647 100644 --- a/profiles/base/.zshrc +++ b/profiles/base/.zshrc @@ -1,4 +1,4 @@ # load zsh configuration -for file in "${HOME}/.zsh/conf.d/"*.zsh(N); do - source "${file}" +for file in "$HOME/.zsh/conf.d/"*.zsh(N); do + . "$file" done diff --git a/profiles/desktop/.local/bin/.editorconfig b/profiles/desktop/.local/bin/.editorconfig index d8be63d..5ba5a3b 100644 --- a/profiles/desktop/.local/bin/.editorconfig +++ b/profiles/desktop/.local/bin/.editorconfig @@ -2,5 +2,5 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 max_line_length = 80