Prenylation plays an important role in diversifying the structure and function of secondary metabolites. Although several cyanobactin prenyltransferases have been characterized, their chemistries are mainly limited to the modification of electron-rich heteroatoms. Here we report a prenyltransferase, LimF, from Limnothrix sp. CACIAM 69d, geranylating the electron-deficient C2 atom of His imidazole. Interestingly, in addition to its native substrate, LimF also modifies diverse exotic peptides, including thioether-closed macrocycles. We have also serendipitously uncovered Tyr-O-geranylating activity as the secondary function of LimF, providing evolutional insight into the divergent repertoire of prenylated peptides produced by cyanobactin PTases. Crystallographic analysis of LimF complexed with a pentapeptide substrate and a prenyl donor analogue provides the structural basis for its His recognition and its bifunctionality. We also show the prenylation ability of LimF on various bioactive molecules containing an imidazole group, including non-amino acid small molecules, highlighting its potential as a versatile biocatalyst for chemically challenging imidazole C-geranylation. His-C2-directed modification is chemically challenging and rarely occurs in nature due to the low reactivity of this position. Now, the prenlytransferase LimF has been discovered and applied for geranylation of histidine-containing peptides and imidazole-containing small molecules, showcasing the versatility of this biocatalyst.