11

I'm currently trying to create the following mapping in my vimrc:

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

1 Answers1

14

I think your best option is to use <Space>:

nnoremap <Leader>s :split<Space>
statox
  • 49,782
  • 19
  • 148
  • 225