On a Mac I can go to the start and end of an line in vi, when not in INSERT mode:
^
(start of line)
$
(end of line)
This is for example explained here: How do I do “end” , “home”, “page up” and “page down” in my terminal/VIM editor?
But how do I go to the beginning and end of an line in vi, when in INSERT mode?
cmd+←/→ scrolls between windows
alt+← goes backwards one word
ctrl+←/→ does nothing
shift+←/→ goes backwards/forwards one word
ctrl+cmd+←/→ goes backwards/forwards one word
fn+left/→ goes to the beginning/end of the terminal buffer
Summary of solution provided by @romainl below:
Terminal > Preferences > Settings > Keyboard > +
Key: Home, Modifier: None, Action: Send Text, \017^
Key: End, Modifier: None, Action: Send Text, \017$
I found this very neat solution, which saves a key stroke: Move to the beginning of line while in Insert mode.
ctrl+o followed by 0 (home) or $ (end) or ^ (first non-white-space character)
And here is a very elaborate answer: Traversing text in Insert mode