The Life of Larry (1995)
Cutaway gag - Larry is a contestant on this and wrongly answers "diarrhoea", after everyone laughs he says "What? Oh sorry, 'What is diarrhoea?'"
In one scene Captain Kirk, Spock, and Dr. Koi snap their fingers like the Jets while music from the musical plays in the background.
Larry and Steve watch this on TV - William Shatner's acting is parodied by having him switch into a comically exaggerated pose every second and a redshirt grumbles because he knows he's going to get killed.
Larry watches this in a cinema; because it stars Tom Hanks, he assumes it's a comedy so he laughs inappropriately when Hanks says "I have AIDS".