How to add a placeholder to a form element using a twig template override
Altering forms in Drupal 8 is the same as in Drupal 7 - you have:


hook_form_alter()


  Perform alterations before a form is rendered.

hook_form_FORM_ID_alter()


  Provide a form-specific alteration instead of the global hook_form_alter().



Always use an alter/preprocess hook to change variables before they get to the template file, it's bad practice to change them once you're in the template file itself.