Adjust setup for mac compatibility

This commit is contained in:
xeruf 2025-07-09 02:27:03 +03:00
parent d8a667f9be
commit c770f37e4f
7 changed files with 37 additions and 15 deletions

View file

@ -55,7 +55,9 @@ Plug 'mhinz/vim-signify' " VCS info on the left
Plug 'tpope/vim-fugitive' " Difftool usage
Plug 'xeruf/vim-fossil'
Plug 'austintraver/vim-jrnl'
Plug 'weinshec/vim-dictcc' " TODO do not hang without internet
if has('python3')
Plug 'weinshec/vim-dictcc' " TODO do not hang without internet
endif
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
Plug 'mipmip/vim-scimark' " Edit markdown tables with sc-im
Plug 'alx741/vinfo'

View file

@ -519,9 +519,12 @@ killm() {
# Files {{{1
which exa >/dev/null &&
alias l='exa --icons --group-directories-first' &&
alias ll='l --long --git --all'
if which exa >/dev/null
then alias l='exa --group-directories-first --icons'
alias ll='l --long --git --all'
else alias l='ls -F'
alias ll='l -lAh'
fi
if which fd >/dev/null 2>&1
then
@ -656,6 +659,7 @@ function zipdiff() {
# SWAP
alias memstat='free -h | awk '"'"'NR==2 {printf "Free memory:\t %s/%s\t(%d%)\n",$7,$2,$7*100/$2} NR==3 {if($2 != "0B") printf "Used swap:\t%s/%s\t(%d%)\n",$3,$2,$2*100/$3}'"'"
# Force all swapped memory to live memory by deallocating it
stopswap() {
memstat
swap_used=$(cat /proc/meminfo | grep SwapFree | awk '{print $2}')
@ -672,6 +676,7 @@ stopswap() {
fi
}
# Extrace proxmox vma archive
extrac() {
test "$#" -lt 1 && echo "$0 <archive.vma[.lzo]>..." && return 2
for var; do

View file

@ -364,7 +364,7 @@ data:
cat "$_stackspin_cluster_cache" 2>/dev/null |
while read cluster; do stack select "$cluster"; done
test -z "$DISPLAY" && test "$XDG_VTNR" != 1 || return 0
test -z "$DISPLAY" && test "$XDG_VTNR" != 1 && ! pgrep -qx "SystemUIServer" || return 0
# The following runs only on headless machines
which kubectl >/dev/null ||

View file

@ -61,6 +61,7 @@ template "$XDG_CONFIG_HOME/MuseScore/MuseScore3.template.ini"
if command -v nvim >/dev/null 2>&1; then
echo "Updating NeoVim Plugins"
# TODO pynvim?
nvim '+PlugClean!' '+PlugUpgrade' '+PlugUpdate' '+qall'
fi

View file

@ -26,7 +26,6 @@ HYPHEN_INSENSITIVE="true" # - and _ interchangeable
COMPLETION_WAITING_DOTS="true" # Dots while waiting for completion
DISABLE_UNTRACKED_FILES_DIRTY="true" # DOn't mark untracked files as dirty - speeds up status check
# Plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
plugins=(
@ -45,9 +44,11 @@ ZSH_COMPDUMP="$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" # Cache completions
DISABLE_UPDATE_PROMPT=true
ZSH_DISABLE_COMPFIX=true
# For fresh systems
test -d "$ZSH" || source $HOME/.zshenv
source $ZSH/oh-my-zsh.sh
# Fallback for fresh systems
if test -d "$ZSH"
then source $ZSH/oh-my-zsh.sh
else source $HOME/.zshenv
fi
## Functions
@ -177,6 +178,12 @@ alias zcp='noglob zmv -C'
alias zln='noglob zmv -L'
alias zsy='noglob zmv -Ls'
test -d /opt/homebrew && eval "$(/opt/homebrew/bin/brew shellenv)"
autoload -Uz compinit
compinit
for file in $CONFIG_SHELLS/*
do source $file
done
@ -209,5 +216,4 @@ which zoxide >/dev/null &&
source_existing $HOME/.nix-profile/etc/profile.d/nix.sh
which direnv >/dev/null && eval "$(direnv hook zsh)"
true
l

View file

@ -197,7 +197,7 @@ if test "$timg"; then
fi
fi
pager="${PAGER:-'less -rF'}"
pager="${PAGER:-less -rF}"
# bat: unknown files
# batplain: files to print without header
if test "$bat" -o "$batplain"; then
@ -260,7 +260,8 @@ if test "$ls" -o $# -le $(echo "$flags" | wc -w); then
then $elevate tree -a --dirsfirst --du -h -C -L 3 $flags -- "${ls[@]:-.}"
elif which exa 2>/dev/null >&2
then $elevate exa --icons --color=always --long --group --classify --all --all --sort=modified --reverse $flags -- "${ls[@]:-.}"
else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags -- "${ls[@]:-.}"
else ls -lGhFa $flags -- "${ls[@]:-.}"
# replaced for wider compatibility: else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags -- "${ls[@]:-.}"
fi
#" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags -- "${ls[@]:-.}"
} | $pager --quit-if-one-screen

13
.zshenv
View file

@ -98,7 +98,7 @@ export EDITOR="$(
export IHP_EDITOR="$BIN/scripts/emacs-line"
export LS_OPTIONS='--color=auto --human-readable --si --group-directories-first --file-type --dereference-command-line'
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 LESS="--raw-control-chars --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | grep -o '\d\+' | head -1) -ge 590 && echo --incsearch)"
# TODO put into config file and use --exclude-from
# -x 'System Volume Information'
export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__ -x .pytest_cache"
@ -138,7 +138,7 @@ ctrl-alt-h:backward-kill-word
$($_fzf_latest && echo "shift-down:preview-half-page-down,shift-up:preview-half-page-up
alt-j:preview-half-page-down,alt-k:preview-half-page-up
alt-shift-down:preview-down,alt-shift-up:preview-up,esc:close")
" | xargs -I% echo -n "%," | head -c-1)
" | sed '/./!d' | paste -s -d, -)
#alt-r:preview(bat {}),
export FZF_HISTDIR="$XDG_STATE_HOME/fzf"
mkdir -p "$XDG_STATE_HOME/fzf"
@ -148,8 +148,15 @@ $($_fzf_latest && echo '--preview-window=60%,border-left --marker=o')"
FD_BASE="fd --hidden --color=always --no-ignore-vcs"
export FZF_DEFAULT_COMMAND="$FD_BASE --type file"
export FZF_CTRL_T_COMMAND="$FD_BASE -d 7"
# Calculate spare cores as two thirds of the efficiency cores
case "$(uname)" in
(Darwin) efficiency_cores=$(sysctl -n hw.perflevel1.physicalcpu);;
(*) efficiency_cores=$(lscpu --extended | awk '{print $7}' | sort | uniq -c | head -1 | awk '{print $1}');;
esac
export SPARE_CORES=$(expr $efficiency_cores \* 2 / 3)
## cplusplus - ctest, cmake, ninja
export SPARE_CORES=$(expr $(lscpu --extended | awk '{print $7}' | sort | uniq -c | head -1 | awk '{print $1}') \* 2 / 3)
export CMAKE_BUILD_PARALLEL_LEVEL=${SPARE_CORES}
export CTEST_PARALLEL_LEVEL=${SPARE_CORES}
export CTEST_PROGRESS_OUTPUT=1