Linux – Switching among cli and vim and other files workflow

command linelinuxvimvimrc

I saw some kind of workflow in vim:
Vim had a file open. Then some combination of keys made vim disappear and the user was in the command line working in cli mode, then opened another file and then suddenly returned to the previously opened file exactly at the place/line he was.
It reminded me the switch among windows we do in Windows.
Does anyone know how this worflow is done in vim?

Best Answer

There are several options to do so:

  • You can use a terminal multiplexer like screen or tmux.

    In screen, for example, the shortcut Ctrl+a - a, has the same functiononality as Alt+Tab in graphical environments: switch to the last screen.

  • Or you use vim's internal function.

    Type :!command in vim's command mode. For example: :!ls -l. After the command finishes press Enter to switch back to vim.

  • There is one more option: Job conrol.

    Press Ctrl+z to stop the current process (vim). You will find yourself in a terminal. To bring the stopped process back to the foreground type fg.

For me, I prefer screen. I have an unwritten rule for myself: "Always open a screen."

Related Question