The easiest way to add environment variables is via :let
:
let &statusline = $HOSTNAME . '| some other stuff'
A more cumbersome method, but one that works with versions older than 0.8.1 is to use :execute
:
execute 'set' 'statusline="'.$HOSTNAME.' | some other stuff"'
To use external commands that don't produce static output you need to wait for the next release (after 0.9.1), which adds %{...}
macro that can have arbitrary expressions, e.g. %{system('hostname')}
.
If the command can be called once at startup, :let
with system()
should do.