Here's a solution using lua, it doesn't offer any advantages over Peter's solution above, so I'm simply posting it for comparisons sake (and because I wanted to get some practice with lua). Compile with lualatex.
\documentclass{article}
\usepackage{luacode}
%\begin{filecontents*}{vectyfunc.lua}
\begin{luacode*}
function vecty_make (x,y,z)
local basis = {"\\hat{\\mathrm{i}}","\\hat{j}","\\hat{k}"}
local coeffs = {x,y,z}
local str = ""
local num = 0
for i = 1,3 do
coeffs[i] = string.gsub(coeffs[i]," ","")
-- if not empty
if coeffs[i]~="" then
-- and if not zero
if tonumber(coeffs[i])~=0 then
num = num + 1
-- then put a + if missing a sign
if tonumber(coeffs[i]) == 1 then coeffs[i] = "" end
if tonumber(coeffs[i]) == -1 then coeffs[i] = "-" end
if string.find(coeffs[i],"^[+-]") == nil then
coeffs[i]="+"..coeffs[i]
end
-- and append to str
str = str..coeffs[i]..basis[i]
end
end
end
if num == 0 then
tex.sprint("\\vec{0}")
else
-- remove first sign if a +
if string.sub(str,1,1) == "+" then
str = string.sub(str,2)
end
tex.sprint(str)
end
end
\end{luacode*}
%\end{filecontents*}
%\directlua{dofile("vectyfunc.lua")}
\newcommand{\vecty}[3]{
\directlua{vecty_make("#1","#2","#3")}
}
\begin{document}
\[
\begin{array}{ll}
\verb|$\vecty{1}{2}{3}$| & \vecty{1}{2}{3} \\
\verb|$\vecty{0}{3}{-3}$| & \vecty{0}{3}{-3} \\
\verb|$\vecty{0}{0}{0}$| & \vecty{0}{0}{0} \\
\verb|$\vecty{0}{0}{3}$| & \vecty{0}{0}{3} \\
\verb|$\vecty{1}{2}{0}$| & \vecty{1}{2}{0} \\
\verb|$\vecty{0}{3}{3}$| & \vecty{0}{3}{3} \\
\verb|$\vecty{3}{0}{0}$| & \vecty{3}{0}{0} \\
\verb|$\vecty{-1}{1}{0}$| & \vecty{-1}{1}{0} \\
\verb|$\vecty{- 1}{ - 1}{+ 0}$| & \vecty{- 1}{ - 1}{+ 0}\\
\verb|$\vecty{-1}{-1.0}{+2}$| & \vecty{-1}{-1.0}{+2}\\
\verb|$\vecty{-0.0}{+0}{0}$| & \vecty{-0.0}{+0}{0}\\
\verb|$\vecty{-0}{+x}{y}$| & \vecty{-0}{+x}{y}\\
\verb|$\vecty{-x}{+7}{y}$| & \vecty{-x}{+7}{y}\\
\end{array}
\]
\end{document}