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 2 3 4 5
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.
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.
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.
Move it one spot to the left The tab steps back one place — type :tabmove -1 and hit Enter.
Move it one spot to the right And back to the end — type :tabmove +1 and hit Enter.
Next: Open each file in its own tabpage
Next: Move the current tabpage to the end
Next: Move it one spot to the left
Next: Move it one spot to the right
Last one — goal check runs when it's done
Nice work!
Up next: Tabpage mappings from my personal Vim config.