Tab concept in VIM Editor

Why use tabs?
I would prefer using tab concept because I can use most common operations(Copy, Cut, Paste etc..) among different tabs.

Let me elaborate above sentence,
  • Let's say you have opened two files - vim file1 and vim file2
  • You have copied or yanked something through y key from file1. Now if you want to paste(p) that in file2, VIM won't allow you to do that in this case because of two different vim sessions or instances but pasting of text can be done if you open these files in two different tabs.

This post will describe most commonly used tab operations in VIM Editor.

How to open multiples files in different tabs?
  • vim -p file1 file2
Command mode operations
  • :tabnew {file} --- open specified file in a new tab
  • :tabedit {file} --- edit specified file in a new tab
  • :tabclose --- close current tab
  • :tabclose {i} ---- close i-th tab
  • :tabonly ---- close all other tabs (show only the current tab)
  • :tabs ---- list all tabs including their displayed windows
  • :tabm 0 ---- move current tab to first
  • :tabm ---- move current tab to last
  • :tabm {i} ---- move current tab to position i+1
  • :tabn ---- go to next tab
  • :tabp ---- go to previous tab
  • :tabfirst ---- go to first tab
  • :tablast ---- go to last tab
Normal mode operations


    • gt --- go to next tab
    • gT --- go to previous tab
    • {i}gt --- go to tab in position i

    Comments

    Popular posts from this blog

    MBR partitioning with 'parted' utility

    Disk Partitioning: MBR vs GPT

    Replace default splash screen in Yocto