1

I've been unable to use surround within a global command, For example: g/^/ norm! yss" seems to do nothing or replaces the entire line by the contents of the clipboard.

This is consistent with experience reported on github (https://github.com/tpope/vim-surround/issues/161). That report includes no solution.

I'm running gvim 8.0 under Windows 10. Is anyone able to run surround within a global command? If so, what am I missing? If not, is anyone able to explain the limitation?

Update: In view of comments received, I must conclude that the problem has to do with my configuration. For the record, I've upgraded to 8.1.1 but that hasn't helped. It seems that it's only the yss commands that fail under global (and those not consistently). ds and cs appear to work. yss works very occasionally (though I've been unable to establish a repeatable circumstance). Otherwise, sometimes the contents of the clipboard are inserted, sometimes there is no change: I cannot yet predict which.

  • 6
    Instead of norm! use norm without the exclamation mark – Christian Brabandt May 24 '18 at 19:02
  • :h :norm says If the [!] is given, mappings will not be used. – Hotschke May 25 '18 at 6:57
  • @Christian: Sorry, I shouldn't have included the !. Removing it makes no difference. Are you saying the command without ! works for you? – justerman May 25 '18 at 7:17
  • 1
    @justerman Yup after removing the ! your command works on my setup. – statox May 25 '18 at 8:04
  • @justerman It cannot work for me, because I do not use surround. However it should and I see no reason, why the mapping should not work in a global context. – Christian Brabandt May 25 '18 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.