How do you create a vim key mapping that requires numbers before the hotkey (like <G>)?

I want to create a mapping like the G hotkey that jumps to a line (e.g., to jump to line 10: 10G). How can I do that?


You can obtain that number from the v:count or v:count1 variable. See

:help v:count

For example,

:map G :<C-U>echo v:count<CR>