Skip to main content Svelte Highlight v7.21.1

fish language preview

1. Function with arguments

function/end, set, and variable interpolation
horizon-dark
function greet
    set -l name $argv[1]
    echo "Hello, $name!"
end

greet world
atom-one-dark
function greet
    set -l name $argv[1]
    echo "Hello, $name!"
end

greet world
github-dark
function greet
    set -l name $argv[1]
    echo "Hello, $name!"
end

greet world
dracula
function greet
    set -l name $argv[1]
    echo "Hello, $name!"
end

greet world
nord
function greet
    set -l name $argv[1]
    echo "Hello, $name!"
end

greet world
github
function greet
    set -l name $argv[1]
    echo "Hello, $name!"
end

greet world

2. Conditionals and loops

if/else/end, for/in, and builtins
horizon-dark
for file in *.txt
    if test -s $file
        echo "$file is not empty"
    else
        echo "$file is empty"
    end
end
atom-one-dark
for file in *.txt
    if test -s $file
        echo "$file is not empty"
    else
        echo "$file is empty"
    end
end
github-dark
for file in *.txt
    if test -s $file
        echo "$file is not empty"
    else
        echo "$file is empty"
    end
end
dracula
for file in *.txt
    if test -s $file
        echo "$file is not empty"
    else
        echo "$file is empty"
    end
end
nord
for file in *.txt
    if test -s $file
        echo "$file is not empty"
    else
        echo "$file is empty"
    end
end
github
for file in *.txt
    if test -s $file
        echo "$file is not empty"
    else
        echo "$file is empty"
    end
end

3. Command substitution

$(...) substitution and string builtin
horizon-dark
set -l branch $(git rev-parse --abbrev-ref HEAD)
set -l count (count *.md)

string upper "$branch has $count docs"
atom-one-dark
set -l branch $(git rev-parse --abbrev-ref HEAD)
set -l count (count *.md)

string upper "$branch has $count docs"
github-dark
set -l branch $(git rev-parse --abbrev-ref HEAD)
set -l count (count *.md)

string upper "$branch has $count docs"
dracula
set -l branch $(git rev-parse --abbrev-ref HEAD)
set -l count (count *.md)

string upper "$branch has $count docs"
nord
set -l branch $(git rev-parse --abbrev-ref HEAD)
set -l count (count *.md)

string upper "$branch has $count docs"
github
set -l branch $(git rev-parse --abbrev-ref HEAD)
set -l count (count *.md)

string upper "$branch has $count docs"