nnoremap <leader>rt :term<cr> <C-\><C-n> :resize 10<cr> i

I've tested the remap manually, it works as expected. A terminal window spawns I go into terminal normal mode, resize it to 10 lines of height. Then return to terminal insert mode.


1 Answer 1


Generally speaking, whatever you type in the right hand side is going to be replayed. That includes spaces. And you have, by my count, three unneeded spaces.

Your command also failed for me. Then I cleaned it up...

nnoremap <leader>rt :term<cr><C-\><C-n>:resize 10<cr>i

...and it works exactly as intended

  • i see, I never realized that the spaces matter. Although I should have tbh.
    – YJH16120
    Apr 5, 2021 at 23:48
  • I wouldn't call it an obvious fact. You're definitely not the first to make such a mistake. :)
    – B Layer
    Apr 5, 2021 at 23:50

Your Answer

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

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