I was trying to understand references in Nim
What have you read already? That topic is explained in many tutorials and in some videos. My explanations is located at
http://ssalewski.de/nimprogramming.html#_value_objects_and_references
That are a few pages that you may intent to read, with the last section
http://ssalewski.de/nimprogramming.html#_references_to_objects
In case you should really read that carefully, and something is still unclear, then please create an issue at https://github.com/StefanSalewski/NimProgrammingBook If that is not possible for you, then you may send me a private email too.
[EDIT]
OK, I just found the video about object references, it is very fresh still. It is the last in this list:
https://www.youtube.com/playlist?list=PLvwc2YT9MFOlPPexrsY-t7BNTdg2Vsx06
I am not sure how well it explains your questions, have not really watched it myself. I found that video series starting at https://nim-lang.org/documentation.html where many more tutorials are listed.
For your concrete questions: Nim references are managed pointers, and indeed values referenced by Nim references are allocated on the heap, with new() or the "Constructor" MyType(myField: myValue) or a dedicated constructor function like newButton(). Note that Nim does not have real constructors like C++. Function names like newButton() are just a convention, that function may initialize the object. Functions to initialize value objects located on the stack are generally called initMyType(), but again that is only a convention. Calling new() or a function with the type name like MyType(myField: myValue) is similar, but new always allocates an instance on the heap with default (binary zero) content, while a MyType() call can be used for value or reference objects, and most importantly can initialize fields. So new() is some kind of redundant, I have seen discussions about removing new() for Nim 2.0. And for your other questions, like the var keyword for procedure parameters -- well all that is explained in the various tutorials, in more detail, better wording and less errors as in this text.
Sorry for my perhaps not coincident ANSWER but I was in a rush :-)