1
1
Fork 0

Bring zsh and fish back in sync

This commit is contained in:
Jonathan Schleifer 2022-11-25 22:16:50 +00:00
parent 84a7f938fb
commit fe8461f4b8
9 changed files with 81 additions and 46 deletions

View file

@ -26,15 +26,38 @@ set -g fish_color_vcs_braces 29bc7d
set -g fish_normal_user js
test -n "$XDG_CONFIG_HOME"
or set -x XDG_CONFIG_HOME $HOME/.config
or set -x XDG_CONFIG_HOME "$HOME/.config"
test -n "$XDG_CACHE_HOME"
or set -x XDG_CACHE_HOME $HOME/.cache
or set -x XDG_CACHE_HOME "$HOME/.cache"
test -n "$XDG_DATA_HOME"
or set -x XDG_DATA_HOME $HOME/.local/share
or set -x XDG_DATA_HOME "$HOME/.local/share"
set -x EDITOR vim
set -x VIMINIT "source $XDG_CONFIG_HOME/vim/vimrc"
set -x LS_COLORS 'di=34:ow=44;37:tw=44;37:st=44;37:ex=31:su=7;31:sg=7;31:ln=33:or=7;33:pi=32:do=32:bd=35:cd=35:so=32:*.bz2=36:*.dmg=36:*.gz=36:*.gpg=36:*.rar=36:*.tar=36:*.tbz2=36:*.tgz=36:*.xz=36:*.zip=36:*.orig=90:*~=90'
set -x SUDO_PROMPT (printf "\033[0;31m[\033[1;31msudo -> %%U\033[0;31m]\033[0m Password for \033[1m%%p@%%H\033[0m: ")
set -x GNUPGHOME $XDG_DATA_HOME/gnupg
set -x GNUPGHOME "$XDG_DATA_HOME/gnupg"
set -x CVS_RSH ssh
if type -q gpg
# Make sure the GPG agent is running
gpg --card-status &>/dev/null
set -l sock
if test -d "$XDG_RUNTIME_DIR/gnupg"
set sock (find $XDG_RUNTIME_DIR/gnupg -name S.gpg-agent.ssh | head -1)
end
if test -z "$sock"
set sock "$GNUPGHOME/S.gpg-agent.ssh"
end
alias gssh="SSH_AUTH_SOCKET=$sock ssh"
alias gssh-add="SSH_AUTH_SOCKET=$sock ssh-add"
alias gsftp="SSH_AUTH_SOCKET=$sock sftp"
end
if test (uname -s) = Darwin
set -x MAKEFLAGS -j(math (sysctl -n machdep.cpu.thread_count)'*2')
else if type -q nproc
set -x MAKEFLAGS -j(math (nproc)'*2')
end

View file

@ -43,7 +43,7 @@ function cross --description 'Set up cross-compilation environment'
return 1
end
case ios iossim
if ! type -q xcrun
if not type -q xcrun
echo 'Can only cross-compile for iOS on a Mac with Xcode!'
return 1
end
@ -66,10 +66,10 @@ function cross --description 'Set up cross-compilation environment'
set archs $default_archs
end
set -gx CC clang --sysroot $sdk
set -gx CPP clang -E --sysroot $sdk
set -gx CXX clang++ --sysroot $sdk
set -gx CXXPP clang++ -E --sysroot $sdk
set -gx CC clang -isysroot $sdk
set -gx CPP clang -E -isysroot $sdk
set -gx CXX clang++ -isysroot $sdk
set -gx CXXPP clang++ -E -isysroot $sdk
for arch in $archs
set -a CC -arch $arch
@ -106,7 +106,7 @@ function cross --description 'Set up cross-compilation environment'
set PATH $prefix/cross/$cross_host/bin $PATH
case morphos
set -l prefix (pkg_info -qp ppc-morphos-gcc-9 |
set -l prefix (pkg_info -qp ppc-morphos-gcc-11 |
awk '/^@cwd/ { print $2; exit }')
if test -z "$prefix"
@ -115,10 +115,10 @@ function cross --description 'Set up cross-compilation environment'
end
set PATH $prefix/gg/bin $PATH
set -gx CC ppc-morphos-gcc-9
set -gx CXX ppc-morphos-g++-9
set -gx OBJC ppc-morphos-gcc-9
set -gx OBJCXX ppc-morphos-g++-9
set -gx CC ppc-morphos-gcc-11
set -gx CXX ppc-morphos-g++-11
set -gx OBJC ppc-morphos-gcc-11
set -gx OBJCXX ppc-morphos-g++-11
set -g cross_host ppc-morphos
case switch
if test -z "$DEVKITPRO"
@ -130,9 +130,9 @@ function cross --description 'Set up cross-compilation environment'
return 1
end
set PATH $DEVKITA64/bin $PATH
set PATH $DEVKITA64/bin $DEVKITPRO/tools/bin $PATH
set -g cross_host aarch64-none-elf
set -g objfw_configure_flags --with-switch
set -g objfw_configure_flags --with-nintendo-switch
case wii wii-u
if test -z "$DEVKITPRO"
echo 'Please set DEVKITPRO!'
@ -143,7 +143,7 @@ function cross --description 'Set up cross-compilation environment'
return 1
end
set PATH $DEVKITPPC/bin $PATH
set PATH $DEVKITPPC/bin $DEVKITPRO/tools/bin $PATH
set -g cross_host powerpc-eabi
set -g objfw_configure_flags --with-$argv[1]
case '*'

View file

@ -1,6 +1,6 @@
function flgrep
set -l ret
fossil changes --all . | sed 's/^.* //' | while read file
fossil changes --all . | awk '{ print $2 }' | while read file
grep -H $argv "$file" && set ret 0
test $status -gt 1 && return $status
end

View file

@ -0,0 +1,5 @@
if test -f /sys/class/power_supply/BAT0/power_now
function power_now
awk '{ print $1*10^-6 " W" }' /sys/class/power_supply/BAT0/power_now
end
end

View file

@ -1,13 +1,3 @@
function pw
set -l clipboard
if type -q pbcopy
set clipboard pbcopy
else if type -q xclip
set clipboard xclip
else
echo "No clipboard handler found!"
return 1
end
cryptopassphrase -k ~/.cryptopassphrase.key $argv | tr -d '\n' | $clipboard
function pw --wraps pwnk
pwnk -k ~/.cryptopassphrase.key $argv
end

15
fish/functions/pwnk.fish Normal file
View file

@ -0,0 +1,15 @@
function pwnk
set -l clipboard
if type -q wl-copy
set clipboard wl-copy
else if type -q pbcopy
set clipboard pbcopy
else if type -q xclip
set clipboard xclip
else
echo "No clipboard handler found!"
return 1
end
cryptopassphrase $argv | tr -d '\n' | $clipboard
end

View file

@ -1,14 +1,3 @@
function pws
set -l clipboard
if type -q pbcopy
set clipboard pbcopy
else if type -q xclip
set clipboard xclip
else
echo "No clipboard handler found!"
return 1
end
cryptopassphrase -k ~/.cryptopassphrase-server.key $argv \
| tr -d '\n' | $clipboard
function pw --wraps pwnk
pwnk -k ~/.cryptopassphrase-server.key $argv
end

13
fish/functions/uart.fish Normal file
View file

@ -0,0 +1,13 @@
switch (uname -s)
case Linux
function uart
if not set -q argv[1]
set argv[1] 115200
end
if not set -q argv[2]
set argv[2] 0
end
screen /dev/ttyUSB"$argv[2]" "$argv[1]"
end
end
end

6
zshrc
View file

@ -369,7 +369,7 @@ if __has_command gpg gpg2; then
local sock
if [ -d "$XDG_RUNTIME_DIR/gnupg" ]; then
sock=$(find $XDG_RUNTIME_DIR/gnupg -name S.gpg-agent.ssh |
sock=$(find "$XDG_RUNTIME_DIR/gnupg" -name S.gpg-agent.ssh |
head -1)
fi
[ -n "$sock" ] || sock="$GNUPGHOME/S.gpg-agent.ssh"
@ -567,12 +567,12 @@ cross() {
echo "Please set DEVKITPRO!"
return 1
fi
if [ -z $"DEVKITA64" ]; then
if [ -z "$DEVKITA64" ]; then
echo "Please set DEVKITA64!"
return 1
fi
export PATH="$DEVKITA64/bin:$PATH"
export PATH="$DEVKITA64/bin:$DEVKITPRO/tools/bin:$PATH"
export cross_host="aarch64-none-elf"
export objfw_configure_flags="--with-$1"
;;