Skip to main content
4 of 5
this makes it easier for people to find this question and answer; I've removed some superflous text otherwise I cannot save the edit

How does one include a trailing space in a mapping?

I'm currently trying to create the following mapping:

nnoremap <Leader>s :split

The :split is followed by a trailing space. This makes sense so I can enter the file name without always manually preceding it with a space. This code works in fact. However, it's not very nice from a readability perspective because it's not obvious that there's a space at the end of the mapping. It would be nice if there were a way to express the second part of the mapping as a string.

I'm not very experienced with vimscript, but I tried enclosing the second part of the mapping in double-quotes, single-quotes, and backticks, none of which result in a working mapping. Like I said, the mapping currently works as desired with the trailing space. But I would prefer a more programmer-friendly way of expressing the second part of the mapping. How can this be done?

fvgs
  • 243
  • 1
  • 9