configs  Check-in [6be55bde09]

Overview
Comment:Bring zsh and fish back in sync
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6be55bde097b0244bc5f8a03034aa3efd42cd8f88b29be3278c1318920c840ca
User & Date: js 2022-11-25 22:16:50
Context
2022-11-25
22:22
cross.fish: Add classic macOS check-in: 5187dcf500 user: js tags: trunk
22:16
Bring zsh and fish back in sync check-in: 6be55bde09 user: js tags: trunk
21:46
fish: Add flveri check-in: a24c2cee51 user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fish/config.fish.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40























set -g fish_color_valid_path normal
set -g fish_color_vcs 43d696
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
test -n "$XDG_CACHE_HOME"
or set -x XDG_CACHE_HOME $HOME/.cache
test -n "$XDG_DATA_HOME"
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 CVS_RSH ssh






























|

|

|





|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
set -g fish_color_valid_path normal
set -g fish_color_vcs 43d696
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"
test -n "$XDG_CACHE_HOME"
or set -x XDG_CACHE_HOME "$HOME/.cache"
test -n "$XDG_DATA_HOME"
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 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

Changes to fish/functions/cross.fish.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
            end

            if test (count $argv) != 2 -o -z "$cross_host"
                echo 'Usage: cross amiga m68k|ppc'
                return 1
            end
        case ios iossim
            if ! type -q xcrun
                echo 'Can only cross-compile for iOS on a Mac with Xcode!'
                return 1
            end

            set -l sdk_type
            set -l default_archs
            switch $argv[1]







|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
            end

            if test (count $argv) != 2 -o -z "$cross_host"
                echo 'Usage: cross amiga m68k|ppc'
                return 1
            end
        case ios iossim
            if not type -q xcrun
                echo 'Can only cross-compile for iOS on a Mac with Xcode!'
                return 1
            end

            set -l sdk_type
            set -l default_archs
            switch $argv[1]
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
            set -l sdk (xcrun --show-sdk-path --sdk $sdk_type)
            set -l archs $argv[2..-1]

            if test (count $archs) = 0
                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

            for arch in $archs
                set -a CC -arch $arch
                set -a CXX -arch $arch
            end
            set -a CPP -arch $archs[1]
            set -a CXXPP -arch $archs[1]







|
|
|
|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
            set -l sdk (xcrun --show-sdk-path --sdk $sdk_type)
            set -l archs $argv[2..-1]

            if test (count $archs) = 0
                set archs $default_archs
            end

            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
                set -a CXX -arch $arch
            end
            set -a CPP -arch $archs[1]
            set -a CXXPP -arch $archs[1]
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
            if test -z "$prefix"
                echo 'Please install $pkg from pkgsrc!'
                return 1
            end

            set PATH $prefix/cross/$cross_host/bin $PATH
        case morphos
            set -l prefix (pkg_info -qp ppc-morphos-gcc-9 |
                           awk '/^@cwd/ { print $2; exit }')

            if test -z "$prefix"
                echo 'Please install ppc-morphos-gcc-9 from pkgsrc!'
                return 1
            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 -g cross_host ppc-morphos
        case switch
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITA64"
                echo 'Please set DEVKITA64!'
                return 1
            end

            set PATH $DEVKITA64/bin $PATH
            set -g cross_host aarch64-none-elf
            set -g objfw_configure_flags --with-switch
        case wii wii-u
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITPPC"
                echo 'Please set DEVKITPPC!'
                return 1
            end

            set PATH $DEVKITPPC/bin $PATH
            set -g cross_host powerpc-eabi
            set -g objfw_configure_flags --with-$argv[1]
        case '*'
            echo "Unknown target: $argv[1]"
            return 1
    end

    set -g objfw_configure_flags --host=$cross_host $objfw_configure_flags
end







|








|
|
|
|











|

|










|









102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
            if test -z "$prefix"
                echo 'Please install $pkg from pkgsrc!'
                return 1
            end

            set PATH $prefix/cross/$cross_host/bin $PATH
        case morphos
            set -l prefix (pkg_info -qp ppc-morphos-gcc-11 |
                           awk '/^@cwd/ { print $2; exit }')

            if test -z "$prefix"
                echo 'Please install ppc-morphos-gcc-9 from pkgsrc!'
                return 1
            end

            set PATH $prefix/gg/bin $PATH
            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"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITA64"
                echo 'Please set DEVKITA64!'
                return 1
            end

            set PATH $DEVKITA64/bin $DEVKITPRO/tools/bin $PATH
            set -g cross_host aarch64-none-elf
            set -g objfw_configure_flags --with-nintendo-switch
        case wii wii-u
            if test -z "$DEVKITPRO"
                echo 'Please set DEVKITPRO!'
                return 1
            end
            if test -z "$DEVKITPPC"
                echo 'Please set DEVKITPPC!'
                return 1
            end

            set PATH $DEVKITPPC/bin $DEVKITPRO/tools/bin $PATH
            set -g cross_host powerpc-eabi
            set -g objfw_configure_flags --with-$argv[1]
        case '*'
            echo "Unknown target: $argv[1]"
            return 1
    end

    set -g objfw_configure_flags --host=$cross_host $objfw_configure_flags
end

Changes to fish/functions/flgrep.fish.

1
2
3
4
5
6
7
8
function flgrep
    set -l ret
    fossil changes --all . | sed 's/^.*  //' | while read file
        grep -H $argv "$file" && set ret 0
        test $status -gt 1 && return $status
    end
    return $ret
end


|





1
2
3
4
5
6
7
8
function flgrep
    set -l ret
    fossil changes --all . | awk '{ print $2 }' | while read file
        grep -H $argv "$file" && set ret 0
        test $status -gt 1 && return $status
    end
    return $ret
end

Added fish/functions/power_now.fish.











>
>
>
>
>
1
2
3
4
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

Changes to fish/functions/pw.fish.

1
2
3
4
5
6
7
8
9
10
11
12
13
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
end
|
<
<
<
<
<
<
<
<
<
<
|

1










2
3
function pw --wraps pwnk










    pwnk -k ~/.cryptopassphrase.key $argv
end

Name change from fish/functions/pw.fish to fish/functions/pwnk.fish.

1
2


3
4
5
6
7
8
9
10
11
12
13
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
end
|

>
>
|








|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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

Changes to fish/functions/pws.fish.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
end
|
<
<
<
<
<
<
<
<
<
<
|
<

1










2

3
function pw --wraps pwnk










    pwnk -k ~/.cryptopassphrase-server.key $argv

end

Added fish/functions/uart.fish.



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
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

Changes to zshrc.

365
366
367
368
369
370
371
372
373
374
375
376
377
378
379

if __has_command gpg gpg2; then
	# Make sure GPG agent is running.
	gpg --card-status &>/dev/null

	local sock
	if [ -d "$XDG_RUNTIME_DIR/gnupg" ]; then
		sock=$(find $XDG_RUNTIME_DIR/gnupg -name S.gpg-agent.ssh |
		       head -1)
	fi
	[ -n "$sock" ] || sock="$GNUPGHOME/S.gpg-agent.ssh"

	alias gssh="SSH_AUTH_SOCK=$sock ssh"
	alias gssh-add="SSH_AUTH_SOCK=$sock ssh-add"
	alias gsftp="SSH_AUTH_SOCK=$sock sftp"







|







365
366
367
368
369
370
371
372
373
374
375
376
377
378
379

if __has_command gpg gpg2; then
	# Make sure GPG agent is running.
	gpg --card-status &>/dev/null

	local sock
	if [ -d "$XDG_RUNTIME_DIR/gnupg" ]; then
		sock=$(find "$XDG_RUNTIME_DIR/gnupg" -name S.gpg-agent.ssh |
		       head -1)
	fi
	[ -n "$sock" ] || sock="$GNUPGHOME/S.gpg-agent.ssh"

	alias gssh="SSH_AUTH_SOCK=$sock ssh"
	alias gssh-add="SSH_AUTH_SOCK=$sock ssh-add"
	alias gsftp="SSH_AUTH_SOCK=$sock sftp"
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
		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







|




|







563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
		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:$DEVKITPRO/tools/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