\newcommand{\ixm}[2][]{%
\index{#2@\texttt{#2} macro#1}%
\index{macros!#2@\texttt{#2}#1}}
To be used like this
\ixm[|(]{command}
\ixm[|)]{command}