Shift to the right: consider the line y=x which passes through the origin. Shifted 2 places to the right means that the line now intersects the x axis at x=2 and the y-axis at -2. In other words, when x=0, y=-2, so the equation becomes y=x-2. So x➝x-2.
Vertical shift: consider the line y=x which passes through the origin. After translation it passes through y=-5 so y=x-5 or y+5=x. So y➝y+5.
Combine the translations and we get y=x➝y+5=x-2 which would be written y=x-7.
I hope the example helps.