Where's the auto-replace function of the keyboard I've looked in the whole parameters of my Nexus 5 (Lollipop 5.1) and I can't find the way to customize the auto-replace function.

What I want to do is simple, I want some abbreviation like asap to be automatically changed for as soon as possible, or swag to be replaced by NEVER USE THIS WORD MORON
This functionality is covered by the operation of the Personal Dictionary. Settings > Language and input > Google Keyboard > Text correction > Personal Dictionary. Select the language to which you would like to make the addition.

Finally, the '+ Add' button allows you to define a word or phrase, and, optionally a shortcut.

So for your example, Word = 'As soon as possible', shortcut = asap.