This is a common practice among users to use ⌘ + →, ⌘ + ←, ⌥ + →, ⌥ +← for traversal across a line of text at varied intervals. If you are not aware, write a line of text, and use the commands mentioned above and see the cursor travelling and hopping either to the ends, or hopping word by word.
⌘ + → : Hop to the end of the line
⌘ + ← : Hop to the start of the line
⌥ + → : Jump to the right one word at a time
⌥ +← : Jump to the left one word at a time
I always wanted the same feature of gliding with my cursor in terminal app while editing commands inside it, and always failed to find a way. But now the issue is solved, and I am here to guide you how to enable cursor traversal hotkeys in your terminal app. I use iTerm2 as my daily driver, and am explaining the steps using the same.
Open Preferences of iTerm either by navigating through the menu like a noob or just by hitting ⌘ +,
Go to Profiles → Keys → Key Mappings and hit the + button at the bottom
Click on the input button beside Keyboard Shortcut, and that is where you have to record your hotkey you want to configure.
Choose Send Escape Sequence for all the 4 hotkeys
Enter the characters to send for each of the hotkey as mentioned below.
⌘ + → : OF
⌘ + ← : OH
⌥ + → : f
⌥ +← : b
Hope this helps!