Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Created October 1, 2016 03:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbbx6spp/fc29c22c6769372920dddfb68794a73a to your computer and use it in GitHub Desktop.
Save mbbx6spp/fc29c22c6769372920dddfb68794a73a to your computer and use it in GitHub Desktop.
First effort at writing a Nix lstlisting language definition.
\definecolor{identifiercolor}{rgb}{0.8,0.6,0.9}
\definecolor{keywordcolor}{rgb}{0.6,0.9,0.6}
\definecolor{commentcolor}{rgb}{0.8,0.8,0.9}
\definecolor{stringcolor}{rgb}{0.5,0.6,0.9}
\lstdefinelanguage{Nix}{
% Anything betweeen $ becomes LaTeX math mode
mathescape=false,
% Comments may or not include Latex commands
texcl=false,
keywords=[1]{inherit,import,if,then,else,false,true,or,rec,let,in,assert,with},
% Comments delimiters, we do turn this off for the manual
comment=[l]{\#},
% Spaces are not displayed as a special character
showstringspaces=false,
% String delimiters
morestring=[b]",
morestring=[d]'',
% Size of tabulations
tabsize=2,
% Enables ASCII chars 128 to 255
extendedchars=false,
% Case sensitivity
sensitive=true,
% Automatic breaking of long lines
breaklines=false,
% Default style for listings
basicstyle=\ttfamily,
% Position of captions is bottom
captionpos=b,
% flexible columns
columns=[l]fixed,
% Style for (listings') identifiers
identifierstyle={\ttfamily\color{identifiercolor}},
% Style for declaration keywords
keywordstyle=[1]{\ttfamily\color{keywordcolor}},
% Style for strings
stringstyle={\ttfamily\color{stringcolor}},
% Style for comments
commentstyle={\ttfamily\color{commentcolor}},
%moredelim=**[is][\ttfamily\color{red}]{/&}{&/},
}[keywords,comments,strings]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment