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 Hosting referral link if you planning to start your blog ($3.82/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...

14 Responses

  1. Charles Bell says:

    I am currently using version 8.0 and found that the ‘f’ for find was used for file when looking in the directory for file.

    So, I tried “%s/word//c” and it found the first instance of the “word”. The command remained on the command line, so I just hit “n” until I got to the last one and it terminated.

    I did not know either command until I read your article.

    Thank you!

    • Gabriel Cánepa says:

      Thank you for taking the time to comment. You’re welcome – readers like you are the reason why we do what we do.

  2. Charles Bell says:

    Many forget that “” is a right caret and “^” is a caret.

    This might help when referring to those particular characters.

    Thanks for the tutorial!

  3. 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!

  4. 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?

  5. another nice command combo for vim is:

    :w !diff % –

    it will display changes performed since last save…

  6. 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

  7. 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.

  8. 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. 202,035
  2. 9,267
  3. 38,621

Are you subscribed?