#!/usr/bin/fish

# Fish steps: arrow/tab completions

# Setting and clearing variables

# set a variable
set x 32
set y 'a string'

# make a variable global
set -x password pass123

# clear a variables
set -e password

# use a variable
echo x
echo "$x $y

# Fish doesn't do Bash-style curly brackets in string interpolation, so accounting for legal variable characters in strings can be a bit of a pain
echo "Value: $x_2" # won't work
echo "Value: "$x"_2"

# fish doesn't use backticks `` or $()
set z (hostname)

# Control flow

# don't use ls when iterating over files
for f in *.pwb; echo "Deleting $f"; end # ;'s stand in for newlines

# Fish supports the very cool recursive **
ls **.pwb

# Interate over numbers with seq
for i in (seq 5); echo "knock $i times"; end

# lists are jus separated by spaces
set a 1 3 5 7 9

for x in a; echo $x; end


# if statements
if test ! -d foo/bar; mkdir -p foo/bar; end

# fish now supports && and ||
# The official syntax is ;and ;or but that idealogical battle was lost
test -e bar && touch bar

# There are also while loops and switch statements, I'm not covering here

# Using fish

# Set it as your default shell
chsh 
echo 'set-option -g default-shell /usr/local/bin/fish' >~/.tmux.conf

# Set your path - example .config/fish/config.fish
set -x GOPATH $HOME/.go
set -x GOROOT (brew --prefix golang)/libexec

# Note that the fish path is a list object, no a colon-delimited string!
set -x PATH $PATH $HOME/.local/bin $GOPATH/bin $GOROOT/bin $HOME/Repos/Scripts
set -x PATH $PATH /Applications/Julia-1.6.app/Contents/Resources/julia/bin

alias nnn "nnn -e"

# Create a script with arguments by saving this to a file
#!/usr/local/bin/fish

# echo "The first argument is $argv[1]"
# echo "The second argument is $argv[2]"



