You can execute a command like this:

:!pwd 

However, you can execute a certain command and the console will open, where you can execute any commands you like and then exit and vim with all tabs will open. Please tell me this command.

  • one
    ^ Z and what is not suitable for returning fg ? - avp
  • @avp It is possible and did not know - I came across only the team and could not remember it. Thank! - Maxim Gusev
  • And I think that ^ Z is a command in vi (it probably works with the terminal in raw-mode, i.e. the tty driver on ^ Z, ^ C, etc. does not respond) - avp
  • Author, do you use a common history for all shells? - avp

1 answer 1

from the documentation ( :help :shell ):

: sh [ell] This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. For the shell command comes from the 'shell' option.

i.e., to launch the shell, enter the command :shell (or, for short :sh ).

  • This is the launch of a new shell, and not the exit to the previous one (from where vim was launched) - avp
  • @avp, does this create any problems? - aleksandr barakin
  • I do not (use emacs). There will be problems if he wants (unlikely) to use the variables in the shell from which he started vi - avp
  • @avp, $ export a=b; vim $ export a=b; vim , then :shell , in the shell instance that opens: $ echo $a . Received the answer: b . Did I do something wrong? - aleksandr barakin
  • With env, of course, there will be no problems. But with history will be. - avp