I have this mapping to surround a Word with jQuery id selector $("#...") and it works fine using a command:
command! JqId normal viwo^[i#^[ysiW"ysiW)i$^[E
nnoremap <Leader>jqid :JqId<CR>
But I cannot make it works only with the mapping, it inserts the $ sign, but the vim-surround commands do nothing:
nnoremap <silent> <Leader>jqid viwo^[i#^[ysiW"ysiW)i$^[E
I also tried this (for testing purposes) and it doesn't work either:
nnoremap <silent> <Leader>jqid ysiW"
Any hint? Thanks!
But I would also like to know the problem of executing the original mapping without the command (with the command it works). So I think I'm not understanding something about the basics of executing stuff through mappings.
– raul.vila Feb 20 '18 at 08:00