From 1faddcda446a30044f67c10e42946ee37374b623 Mon Sep 17 00:00:00 2001 From: Dominic Reich Date: Sun, 7 Jul 2024 11:08:07 +0200 Subject: [PATCH] personalize (combined commit from over the years) --- README.md | 3 +- modules/gpg/init.zsh | 2 +- runcoms/zaliases | 301 +++++++++++++++++++++++++++++++++++++++++++ runcoms/zlogin | 20 ++- runcoms/zlogout | 22 ++-- runcoms/zpreztorc | 70 +++++++--- runcoms/zprofile | 59 +++++++-- runcoms/zshrc | 81 ++++++++++++ 8 files changed, 514 insertions(+), 44 deletions(-) create mode 100644 runcoms/zaliases diff --git a/README.md b/README.md index 40163fa8..d16be8ad 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ version is **4.3.11**. 02. Clone the repository: ```console - git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" + git clone --recursive git@repo.oe7drt.net:dominic/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" + git clone --recursive https://repo.oe7drt.net/dominic/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" ```
diff --git a/modules/gpg/init.zsh b/modules/gpg/init.zsh index a3b37ba3..be5632e6 100644 --- a/modules/gpg/init.zsh +++ b/modules/gpg/init.zsh @@ -18,7 +18,7 @@ _gpg_agent_env="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/gpg-agent.env" source "$_gpg_agent_env" 2> /dev/null # Start gpg-agent if not started. -if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then +if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" && ! -S "/run/user/$(id -u)/gnupg/S.gpg-agent" ]]; then # Start gpg-agent if not started. if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then mkdir -p "$_gpg_agent_env:h" diff --git a/runcoms/zaliases b/runcoms/zaliases new file mode 100644 index 00000000..c95e065a --- /dev/null +++ b/runcoms/zaliases @@ -0,0 +1,301 @@ +# dominics alias file +# arch linux - polaris +# oe7drt.com / "2023-01-31T02:14:41+0100" + +#alias la='ls -lah' +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' + +alias ducks='du -cks * | sort -rn | head' +alias confcat="sed -e 's/#.*//;/^\s*$/d' "$@"" + +alias la='ls -la' +alias ll='ls -l' +alias lh='ls -lh' + +alias sc='screen -DR Hooray' +alias dmr='screen -DR DMR' +alias tm='tmux -u new-session -A -s Eve' + +[[ "$EUID" -ne 0 ]] && __is_available sudo \ +&& alias admin='sudo su' \ +&& alias dmesg='sudo dmesg' \ +&& alias dt='dmesg | tail -n 15' \ +&& alias dm='tail -f /var/log/messages' + +[[ "$EUID" -ne 0 ]] && __is_available doas \ +&& alias dosa='doas' \ +&& alias admin='doas su' \ +&& alias dmesg='doas dmesg' \ +&& alias dt='doas dmesg | tail -n 15' \ +&& alias dm='tail -f /var/log/messages' + +[[ -d ~/sites/oe7drt-website ]] \ +&& alias dr='cd ~/sites/oe7drt-website' + +alias wallpaper='ls ~/Bilder/backgrounds | fzf --preview="feh --bg-scale ~/Bilder/backgrounds/{}" | xargs -I {} feh --bg-scale ~/Bilder/backgrounds/{}' + +function dvid { + if (( $(uname -n) == "odin" ) || $(uname -n == "polaris" )); then + ffmpeg -vaapi_device /dev/dri/renderD128 -i $1 -to $2 -c copy -movflags faststart $3 + else + ffmpeg -i $1 -to $2 -c copy -movflags faststart $3 + fi +} + +# && alias hs="""hugo server -DEF --gc --cleanDestinationDir --printPathWarnings --logLevel debug --bind 0.0.0.0 --baseURL http://$(runit "/sbin/ifconfig | grep broadcast | head -1 | awk '{ print \$2 }'")""" +# && alias hs="""hugo server -DEF --gc --cleanDestinationDir --noHTTPCache --renderToMemory --disableFastRender --printPathWarnings --logLevel debug --bind 0.0.0.0 --baseURL http://$(runit "ip a | grep "/24" | head -1 | awk '{ print \$2 }' | cut -d/ -f1")""" +# && alias hs="""hugo server -DEF --gc --cleanDestinationDir --bind 0.0.0.0 --baseURL http://$(runit "ip a | grep "/24" | head -1 | awk '{ print \$2 }' | cut -d/ -f1")""" +[[ "$OS" == "linux" ]] && __is_available hugo \ +&& function runit { eval $1; } \ +&& alias hs="""hugo server -DEF --gc --cleanDestinationDir --bind 0.0.0.0 --baseURL http://$(runit "ip a | grep "/24" | head -1 | awk '{ print \$2 }' | cut -d/ -f1")""" \ +&& alias lhs="hugo server -DEF --gc --cleanDestinationDir --bind 0.0.0.0 --baseURL http://127.0.0.1" + +[[ "$OS" == "freebsd" ]] && __is_available hugo \ +&& alias hs="hugo server -DEF --gc --cleanDestinationDir --bind 0.0.0.0 --baseURL http://10.0.0.2" \ +&& alias lhs="hugo server -DEF --gc --cleanDestinationDir --bind 0.0.0.0 --baseURL http://127.0.0.1" + +__is_available blacklist \ +&& alias bl='blacklist -a' + +__is_available X \ +&& alias x=startx + +__is_available picocom \ +&& alias os='picocom -b 115200 -d 8 -y n -p 1 /dev/tty.usbmodemDADCB8841' + +__is_available yt-dlp \ +&& alias yl='yt-dlp -x --audio-format mp3 --embed-thumbnail --embed-metadata' + +__is_available eza \ +&& unalias l && unalias la \ +&& alias l='ls -1a' && alias la='ll -a' \ +&& function ls { + eza --color-scale --icons --group-directories-first $argv +} \ +&& function gls { + eza --icons --group-directories-first --git-ignore $argv +} \ +&& function gll { + eza --long --color-scale --icons --group-directories-first --git-ignore --git $argv +} + +__is_available urlwatch \ +&& function urladd { + ssh celeste urlwatch --add url=https://www.qrz.com/db/${1:u},diff_tool=/home/dominic/bin/qrzdiff.sh +} + +# && alias ols='/bin/ls' && alias oll='/bin/ls -l' \ +__is_available lsd \ +&& alias lld='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name' \ +&& alias lldg='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name' \ +&& alias lldga='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name -a' \ +&& alias lli='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,inode' \ +&& alias llg='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git' \ +&& alias llgi='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git,inode' + +__is_available exa \ +&& alias lld='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name' \ +&& alias lldg='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name' \ +&& alias lldga='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name -a' \ +&& alias lli='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,inode' \ +&& alias llg='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git' \ +&& alias llgi='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git,inode' +# && function ls { +# # list directories first and sort by version (1-$name before 10-$name) +# lsd --group-directories-first -v $argv +# } + +#&& alias aconf='git --git-dir=$HOME/.cfg/ --work-tree=$HOME' +__is_available git && [[ -d ~/.cfg ]] \ +&& function aconf { + git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ +} + +__is_available lazygit \ +&& alias lg='lazygit' + +__is_available lazygit && [[ -d ~/.cfg ]] \ +&& alias lconf='lazygit --git-dir=$HOME/.cfg/ --work-tree=$HOME' + +__is_available bat \ +&& alias bat="bat --wrap=never" +# && alias bat="bat --paging always" + +__is_available bat \ +&& alias batdiff='git diff --name-only --relative --diff-filter=d | xargs bat --diff' + +function nvid { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 1 -f null /dev/null + ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 2 ${i:t:r}-recoded.mkv + done +} + +function nvidtest { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -vaapi_device /dev/dri/renderD128 -ss 10:00 -t 10:00 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 1 -f null /dev/null + ffmpeg -vaapi_device /dev/dri/renderD128 -ss 10:00 -t 10:00 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 2 ${i:t:r}-recoded.mkv + done +} + +function mvidgif-crop { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -i "$i" -an -vf \ + "fps=8,scale=iw*2/3:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ + ${i:t:r}_masto-crop.gif + done +} + +function mvidgif { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -i "$i" -an -vf \ + "fps=8,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ + ${i:t:r}-masto.gif + done +} + +function mvid-crop { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -i "$i" -c:a aac -c:v libvpx-vp9 -vf \ + "scale=iw/2*3:-1:flags=lanczos" -crf 31 -b:v 1800k \ + -quality good -speed 0 -movflags +faststart -tune zerolatency \ + ${i:t:r}-masto-crop.webm + done +} + +function mvid { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -i "$i" -c:v libvpx-vp9 -crf 31 -b:v 1800k -quality good \ + -speed 0 -movflags +faststart ${i:t:r}-masto.webm + done +} + +function camconvert { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -y -i "$i" -vf "unsharp=5:5:1.0:5:5:0.0" -an -c:v libx264 \ + -preset slow -b:v 10000k -pass 1 -f mp4 /dev/null + ffmpeg -y -i "$i" -vf "unsharp=5:5:1.0:5:5:0.0" -an -c:v libx264 \ + -preset slow -b:v 10000k -pass 2 "${i:t:r}_small.mp4" + rm -if ffmpeg2pass-0.log* + done +} + +function svid { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + ffmpeg -y -i "$i" -x264opts opencl -c:v libx264 -crf 23 -c:a aac \ + -movflags +faststart -tune zerolatency -maxrate 2M -bufsize 2M \ + ${i:t:r}-small.mp4 + done +} + +function webvideo { + if (( # == 0 )); then + print >&2 "Usage: $0 [file(s)]" + return 1 + fi + for i; do + ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 3M -bufsize 3M -pass 1 -f null /dev/null + ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 3M -bufsize 3M -pass 2 ${i:t:r}-web.mp4 + ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libvpx-vp9 -crf 31 -b:v 1800k -quality good -speed 0 -movflags +faststart ${i:t:r}-web.webm + done +} + +function opti { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + optipng -nb -nc "$i"; + advpng -z4 "$i"; + pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB \ + -rem time -ow "$i"; + done +} + +function jopti { + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + jpegtran -copy none -optimize -progressive -outfile $i $i; + done +} + +function imgconv { + # Create 100% image crop from the center pic with half + # the size of the image + if (( # == 0 )); then + print >&2 "Usage: $0 [file]" + return 1 + fi + for i; do + convert $i -resize 50% -sampling-factor 4:2:0 -strip \ + -quality 85 -interlace JPEG -colorspace RGB ${i:t:r}@0,5.jpg; + convert $i -resize 25% -sampling-factor 4:2:0 -strip \ + -quality 85 -interlace JPEG -colorspace RGB ${i:t:r}@0,25.jpg; + done +} + +function ptgui() { + cd $HOME/bin/PTGui + ./PTGui +} + +function f { + FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' FZF_DEFAULT_OPTS="--color=bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD --color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96 --color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD --preview 'bat --style=numbers --color=always --line-range :500 {}'" fzf --height 60% --layout reverse --info inline --border --color 'border:#b48ead' $argv +} + +function mpv { + #env __NV_PRIME_RENDER_OFFLOAD=1 mpv $argv + env mpv --vo=gpu --hwdec=vaapi $argv +} + +function n { + neofetch $argv +} + +alias r='ranger' + +function yl { + yt-dlp -x --audio-format mp3 --embed-thumbnail $argv +} + +function ala { + alacritty --hold -e $argv +} diff --git a/runcoms/zlogin b/runcoms/zlogin index 2f834353..24788ee2 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -18,12 +18,20 @@ } &! # Execute code only if STDERR is bound to a TTY. -if [[ -o INTERACTIVE && -t 2 ]]; then +# if [[ -o INTERACTIVE && -t 2 ]]; then # Print a random, hopefully interesting, adage. - if (( $+commands[fortune] )); then - fortune -s - print - fi + # if (( $+commands[fortune] )); then + # fortune -s + # print + # fi + + # if (( $+commands[randomquote.pl] )); then + # randomquote.pl + # print + # fi + +# fi >&2 + +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* -fi >&2 diff --git a/runcoms/zlogout b/runcoms/zlogout index b5d9858c..b695bd48 100644 --- a/runcoms/zlogout +++ b/runcoms/zlogout @@ -6,14 +6,16 @@ # # Execute code only if STDERR is bound to a TTY. -[[ -o INTERACTIVE && -t 2 ]] && { - -SAYINGS=( - "So long and thanks for all the fish.\n -- Douglas Adams" - "Good morning! And in case I don't see ya, good afternoon, good evening and goodnight.\n --Truman Burbank" -) - -# Print a randomly-chosen message: -echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))] +# [[ -o INTERACTIVE && -t 2 ]] && { +# +# SAYINGS=( +# "So long and thanks for all the fish.\n -- Douglas Adams" +# "Good morning! And in case I don't see ya, good afternoon, good evening and goodnight.\n --Truman Burbank" +# ) +# +# # Print a randomly-chosen message: +# echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))] +# +# } >&2 -} >&2 +clear diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index f0046377..cceaaabd 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -15,6 +15,8 @@ # Color output (auto set to 'no' on dumb terminals). zstyle ':prezto:*:*' color 'yes' +# zstyle :prompt:pure:path color white + # Add additional directories to load prezto modules from # zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib @@ -25,7 +27,7 @@ zstyle ':prezto:*:*' color 'yes' # zstyle ':prezto:load' zmodule 'attr' 'stat' # Set the Zsh functions to load (man zshcontrib). -# zstyle ':prezto:load' zfunction 'zargs' 'zmv' +zstyle ':prezto:load' zfunction 'zargs' 'zmv' 'zcp' # Set the Prezto modules to load (browse modules). # The order matters. @@ -37,8 +39,12 @@ zstyle ':prezto:load' pmodule \ 'directory' \ 'spectrum' \ 'utility' \ + 'git' \ + 'gpg' \ 'completion' \ + 'syntax-highlighting' \ 'history-substring-search' \ + 'autosuggestions' \ 'prompt' # @@ -53,8 +59,11 @@ zstyle ':prezto:load' pmodule \ # # Set the entries to ignore in static '/etc/hosts' for host completion. -# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \ -# '0.0.0.0' '127.0.0.1' +zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \ + '0.0.0.0' '127.0.0.1' + +# Must not enter `rehash` or `hash -r` every time a new app is installed +zstyle ":completion:*:commands" rehash 1 # # Editor @@ -64,7 +73,8 @@ zstyle ':prezto:load' pmodule \ # zstyle ':prezto:module:editor' wordchars '*?_-.[]~&;!#$%^(){}<>' # Set the key mapping style to 'emacs' or 'vi'. -zstyle ':prezto:module:editor' key-bindings 'emacs' +# zstyle ':prezto:module:editor' key-bindings 'emacs' +zstyle ':prezto:module:editor' key-bindings 'vi' # Auto convert .... to ../.. # zstyle ':prezto:module:editor' dot-expansion 'yes' @@ -79,25 +89,34 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. # zstyle ':prezto:module:git:status:ignore' submodules 'all' +# skip all those git aliases +zstyle ':prezto:module:git:alias' skip 'yes' + +# +# Utility +# +zstyle ':prezto:module:utility:ls' dirs-first 'yes' +zstyle ':prezto:module:utility:ls' color 'yes' + # # GNU Utility # # Set the command prefix on non-GNU systems. -# zstyle ':prezto:module:gnu-utility' prefix 'g' +zstyle ':prezto:module:gnu-utility' prefix 'g' # # History # # Set the file to save the history in when an interactive shell exits. -# zstyle ':prezto:module:history' histfile "${ZDOTDIR:-$HOME}/.zsh_history" +zstyle ':prezto:module:history' histfile "${ZDOTDIR:-$HOME}/.zsh_history" # Set the maximum number of events stored in the internal history list. -# zstyle ':prezto:module:history' histsize 10000 +zstyle ':prezto:module:history' histsize 20000 # Set the maximum number of history events to save in the history file. -# zstyle ':prezto:module:history' savehist 10000 +zstyle ':prezto:module:history' savehist 20000 # # History Substring Search @@ -145,7 +164,15 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Set the prompt theme to load. # Setting it to 'random' loads a random theme. # Auto set to 'off' on dumb terminals. -zstyle ':prezto:module:prompt' theme 'sorin' +# zstyle ':prezto:module:prompt' theme 'sorin' +# zstyle ':prezto:module:prompt' theme 'pure' +# zstyle ':prezto:module:prompt' theme 'paradox' +# zstyle ':prezto:module:prompt' theme 'powerlevel10k' +zstyle :prezto:module:prompt theme off + +# Customize the 'pure' prompt a bit +zstyle ':prompt:pure:git:stash' show 'yes' +#zstyle ':prompt:pure:host' color '9' # Set the working directory prompt display length. # By default, it is set to 'short'. Set it to 'long' (without '~' expansion) @@ -196,14 +223,14 @@ zstyle ':prezto:module:prompt' theme 'sorin' # Set syntax highlighters. # By default, only the main highlighter is enabled. -# zstyle ':prezto:module:syntax-highlighting' highlighters \ -# 'main' \ -# 'brackets' \ -# 'pattern' \ -# 'line' \ -# 'cursor' \ -# 'root' -# +zstyle ':prezto:module:syntax-highlighting' highlighters \ + 'main' \ + 'brackets' \ + 'pattern' \ + 'line' \ + 'cursor' \ + 'root' + # Set syntax highlighting styles. # zstyle ':prezto:module:syntax-highlighting' styles \ # 'builtin' 'bg=blue' \ @@ -213,6 +240,8 @@ zstyle ':prezto:module:prompt' theme 'sorin' # Set syntax pattern styles. # zstyle ':prezto:module:syntax-highlighting' pattern \ # 'rm*-rf*' 'fg=white,bold,bg=red' +zstyle ':prezto:module:syntax-highlighting' pattern \ + 'rm*-rf*' 'fg=white,bold,bg=161' # # Terminal @@ -254,3 +283,10 @@ zstyle ':prezto:module:prompt' theme 'sorin' # before deleting or overwriting files. Set to 'no' to disable this safer # behavior. # zstyle ':prezto:module:utility' safe-ops 'yes' +zstyle ':prezto:module:utility' safe-ops 'no' + +# disable colors for `ls` because I replace it later with `lsd` +# grep is also broken on BSD when color=auto is set... +# zstyle ':prezto:module:utility:ls' color 'no' +# zstyle ':prezto:module:utility:grep' color 'no' + diff --git a/runcoms/zprofile b/runcoms/zprofile index d2acd311..b1f4e97f 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -9,22 +9,28 @@ # Browser # -if [[ -z "$BROWSER" && "$OSTYPE" == darwin* ]]; then - export BROWSER='open' -fi +# if [[ -z "$BROWSER" && "$OSTYPE" == darwin* ]]; then +# export BROWSER='open' +# fi # # Editors # if [[ -z "$EDITOR" ]]; then - export EDITOR='nano' + export EDITOR='nvim' fi if [[ -z "$VISUAL" ]]; then - export VISUAL='nano' + export VISUAL='nvim' fi if [[ -z "$PAGER" ]]; then - export PAGER='less' + export PAGER='less -R' +fi + +# BAT_PAGER does not work on OpenBSD right now... +# (displays nothing at all with this VARIABLE set) +if [[ -z "$BAT_PAGER" ]]; then + export BAT_PAGER='less -R' fi # @@ -32,7 +38,7 @@ fi # if [[ -z "$LANG" ]]; then - export LANG='en_US.UTF-8' + export LANG='de_AT.UTF-8' fi # @@ -49,12 +55,33 @@ typeset -gU cdpath fpath mailpath path # Set the list of directories that Zsh searches for programs. path=( + $HOME/.cargo/bin(N) + $HOME/.rvm/bin(N) + $HOME/go/bin(N) + $HOME/.local/share/gem/ruby/3.2/bin(N) + $HOME/.local/share/gem/ruby/3.0.0/bin(N) + $HOME/.yarn/bin(N) $HOME/{,s}bin(N) - /opt/{homebrew,local}/{,s}bin(N) + $HOME/.local/{,s}bin(N) /usr/local/{,s}bin(N) $path ) +[[ -d $HOME/go ]] && export GOPATH="${HOME}/go" +[[ -d ${GOPATH}/bin ]] && export GOBIN="${GOPATH}/bin" +[[ -d $HOME/.tmac ]] && export GROFF_TMAC_PATH="$HOME/.tmac" + +# OpenBSD snapshots/current... +if [[ "$OSTYPE" == openbsd* ]]; then + export PKG_PATH="http://mirror.hs-esslingen.de/pub/OpenBSD/snapshots/packages/amd64" + #export PKG_PATH="http://ftp.nluug.nl/OpenBSD/snapshots/packages/amd64" + export FETCH_CMD="/usr/local/bin/curl -L -s -q -N" + export CVSROOT="anoncvs@ftp.hostserver.de:/cvs" +fi + +# still here for reference, used to need that on KDE +# export SSH_ASKPASS='/usr/bin/ksshaskpass' + # # Less # @@ -63,9 +90,23 @@ path=( # Mouse-wheel scrolling has been disabled by -X (disable screen clearing). # Remove -X to enable it. if [[ -z "$LESS" ]]; then - export LESS='-g -i -M -R -S -w -X -z-4' + # export LESS='-R --use-color -Dd+r$Du+b$' + # export LESS='-g -i -M -R -S -w -X -z-4' + export LESS='-g -i -M -R -S -w -z-4' fi +# export MANPAGER="sh -c 'col -b -x | bat -l man -p'" +# export MANROFFOPT="-c" + +# OpenBSD grep does not want --color +# GREP_OPTS='--color=auto' # for aliases since $GREP_OPTIONS is deprecated +# GREP_COLOR='1;32' # (legacy) bright green rather than default red +# # (new) Matching text in Selected line = green, line numbers dark yellow +# GREP_COLORS="ms=${GREP_COLOR}:mc=${GREP_COLOR}:ln=33" +# alias grep='grep $GREP_OPTS' +# alias egrep='grep -E $GREP_OPTS' +# alias fgrep='LC_ALL=C grep -F $GREP_OPTS' + # Set the Less input preprocessor. # Try both `lesspipe` and `lesspipe.sh` as either might exist on a system. if [[ -z "$LESSOPEN" ]] && (( $#commands[(i)lesspipe(|.sh)] )); then diff --git a/runcoms/zshrc b/runcoms/zshrc index 039b882d..9b5c5d5d 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -11,3 +11,84 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then fi # Customize to your needs... + +# export RPROMPT='%f' + +# 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 +# source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +# fi + +unsetopt autocd +setopt clobber + +# Set SSH to use gpg-agent +# unset SSH_AGENT_PID +# if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then +# export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" +# fi + +# using this on OpenBSD for now (and FreeBSD...) +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +gpgconf --launch gpg-agent + +# new (to me) methond to check for availability of commands +# taken from mrusme dotfiles repo https://github.com/mrusme/dotfiles +export OS="$(uname | tr '[:upper:]' '[:lower:]')" + +function __is_available { + prog="${1}" + os="${2}" + forcecheck="${3}" + + if [ "${os}" != "" ] && [ "${os}" != "${OS}" ] + then + return 1 + fi + + if [ "${os}" = "" ] || [ "${os}" = "${OS}" ] + then + if [ "${forcecheck}" != "true" ] + then + case "${HOST}" in + "cbrspc7") + return 0 + ;; + "d3lt4") + return 0 + ;; + esac + fi + fi + + type "${prog}" > /dev/null + return "$?" +} + +# MPD (would not know how to check if binary exists in .zprofile +# as is would get loaded after .zshrc +__is_available mpd \ +&& export MPD_HOST='/home/dominic/.config/mpd/socket' + +# Okay I leave this for reference, I'm not sure any more what +# this actually does. I think it set a terminal title or +# something like that... +# precmd() { +# print -Pn "\e]133;A\e\\" +# } + +[[ -f ~/.zaliases ]] && source ~/.zaliases +[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local + +fpath=($HOME/.zcomp $fpath) +autoload -U promptinit; promptinit +compinit + +eval "$(starship init zsh)" +# source <(/sbin/starship init zsh --print-full-init) + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh