1
1
Fork 0

Remove useless config subdirectory

This commit is contained in:
Jonathan Schleifer 2020-02-20 22:07:34 +00:00
parent ed4a20897f
commit 26811f58ef
29 changed files with 3 additions and 3 deletions

66
fish/functions/cd.fish Normal file
View file

@ -0,0 +1,66 @@
#
# Wrap the builtin cd command to maintain directory history.
#
function cd --description "Change directory"
set -l MAX_DIR_HIST 25
if test (count $argv) -gt (test "$argv[1]" = "--" && echo 2 || echo 1)
printf "%s\n" (_ "Too many args for cd command")
return 1
end
# Skip history in subshells.
if status --is-command-substitution
builtin cd $argv
return $status
end
# Avoid set completions.
set -l previous $PWD
if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
end
# allow explicit "cd ." if the mount-point became stale in the meantime
if test "$argv" = "."
cd "$PWD"
return $status
end
builtin cd $argv
set -l cd_status $status
if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
# If dirprev, dirnext, __fish_cd_direction
# are set as universal variables, honor their scope.
set -U -q dirprev
and set -U -a dirprev $previous
or set -g -a dirprev $previous
set -U -q dirnext
and set -U -e dirnext
or set -e dirnext
set -U -q __fish_cd_direction
and set -U __fish_cd_direction prev
or set -g __fish_cd_direction prev
end
if test $cd_status -eq 0
ls
end
return $cd_status
end

133
fish/functions/cross.fish Normal file
View file

@ -0,0 +1,133 @@
function cross --description 'Set up cross-compilation environment'
if test (count $argv) = 0
echo 'Usage: cross platform [architecture1] [architecture2]'
return 1
end
switch $argv[1]
case 3ds nds
if test -z "$DEVKITPRO"
echo 'Please set DEVKITPRO!'
end
if test -z "$DEVKITARM"
echo 'Please set DEVKITARM!'
end
set PATH $DEVKITARM/bin $PATH
set -g cross_host arm-none-eabi
set -g objfw_configure_flags --with-$argv[1]
case amiga
if test (count $argv) != 2
echo 'Usage: cross amiga m68k|ppc'
return 1
end
switch $argv[2]
case m68k
if test -z "$amiga_gcc_path"
echo 'Please set amiga_gcc_path!'
return 1
end
set PATH $amiga_gcc_path/bin $PATH
set -g cross_host m68k-amigaos
case ppc
if test -z "$adtools_path"
echo 'Please set adtools_path!'
return 1
end
set PATH $adtools_path/bin $PATH
set -g cross_host ppc-amigaos
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]
case ios
set sdk_type iphoneos
set default_archs arm64
case iossim
set sdk_type iphonesimulator
set default_archs x86_64
end
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]
set -gx OBJC $CC
set -gx OBJCPP $CPP
set -gx OBJCXX $CXX
set -gx OBJCPPXX $CXXPP
set -gx IPHONEOS_DEPLOYMENT_TARGET 10.0
set -g cross_host $archs[1]-apple-darwin
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!'
end
if test -z "$DEVKITA64"
echo 'Please set DEVKITA64!'
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!'
end
if test -z "$DEVKITPPC"
echo 'Please set DEVKITPPC!'
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

4
fish/functions/eps.fish Normal file
View file

@ -0,0 +1,4 @@
function eps --description 'Expand, print and set variable $e'
set -g e $argv
echo $e
end

View file

@ -0,0 +1,7 @@
function fgrep
if type -q ggrep
command ggrep -F --color=auto $argv
else
command fgrep --color=auto $argv
end
end

View file

@ -0,0 +1,22 @@
function fish_prompt --description 'Write out the prompt'
set -l suffix
switch "$USER"
case root toor
set suffix (set_color $fish_color_cwd_root)'#'
case '*'
set suffix '>'
end
set -l branch (git symbolic-ref HEAD 2>/dev/null)
set branch (string replace -r "^refs/heads/" "" $branch)
set -l vcs
if test -n "$branch" -a "$branch" != "master"
set vcs (set_color $fish_color_vcs_braces)"(" \
(set_color $fish_color_vcs)"$branch" \
(set_color $fish_color_vcs_braces)")"
end
echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
(set_color $fish_color_cwd) (prompt_pwd) (string join '' $vcs) \
(set_color $fish_color_suffix) $suffix (set_color normal) ' '
end

View file

@ -0,0 +1,15 @@
function fish_right_prompt
set -l code $status
set -l jobs (jobs | wc -l)
set -l prompt
test $jobs -gt 0
and set -a prompt (set_color $fish_color_jobs)$jobs
test $code -gt 0
and set -a prompt (set_color $fish_color_status)$code
echo $prompt
set_color normal
end

View file

@ -0,0 +1,3 @@
function fish_title
echo (status current-command) · (prompt_pwd) · (prompt_hostname)
end

View file

@ -0,0 +1,4 @@
function gpg-sftp
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
sftp $argv
end

View file

@ -0,0 +1,4 @@
function gpg-ssh-add
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
ssh-add $argv
end

View file

@ -0,0 +1,4 @@
function gpg-ssh
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
ssh $argv
end

7
fish/functions/grep.fish Normal file
View file

@ -0,0 +1,7 @@
function grep
if type -q ggrep
command ggrep --color=auto $argv
else
command grep --color=auto $argv
end
end

3
fish/functions/ixio.fish Normal file
View file

@ -0,0 +1,3 @@
function ixio
curl -F 'f:1=<-' ix.io
end

7
fish/functions/ls.fish Normal file
View file

@ -0,0 +1,7 @@
function ls --description 'List contents of directory'
if type -q gls
command gls --color=auto $argv
else
command ls --color=auto $argv
end
end

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

@ -0,0 +1,15 @@
# Automatically use bmake instead of make when using pkgsrc, if necessary
function make
if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD
# pkgsrc does not like MAKEFLAGS including -j
set -lx MAKEFLAGS
if type -q bmake
command bmake $argv
else
command make $argv
end
else
command make $argv
end
end

5
fish/functions/mpv.fish Normal file
View file

@ -0,0 +1,5 @@
# To work around mpv not liking locales that use , as a decimal separator
function mpv
set -lx LC_ALL C
command mpv $argv
end

View file

@ -0,0 +1,4 @@
function pkg_chk
set -lx MAKEFLAGS
command pkg_chk $argv
end

View file

@ -0,0 +1,4 @@
function pkg_rolling-replace
set -lx MAKEFLAGS
command pkg_rolling-replace $argv
end

View file

@ -0,0 +1,19 @@
function prompt_pwd --description 'Print the current working directory'
set -l options 'h/help'
argparse -n prompt_pwd --max-args=0 $options -- $argv
or return
if set -q _flag_help
__fish_print_help prompt_pwd
return 0
end
# Replace $HOME with "~"
set realhome ~
set -l tmp (basename (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD))
test $PWD = "/$tmp"
and set tmp $PWD
echo $tmp
end

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

@ -0,0 +1,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 ~/.scrypt-pwgen.key $argv | tr -d '\n' | $clipboard
end

14
fish/functions/pws.fish Normal file
View file

@ -0,0 +1,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 ~/.scrypt-pwgen-server.key $argv \
| tr -d '\n' | $clipboard
end

9
fish/functions/run.fish Normal file
View file

@ -0,0 +1,9 @@
function run
if test (count $argv) = 0
echo "Usage: run command"
return 1
end
$argv &
disown
end

View file

@ -0,0 +1,5 @@
# pkgsrc does not like MAKEFLAGS being set
function url2pkg
set -lx MAKEFLAGS
command url2pkg $argv
end