I am new to vim, and I learn that you can interact with the terminal two ways while in vim. The first is to type: ! . The second is :term, when you have a terminal side by side with your source code. As soon as I press :term, my cursor is in the terminal. How do I switch back to the my source code and vice versa? The answer over here does not really help. I tried the key combinations C-W, and then :bn but it only exits terminal, then back to terminal again.
Asked
Active
Viewed 8,276 times
5
-
2You should ask vim questions here: https://vi.stackexchange.com/ – Martin York Feb 19 '19 at 00:21
-
1I'm voting to close this question as off-topic because it belongs on https://vi.stackexchange.com/ – Martin York Feb 19 '19 at 00:24
-
@MartinYork vi.stackexchange.com might be a better forum, but I don't think it's off-topic as it's a tool software developers use all the time which is clearly allowed in this forum. Just my 2 cents. :-) – John Szakmeister Feb 19 '19 at 00:39
-
Sounds like you need practice with split screen navigation. When one enters `:term`, vim defaults to a horizontal split screen. If you read through the entry, `:help :split`, and practice moving between split screens, I think you will be good to go. – Patrick Bacon Feb 19 '19 at 21:36
2 Answers
7
As :help :terminal
says, you can always exit to normal mode using <Ctrl-\><Ctrl-N>
(:help CTRL-\_CTRL-N
). Use i
to return to terminal interaction.

Amadan
- 191,408
- 23
- 240
- 301
-
Saved me a keystroke, since I have been using
– fde-capu Jul 21 '23 at 15:40until I saw this answer.
3
You can swich terminal with :shell
or :sh
and turn back to Vim with exit
. You can also use C-z
and fg
couple in same matter.