df? to delete everything up to & including the first
:s/&/\r/g to replace every
& with a newline
You could prefix this with either
^ to go the start of the line, or
B to go to the start of the word; use whatever is appropriate in the scenario. Be careful with automatically adding
B in a keybind or command though, because if you're on the first character of the URL it will go to the word before the URL!
This will only work on well-formed URLs, the web would not be the web if there weren't a bunch of malformed URLs floating around ;-) Specifically, URL's which omit the
? and just use
&key=value to start the first parameter seem to be common.
To fix this, you could search for either the first
?, OR the first
&, which is unfortunately a bit more typing:
<CR> is the enter key.
If you do this sort of thing often, you could map it to a key:
:nnoremap <Leader>p df?:s/&/\r/g<CR>
:nnoremap <Leader>p d/[?&]<CR>x:s/&/\r/<CR>
Or make a command out of it:
:command! SplitURL exe 'normal df?'|:s/&/\r/g