2

I can expand a vertical split screen to occupy most of the area using Ctrl+w+| Now I would like to map that shortcut to Ctrl+m. I tried the following but it failed.

nnoremap <C-m>    <C-W>|

However this does not seem to work I also tried

nnoremap <C-m>    <C-W-l>

However that fails also. Any suggestions?

1
  • 2
    For future reference about mapping debug you can have a look here the use of | in a mapping is explained.
    – statox
    Jul 20, 2016 at 7:33

1 Answer 1

6

| is the command separator, so it terminates the map. You need to escape it:

nnoremap <c-m> <c-w>\|

Or use <bar>:

nnoremap <c-m> <c-w><bar>

See :help :bar and :help map_bar.

0

Your Answer

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

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