in regards to this: How to center a lstlisting
This approach works like a charm. The only problem is that when using the caption of the lstlisting it is not centered, yet the caption of the figure is centered. But I still want to use my list of code.
Is there maybe a way to change the type of the figure caption? So that the figure caption acts as if it’s a lstlistings caption?
Or any other ideas?