0

Vim's C-w o is equivalent to Emacs's ESC ESC ESC, which closes all the Vim's windows (Emacs's buffers), except the current open one.

In Emacs, with the command winner-undo and winner-redo one can easily undo and redo the ESC ESC ESC command and obtain exactly the split configuration that he had before using the command, with the cursor in the correct place. How can I do this in Vim?

  • You are trying to move from Emacs to Vim? Why? And I'm here sitting and sweating trying to use Emacs! – klaus Apr 8 at 15:44
  • In my opinion, Emacs (Spacemacs to be precise) is the best and I use it most of the time. Nevertheless, sometimes I want to use an IDE as QtCreator, Eclipse or the JetBrains products, which support vim keybindings. So I want to learn also Vim. – Nisba Apr 10 at 1:43
  • If you are just curious about key bindings, you should use Evil. I am having a hard time using Emacs because I am not using Evil, because Evil doesn't have all vim features. But since you're curious about vim bindings, not vim itself, just use Evil. Much less hassle, trust me. Otherwise, you'll have to invest much more time that you already did in Emacs, it would a circle back. – klaus Apr 10 at 1:48
2

Emacs's winner-undo and winner-redo depends on winner-mode. You can probably find some plugins similar to that in vim. But who wants that, right?

I'm going to introduce some terminology, from :h buffers:

  • A buffer is the in-memory text of a file.
  • A window is a viewport on a buffer.
  • A tab page is a collection of windows.

:h tabpage are supposed to hold onto your carefully managed splits. For example, suppose you have constructed a split configuration suited to your current project. For some reason, you need to check on some file in a full-screen view, i.e. with full width and height. You could do that with :h | and :h _ but you can't get back to your previous split configurations like winner-mode in emacs. So, instead, you open a new tab page (check ways to do that in :h tabpage) and view the buffer in the new tab page. Now, you can switch back and forth between those tab pages without disrupting your split configurations.

Of course, you can use several separate split configurations in separate tabs and switch between them, i.e. not just using tabs for zooming purposes. This was just an example.

To wrap up, you can't have undo style performance for split management in vim like Emacs's winner-mode. What you have is a workspace management setup with :h tabpage similar to Emacs's eyebrowse package.

Here is a detailed answer describing the uses and differences of buffers, windows/splits and tab pages

  • Thank you! This also reminds me of persp-mode in Emacs. It is sad that there is no equivalent of winner-mode – Nisba Apr 10 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.