I'm trying to map commands that are used with the vim surround plugin. Using vim surround you can type ysiW], for example, while in normal mode and it will surround the word at the cursor with brackets. I tried doing nonoremap ;y ysiW] but it doesn't work (nothing happens).

" These work for other things
nnoremap ;li :Limelight!!<CR>
nnoremap ;ww g<C-g>
" Below doesn't work
nnoremap ;y ysiW]

Is there a reason it won't work using this syntax?

  • I can't test it right now but it's probably because vim waits for more input as your mapping shadows the y command. Does it happen with another mapping, like <leader>y?
    – Biggybi
    Commented Oct 22, 2021 at 18:19
  • With <leader> it does look like it's waiting for something. But I don't think y itself is the problem, because if I change it to another key it still doesn't work.
    – aris
    Commented Oct 22, 2021 at 18:39

1 Answer 1


This is one of the rare times you need :nmap—you need the ys map to be expanded, too, which is recursive:

nmap ;y ysiW]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.