I'm trying to edit my init.vim to allow quick, custom retabbing with one key. My current attempt is as follows (the replace text in the last command is a tab character inputted in insert mode):
nnoremap <C-i> :%s/\s\+$//ge<CR>:%s/ \{2,}/ /ge<CR>
vmap <C-i> :'<,'>s/\s\+$//ge<CR>:'<,'>s/ \{2,}/ /ge<CR>
The normal mode map works perfectly, but I can't figure out why the visual map doesn't. The only thing it does is report:
E488: Trailing characters
Why doesn't the visual map work the same way as the normal mode map, and is what I'm attempting impossible?