I want to write a command that works with a visual selection, so I wrote something like this:
command! -range Foo \ exec "norm \"ay" | \ echo "[" . @a . "]"
hoping that it would take the visual selection and put it into the @a register, then I could use the @a register as normal, but there's never anything in the @a register. How do I get the visual selection into a variable? It should work with block mode visual selection as well as the normal mode.