1

I tried

nnoremap <c-m><c-m> <c-w>vs  ene

and

nnoremap <c-m><c-m> <c-w>vs<space>ene

but I don't get a new file, I get the same file in a new buffer.

1
  • I see this is answered here
    – cumin
    Sep 29, 2017 at 23:07

1 Answer 1

2

The command you are looking for is :vertical new or :vnew. The latter has the advantage that is easier to make a command which takes a count, e.g., :20vnew. In the following mapping,

nnoremap <c-m><c-m> :vnew<cr>

typing a count beforehand, e.g. 20<c-m><c-m> will specify the width of the new window. To ignore this count and always split evenly, you can use <c-u> to remove the line numbers which are placed in the command line after the mapping's :.

nnoremap <c-m><c-m> :<c-u>vnew<cr>

3
  • I also tried nnoremap <c-m><c-m> :vnew<CR> which seems to be working. what does the <c-u> mean?
    – cumin
    Sep 29, 2017 at 23:09
  • Indeed, see my amended answer, it just comes down to whether you want to support a count or not.
    – Mass
    Sep 29, 2017 at 23:16
  • One new problem now is that I get a vertical split when I press <CR> twice in succession in normal mode.
    – cumin
    Sep 29, 2017 at 23:56

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