I am trying to write a custom command that executes the following: 'c""<Esc>P'
, namely cut visually selected text, insert ""
and paste the cut text into the quotes.
I have tried the following:
command! -range Wq <line1>,<line2> execute 'c""<Esc>P'
and some other variations of it, but none seem to work. How can I write a custom command to execute this command?
I know about vim-surround but would like to write my own functions instead of some plugins.
(Also posted here: https://stackoverflow.com/questions/75820541/vim-custom-command-to-execute-cescp, got recommended to also post on vi SE)