Step 5 of 6

13. Tabpages

Reshuffling tabpages

If you want to rearrange your tabpages, use the :tabmove command.

  • :tabmove by itself will move the current tabpage to the end of the tabline
  • :tabmove -1 will move the current tabpage one space to the left
  • :tabmove +1 will move the current tabpage one space to the right

If you find yourself doing this often, you might want to add a mapping for :tabmove +1 and :tabmove -1 to your Vim configuration.

Try these in the editor. Work through the checklist below. There’s three text files here: foo.txt, bar.txt, and baz.txt. Open each of them in a new tabpage with :args foo.txt bar.txt baz.txt followed by :tab all. Then, shuffle the current tabpage around the tabline with the :tabmove command!

  1. Load the three files into the argument list This hands Vim the list of files to open — type :args foo.txt bar.txt baz.txt and hit Enter.
  2. Open each file in its own tabpage The :tab prefix turns the windows that :all would open into tabpages, and leaves you on the first — type :tab all and hit Enter.
  3. Move the current tabpage to the end Watch the first tab slide all the way to the right of the tabline — type :tabmove and hit Enter.
  4. Move it one spot to the left The tab steps back one place — type :tabmove -1 and hit Enter.
  5. Move it one spot to the right And back to the end — type :tabmove +1 and hit Enter.
Load the three files into the argument list This hands Vim the list of files to open — type :args foo.txt bar.txt baz.txt and hit Enter.

Next: Open each file in its own tabpage

Loading editor…