Learn Useful ‘Vi/Vim’ Editor Tips and Tricks to Enhance Your Skills – Part 1

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Gabriel Cánepa

Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

11 Responses

  1. Kevin Lausen says:

    some issues…

    couldn’t get the indentation tip to work for me.
    Also the L/R indentation is the same command after hitting ctrl+v… >j

    found a typo in in the substitution tip:
    the ! bang character is in the wrong place in the second command.

    Also my vim throws errors and an enter confirmation, when trying to use it w/ pipes.
    Is there a feature in vim, that I need to enable, to get the read-in-command tip to work with pipes?

    • @Kevin,
      There is a typo in the writeup. The right way to indentate a code block is as follows:
      -To the right: Select a code block by pressing Ctrl + V and then moving the cursor up or down using the keyboard arrows. Then press j>.
      -To the left: Select a code block by pressing Ctrl + V and then moving the cursor up or down using the keyboard arrows. Then press j> or N<<, where N represents the number of lines to indentate.
      Hope it helps!

  2. Kevin Lausen says:

    I’m a bit confused about the indent Left/Right.
    A I couldn’t get either one working
    B Left & Right had the same combination <j
    Am I doing something wrong?

  3. another nice command combo for vim is:

    :w !diff % –

    it will display changes performed since last save…

  4. Yoander says:

    Open multiple windows

    Horizontal windows
    $ vim -o /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

    Vertical windows
    $ vim -O /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

    Create horizontal window
    Ctrl-w s

    Create vertical window
    Ctrl-w v

    Ctrl-w k – top window
    Ctrl-w j – bottom window
    Ctrl-w l – left window
    Ctrl-w h – right window

  5. Robert Nix says:

    You show the same command sequence for indenting and un-indenting (moving to the left) lines. The move left should be j.

  6. rahul says:

    This is just what I needed. Thank you…

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?