From 6879d89e884d419ea44e2b9a64d9a13e572cd130 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sun, 7 Nov 2021 03:50:04 +0100 Subject: [PATCH] config: directory configuration improvements --- .config/shell/functions | 8 +++++++- .config/shell/projects | 3 +-- .config/yay/config.json | 2 -- .local/bin/scripts/b | 7 ++++--- .local/bin/scripts/clean | 4 ++-- .local/state/gradle/gradle.properties | 2 +- .zprofile | 16 ++++++++++------ 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index 8f9ff45..baa708d 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -78,7 +78,7 @@ edshell() { esac test -f "$file" || return 2 checksum="$(md5sum "$file")" - $EDITOR $(test "$line" && echo "+normal!\ ${line}ggzx") "${file%:*}" + $EDITOR "$(test "$line" && echo "+normal! ${line}ggzx" || echo "--")" "${file%:*}" test "$checksum" != "$(md5sum $file)" && source "$HOME/.zprofile" && exec $SHELL } @@ -308,6 +308,12 @@ mvln() { ln -vsr "$2" "$1" } +# Move into XDG_DATA_HOME or so +mvx() { + mvln "$1" "${2:-$XDG_DATA_HOME}/${1#.}" +} + + # Create directory and move into it mkcd() { mkdir -p "$1" && cd "$1" diff --git a/.config/shell/projects b/.config/shell/projects index 5c318f0..7a967d2 100644 --- a/.config/shell/projects +++ b/.config/shell/projects @@ -24,10 +24,9 @@ listprojects() { } # Underline the project names -highlight() { echo "$1" } +highlight() { echo "$1"; } # Lists all projects and evaluates the given command. -alias pr=projects projects() { test "$1" = "--all" && all="$1" && shift case $1 in diff --git a/.config/yay/config.json b/.config/yay/config.json index e4fbc41..0ba1ba5 100644 --- a/.config/yay/config.json +++ b/.config/yay/config.json @@ -1,7 +1,5 @@ { "aururl": "https://aur.archlinux.org", - "buildDir": "/home/janek/.cache/yay", - "absdir": "/home/janek/.cache/yay/abs", "editor": "", "editorflags": "", "makepkgbin": "makepkg", diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index f054efb..692db8a 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -18,9 +18,10 @@ tput setaf 4 && $elevate file -E "$last" | { grep -v --color=never 'directory$' case "$($elevate file --dereference --mime "$last")" in (*inode/directory*) tput sgr0 && $(test -x "$last" || echo "sudo") ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --all "$@" | less -XF;; (*binary) - if expr "$(file "$last")" : ".*: .*compress" >/dev/null - then /usr/share/nvim/runtime/macros/less.sh "$@" - fi + case "$(file "$last")" in + (*:\ *compress*) /usr/share/nvim/runtime/macros/less.sh "$@";; + (*:\ *\ image\ data*) viu --height "$(echo $LINES/2 | bc)" "$@";; + esac tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last" ;; (*) $elevate bat --style header "$@" --pager 'less -RXF' diff --git a/.local/bin/scripts/clean b/.local/bin/scripts/clean index 8a4f824..6db96ce 100755 --- a/.local/bin/scripts/clean +++ b/.local/bin/scripts/clean @@ -4,8 +4,8 @@ typeset -A _clean_map _clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [c]=/var/cache) # Directories to always clean -_clean_folders=(~/.ant ~/.autopsy ~/.cargo ~/.electron-gyp ~/.nix-defexpr ~/.npm ~/.parallel ~/.stack ~/.yarn - ~/.lesshst) +_clean_folders=(~/.ant ~/.autopsy ~/.cargo ~/.electron-gyp ~/.gradle ~/.konan ~/.nix-defexpr ~/.npm ~/.parallel ~/.stack ~/.yarn + ~/.lesshst ~/.yarnrc) for f in ${_clean_folders[@]} diff --git a/.local/state/gradle/gradle.properties b/.local/state/gradle/gradle.properties index ba80170..4d6a2be 100644 --- a/.local/state/gradle/gradle.properties +++ b/.local/state/gradle/gradle.properties @@ -4,7 +4,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -org.gradle.jvmargs=-mx2G -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-mx2G -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/.zprofile b/.zprofile index ae77a97..59d2a4b 100644 --- a/.zprofile +++ b/.zprofile @@ -9,20 +9,23 @@ export XDG_CACHE_HOME="$HOME/.local/cache" export XDG_CONFIG_HOME="$HOME/.config" export PATH="$HOME/.local/bin/scripts:$HOME/.local/bin:$PATH:$XDG_CONFIG_HOME/emacs/bin" # adjust programs to use xdg -export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority export MNT="$XDG_RUNTIME_DIR"/mnt +export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority -export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass export GNUPGHOME="$XDG_DATA_HOME"/gnupg +export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass +export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc export KDEHOME="$XDG_STATE_HOME"/kdehome + +export WINEPREFIX="$XDG_DATA_HOME"/wine +export RLWRAP_HOME="$XDG_DATA_HOME"/rlwrap + + ## Development tools export GOPATH="$XDG_STATE_HOME"/go export CARGO_HOME="$XDG_DATA_HOME"/cargo export RUSTUP_HOME="$XDG_DATA_HOME"/rustup -export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc -export RLWRAP_HOME="$XDG_DATA_HOME"/rlwrap - export CABAL_CONFIG="$XDG_CONFIG_HOME"/cabal/config export CABAL_DIR="$XDG_CACHE_HOME"/cabal @@ -53,7 +56,8 @@ export CONFIG_SHELLS="$XDG_CONFIG_HOME/shell" # environment which nvim >/dev/null && export EDITOR='nvim' || export EDITOR='vim' export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | head -1 | cut -f2 -d' ') -ge 590 && echo --incsearch)" -export IGNOREDIRS="-x dev -x .sync -x .stfolder -x .git -x .gradle -x .idea -x out -x *build -x dist_newstyle -x generated -x cache -x node_modules -x virtualenv" +export IGNOREDIRS_PURE="-x .sync -x .stfolder -x .gradle -x dist_newstyle -x node_modules -x generated -x .cache -x *Cache -x .local/cache" +export IGNOREDIRS="-x dev -x *build -x .git -x .idea -x out -x cache -x Partitions $IGNOREDIRS_PURE" # red stderr test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}" # software config