How to open last edited file in Vim

less than 1 minute read

While googling “How to open my last edited file in Vim”, I found this excellent StackOverflow post.

It turns out that, in most Unix shells, you can suspend your current running process (Vim in this case!) using ctrl + z, putting in the background.

Then to recover the Vim session you can use fg , which is a unix command that continues a stopped job by running it in the foreground (fg) again.

Here it is in action!

  • vim random.txt to start the vim session
  • Ctrl + Z to suspend the vim session
  • $ fg to bring it back up


Tags: ,