Overview
Comment: | zshrc: Reduce indentation for case |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0fec6041e771237a805f26d54ebba0d6 |
User & Date: | js on 2022-11-25 21:30:21 |
Other Links: | manifest | tags |
Context
2022-11-25
| ||
21:36 | zshrc: Add classic macOS to cross check-in: f78c8320ff user: js tags: trunk | |
21:30 | zshrc: Reduce indentation for case check-in: 0fec6041e7 user: js tags: trunk | |
2022-11-15
| ||
22:19 | Add .fossil-settings/ignore-glob check-in: 9d6b1ab98d user: js tags: trunk | |
Changes
Modified zshrc from [db2851a231] to [4f56273104].
︙ | ︙ | |||
101 102 103 104 105 106 107 | alias ls="$ls $ls_color" fi fi [ "$ls_on_cd" = yes ] && chpwd() { ls } [ "$ls_on_init" = yes ] && ls case $TERM_PROGRAM in | | | | | | | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | alias ls="$ls $ls_color" fi fi [ "$ls_on_cd" = yes ] && chpwd() { ls } [ "$ls_on_init" = yes ] && ls case $TERM_PROGRAM in Apple_Terminal) __update_terminal_cwd() { printf '\e]7;%s\a' "file://$HOSTNAME${PWD// /%20}" } ;; *) __update_terminal_cwd() {} ;; esac set_prompt() { if [ -n "$1" ]; then local branch="%F{$color_vcs_braces}(%F{$color_vcs}$1" branch+="%F{$color_vcs_braces})" fi |
︙ | ︙ | |||
144 145 146 147 148 149 150 | branch=${branch##refs/heads/} fi set_prompt $branch } case $TERM in | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | branch=${branch##refs/heads/} fi set_prompt $branch } case $TERM in aterm|Eterm|rxvt*|uxterm*|xterm*) # Use set_title if you want to change the term title set_title() { # Without this, precmd would override it precmd() { __precmd } print -Pn "\e]0;$@\a" } unset_title() { precmd() { print -Pn "\e]0;%c · %m\a" __precmd } } unset_title ;; *) precmd() { __precmd } ;; esac extr() { for i in $@; do case $i in *.7z) 7za x $i ;; *.lha) ofarc -x $i ;; *.tar) ofarc -x $i ;; *.tbz | *.tbz2 | *.tar.bz2) bzcat $i | ofarc -ttar -x - ;; *.tgz | *.tar.gz) ofarc -x $i ;; *.txz | *.tar.xz) xzcat $i | ofarc -ttar -x - ;; *.rar) unrar x $i ;; *.zip) ofarc -x $i ;; # These have to be the last for obvious reasons *.bz2) bunzip2 $i ;; *.gz) ofarc -x $i ;; *.xz) unxz $i ;; *) echo "$i: Unknown file type" false ;; esac done } for ext in 7z lha tar tbz tbz2 tar.bz2 tgz tar.gz txz tar.xz rar zip bz2 gz xz do alias -s "$ext=extr" done __has_command vim && alias vi=vim __has_command gpg2 && alias gpg=gpg2 if [ "$(uname -s)" = "Darwin" ]; then export MAKEFLAGS="-j$(($(sysctl -n machdep.cpu.thread_count) * 2))" elif __has_command nproc; then export MAKEFLAGS="-j$(($(nproc) * 2))" fi make() { case "$PWD" in # pkgsrc needs bmake and does not like MAKEFLAGS including -j. */pkgsrc*) MAKEFLAGS= =$(__find_command bmake make) $@ ;; *) =make $@ ;; esac } __has_command tmux && alias tmux="tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf" if ! __has_command colordiff; then colordiff() { |
︙ | ︙ | |||
413 414 415 416 417 418 419 | if [ $# = 0 ]; then echo 'Usage: cross platform [architecture1] [architecture2]' \ 1>&2 return 1 fi case "$1" in | | | | | | | | | | | | | | | | | | | < | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | if [ $# = 0 ]; then echo 'Usage: cross platform [architecture1] [architecture2]' \ 1>&2 return 1 fi case "$1" in 3ds | nds) if [ -z "$DEVKITPRO" ]; then echo "Please set DEVKITPRO!" 1>&2 return 1 fi if [ -z "$DEVKITARM" ]; then echo "Please set DEVKITARM!" 1>&2 return 1 fi export PATH="$DEVKITARM/bin:$PATH" export cross_host="arm-none-eabi" export objfw_configure_flags="--with-$1" ;; amiga) case "$2" in m68k) if [ -z "$amiga_gcc_path" ]; then echo -n "Please set amiga_gcc_path!" 1>&2 return 1 fi export PATH="$amiga_gcc_path/bin:$PATH" export cross_host="m68k-amigaos" ;; ppc) if [ -z "$adtools_path" ]; then echo -n "Please set adtools_path!" 1>&2 return 1 fi export PATH="$adtools_path/bin:$PATH" export cross_host="ppc-amigaos" ;; esac if [ $# != 2 -o -z "$cross_host" ]; then echo "Usage: cross amiga m68k|ppc" 1>&2 return 1 fi ;; ios | iossim) if ! __has_command xcrun; then echo -n "Can only cross-compile for iOS " 1>&2 echo "on a Mac with Xcode!" 1>&2 return 1 fi case "$1" in ios) local sdk_type=iphoneos local default_archs="arm64" ;; iossim) local sdk_type=iphonesimulator local default_archs="x86_64" ;; esac local sdk="$(xcrun --show-sdk-path --sdk $sdk_type)" local archs="${@:2}" if [ ${(w)#archs} = 0 ]; then archs="$default_archs" fi export CC="clang -isysroot $sdk" export CPP="clang -E -isysroot $sdk" export CXX="clang++ -isysroot $sdk" export CXXPP="clang++ -E -isysroot $sdk" for arch in $=archs; do export CC="$CC -arch $arch" export CXX="$CXX -arch $arch" done export CPP="$CPP -arch $archs[(w)1]" export CXXPP="$CXXPP -arch $archs[(w)1]" export OBJC="$CC" export OBJCPP="$CPP" export OBJCXX="$CXX" export OBJCPPXX="$CXXPP" export IPHONEOS_DEPLOYMENT_TARGET="10.0" export cross_host="$archs[(w)1]-apple-darwin" ;; mingw) case "$2" in i686 | x86_64) local pkg="mingw-w64-$2-gcc" export cross_host="$2-w64-mingw32" ;; esac if [ $# != 2 -o -z "$cross_host" ]; then echo "Usage: cross mingw i686|x86_64" 1>&2 return 1 fi local prefix="$(pkg_info -qp $pkg 2>/dev/null | awk '/^@cwd/ { print $2; exit }')" if [ -z "$prefix" ]; then echo "Please install $pkg from pkgsrc!" 1>&2 return 1 fi export PATH="$prefix/cross/$cross_host/bin:$PATH" ;; morphos) local pkg="ppc-morphos-gcc-11" local prefix="$(pkg_info -qp $pkg 2>/dev/null | awk '/^@cwd/ { print $2; exit }')" if [ -z "$prefix" ]; then echo "Please install $pkg from pkgsrc!" 1>&2 return 1 fi export PATH="$prefix/gg/bin:$PATH" export CC="ppc-morphos-gcc-11" export CXX="ppc-morphos-g++-11" export OBJC="$CC" export OBJCXX="$CXX" export cross_host="ppc-morphos" ;; switch) if [ -z "$DEVKITPRO" ]; then echo "Please set DEVKITPRO!" return 1 fi if [ -z $"DEVKITA64" ]; then echo "Please set DEVKITA64!" return 1 fi export PATH="$DEVKITA64/bin:$PATH" export cross_host="aarch64-none-elf" export objfw_configure_flags="--with-$1" ;; wii | wii-u) if [ -z "$DEVKITPRO" ]; then echo "Please set DEVKITPRO!" return 1 fi if [ -z "$DEVKITPPC" ]; then echo "Please set DEVKITPPC!" return 1 fi export PATH="$DEVKITPPC/bin:$DEVKITPRO/tools/bin:$PATH" export cross_host="powerpc-eabi" export objfw_configure_flags="--with-$1" ;; *) echo "Unknown target: $1" 1>&2 return 1 ;; esac export objfw_configure_flags=( --host=$cross_host $=objfw_configure_flags ) } unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init unset HISTFILE |