There is already an option to do that. You can use the format feature. Read
this tutorial to know more about it.
You can use the Ctrl + R shortcut or select some text and press Ctrl + B, or + T, etc.. to make that text get that format.
Just get used to the Ctrl + B, T, S, U, O, R, K shortcuts and use them instead of * and _