I have Fira Code with ligatures enabled as my default mono font using fontspec, but this doesn't seem to have any effect on verbatim or lstlisting environments.
Why are those contexts different, and how can I fix it to get these ligatures everywhere?
\documentclass{article}
\usepackage{fontspec}
\setmonofont[Contextuals={Alternate}]{FiraCode}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\begin{document}
\section{tt}
{\tt ->}
\section{verb}
\verb|->|
\section{verbatim}
\begin{verbatim}
->
\end{verbatim}
\section{lstlisting}
\begin{lstlisting}
->
\end{lstlisting}
\end{document}
Rendered with lualatex:


verbatim- andlstlisting-environments are made to represent code and not the effect the code would have. Therefore it is not desirable to have ligatures inside of them. – Skillmon Mar 26 '17 at 18:11Fira Codeinstead ofFiraCode? Are you sure you have the right spelling in your file? – Moriambar Mar 26 '17 at 18:14->doesn't make sense, because I won't ever use that kind of character in any programming language I know. But for example in C I use the combination->for lists. – Skillmon Mar 26 '17 at 18:27lstlistingorverbatimto not evaluate any contents you give them (except forlstlistingperforming stuff like syntax-highlighting). – Skillmon Mar 26 '17 at 18:30->(legal c syntax) not→(a syntax error) – David Carlisle Mar 26 '17 at 18:38listingsmanual which describes how to make suitable substitutions. – Andrew Swann Mar 26 '17 at 18:56\tthas been obsolete for 20+ years in LaTeX and ought not be used in documents using 2e. Unless you are still running 2.09, you shouldn't use it. (And if you are running 2.09, I think the rest of the code is probably wrong, but that's before my time.) – cfr Mar 26 '17 at 19:10