Alkynes and nitriles participate as electrophiles in numerous heterocycle synthesis reactions, being attacked by a wide variety of nucleophiles.
A) The nucleophilic-electrophilic character of propanedinitrile and alpha-aminoketones allows the preparation of pyrroles , let's see an example.

Mechanism:

B) In this second example we put into play thiourea, which reacts with alphabromonitrile yielding thiazole.

Mechanism: 
C) Intramolecular cyclization in which the alcohol acts as a nucleophile and the alkyne as an electrophile.

Mechanism:
