I have this code (javascript from language option supported in listings)
\lstset{language=javascript}
\begin{lstlisting}
$('#term').terminal(function(command, terminal) {
var cmd = $.terminal.parseCommand(command);
if (cmd.name == 'echo') {
terminal.echo(cmd.rest);
} else {
terminal.error('Invalid Command');
}
});
\end{lstlisting}
and the result is this (using pdflatex):
$ ( ’#term’ ) . terminal ( function ( command , terminal ) {
var cmd = $ . terminal . parseCommand ( command ) ;
if ( cmd . name == ’echo’ ) {
terminal . echo ( cmd . rest ) ;
} else {
terminal . error ( ’Invalid Command’ ) ;
}
});
My configuration:
\lstset{
language=JavaScript,
showspaces=false,
extendedchars=false,
showstringspaces=false,
showtabs=false,
keepspaces=false,
}
How can I make it show exactly as in tex file? Without spaces (and also if possible ' isntead of ’)

\documentclassand the appropriate packages so that those trying to help don't have to recreate it. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Apr 05 '14 at 17:38