Q:

Ctrl + U deletes whole line regardless of cursor position

I am learning terminal tips. In this tutorial, the guy says that Ctrl + U deletes everything from the cursor until the end of line. In my case, it always deletes the whole line. I am using zsh on macOS. 

A:

First map the key binding by typing bindkey \^U backward-kill-line. Then test to see if this worked. If it works, make it permanent by adding the same line to an appropriate zsh RC file.
echo 'bindkey \^U backward-kill-line' >> ~/.zshrc

