Wiki

by yszheda

View project onGitHub

Tip 40: Organize Your Window Layouts with Tab Pages

Return to the top: <<Practical Vim>>

  • a tab page is a container that can hold a collection of windows

References

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h tabpage

How to Use Tabs

  • :lcd {path}: set the working directory locally for the current window.
  • :windo lcd {path}: set the working directory locally for all windows in the current tab page.

References

Opening and Closing Tabs

Command Effect
:tabe[dit] {filename} Open {filename} in a new tab
<C-w>T Move the current window into its own tab
:tabc[lose] Close the current tab page and all of its windows
:tabo[nly] Keep the current tab page, closing all others

Switching Between Tabs

Ex Command Normal Command Effect
:tabn[ext] {N} {N}gt Switch to tab page number {N}
:tabn[ext] gt Switch to the next tab page
:tabp[revious] gT Switch to the previous tab page

Rearranging Tabs

  • :tabmove [N]
    • :tabmove 0: the current tab page is moved to the begging
    • :tabmove: the current tab page is moved to the end
  • use mouse in gvim