How can I go back to the initial opened buffer after :make in vim

2

When I use make into vim, with :make it automatically jump to the first error, displaying a new buffer in the current tab if needed.

I use vim with multiple tabs, most of the time the error buffer is already opened in another tab. Because of that, using :tabn or :tabp doesn't work in my case. :b# either... And the previous buffer could be the non last edited one.

Jérôme

Posted 2012-01-04T13:48:40.657

Reputation: 173

Answers

1

There are two ways to address this:

  1. Use :make! and vim won't switch the buffer in the first place.
  2. Set switchbuf to useopen,usetab and the implicit :cf will attempt to switch to an existing window or tab displaying the buffer.

JdeBP

Posted 2012-01-04T13:48:40.657

Reputation: 23 855

switchbuf=usetab is exactly what I wanted, thanks! – Jérôme – 2012-01-04T16:23:02.267

0

You can try CTRL-o.

I use CTRL-z before make, then fg bring vim back.

kev

Posted 2012-01-04T13:48:40.657

Reputation: 9 972

I am using make inside vim – Jérôme – 2012-01-04T15:12:00.900