Learn VIM
  • Vim Hands-On Tutorial (Learning Vi and Vims)
  • Vim Hands-On Tutorial(Learning Vim)
    • Chapter 1: Cursor Movement
    • Chapter 2: Opening Files, Finding Content
    • Chapter 3: Modifying and Saving Files
    • Chapter 4: Some Tips
    • Chapter 5: Splitting Windows and Tabs
    • Chapter 6: Block Operations
    • Chapter 7: Vim Macros
    • Vim Modes
    • Vim Plugins
    • plugins
      • Airline & Themes
      • EasyAlign
      • Plugin Recommendations
      • NERDTree
      • surround.vim
  • Vim 实操教程(Learning Vim)
    • 第一章:光标移动
    • 第二章:打开文件、查找内容
    • 第三章:文档的修改与保存
    • 第四章:一些小技巧
    • 第五章:分屏与标签页
    • 第六章:块操作
    • 第七章:Vim 中的宏
    • Vim 的模式
    • Vim 插件
    • plugins
      • Airline & Themes
      • EasyAlign
      • 插件推荐
      • NERDTree
      • surround.vim
Powered by GitBook
On this page
  • Splitting Windows and Tabs
  • Splitting
  • Window jumping
  • Move split screen
  • Screen zoom
  • Tagged pages
  • Create a tab
  • Switch tabs
  • Close a tab.

Was this helpful?

  1. Vim Hands-On Tutorial(Learning Vim)

Chapter 5: Splitting Windows and Tabs

Splitting Windows and Tabs

You will often encounter situations where you need to edit the current document with reference to another document (scenario: translation), or copy code from another document to the current document (scenario: copying html element class names to a css document). copy code from another document to the current document (scenario: copying html element class names to a css document), this is when you need to split the screen the most.

Splitting

  • :split abbreviation :sp or Ctrl-w s split up and down.

  • :vsplit Abbreviation :vs or Ctrl-w v Split left and right.

  • :diffsplit Abbreviation :diffs Diff mode opens a split screen and can be followed by {filename}.

Window jumping

  • Ctrl-w w Activate next window.

  • Ctrl-w j Activates the next window.

  • Ctrl-w k Activate the upper window.

  • Ctrl-w h Activate left window

  • Ctrl-w l activates the right window

Move split screen

  • Ctrl-w l Moves to rightmost window

  • Ctrl-w H Moves to the leftmost side.

  • Ctrl-w K Move to the top

  • Ctrl-w J Move to the bottom

_Note: Case sensitive. Alternatively, you can move the bottom screen to the right side for a top/bottom to left/right split screen conversion. _

Screen zoom

  • Ctrl-w = Average window size

  • Ctrl-w + Increase height

  • Ctrl-w - Reduce height

  • Ctrl-w _ Maximum height

  • Ctrl-w > Increase width

  • Ctrl-w < Reduce width

  • Ctrl-w | Maximum width

Practice! Practice! Practice!

Tagged pages

Create a tab

  • :tabnew or :tabedit abbreviation :tabe opens a new tab.

  • Ctrl-w gf opens a new tab with the name of the file at the current cursor position

Note: Both :tabnew and :tabedit can be followed by a to open the specified file in a new tab. to open the specified file in a new tab, and : can be followed by a number indicating the position of the new tab in the list (starting from 0). _

Switch tabs

  • gt or :tabnext Abbreviation :tabn Next tab (last one loops to first)

  • gT or :tabprevious Abbreviation :tabp Previous tab (first one loops to last)

  • :tabrewind abbreviation :tabr or :tabfirst abbreviation :tabfir to the first one

  • :tablast abbreviation :tabl to the last tab

Close a tab.

  • :tabclose Abbreviation :tabc to close the current tab

  • :-tabc Close previous tab

  • :+tabc Close the next tab

  • :tabonly abbreviation :tabo close other tabs

PreviousChapter 4: Some TipsNextChapter 6: Block Operations

Last updated 1 year ago

Was this helpful?

The buffer mentioned in and the split-screen operation just mentioned are good for switching between a small number of files. I don't think it's convenient to have more than 3 files, but tabs are better for switching between multiple files.

The will cover block operations.

Chapter 2
next chapter