LFCS: How to Install and Use vi/vim as a Full Text Editor – Part 2

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

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. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  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...

16 Responses

  1. Andrew Krall says:

    One fun workaround with vim that I use sometimes is that if you’ve forgotten that you can’t write to the file you’re editing unless you’re root, you can use the command “:w !sudo tee %” to execute the write with sudo permissions.

    This only works if you’re in the sudo group on the machine, but it’s helped me several times when I’ve edited system files and forgotten to open the file with sudo or as root.

  2. Yeliz Ok says:

    Great guide for novices. Thanks.

  3. Williams says:

    What a wonderful and helpful page for LFCS. I’m taking the LFCS in about three days and despite all the discouraging post online about this certification, I will still take my chances. I think your tutorial is the best yet to prepare for this exam.

  4. mohammad says:

    really tnx for your great website and this awesome article about vi/m
    kindly tell me how can i gain this article part 1 ?
    it is clear from the subject of this document that is part 2 and i want part 1 , plz send me url of part 1

  5. Thomas says:

    Do I really have to learn vim ? Can I get by on this exam with just nano ?

    • @Thomas,
      You can use whatever text editor you feel most comfortable with. In this series we choose vi/m because vi is present out-of-the-box on all distros and tends to be the tool of choice for most people. That being said, feel free to use whatever editor you want during the exam, as long as you find it installed on the virtual machine that they give you, but nano should be installed as well by default.

  6. @lvin says:

    In the Command mode type “a4yy”
    It will immediately enter Insert mode, right?
    Because a – Append after the current cursor position


    • @lvin,
      It should. Did you try it yourself in practice? Please post back if the behavior is not as expected.

      • Barry Gestwicki says:

        Hi Gabriel! Thank you for this great series of articles for the LFCS! I think what @lvin may be getting at here is that one cannot yank four lines into register “a” (I’ll also highlight that a few of the steps above refer to this as a “buffer”, which is slightly inaccurate terminology) as outlined above, or really any character that has a special function within vi/vim, since said key is going to go enter “insert” mode. Rather, something like “04yy” and/or “0p” to illustrate use of register “0” might be a better example, although feel free to let me know if I’m missing something. In any case, thanks again for the great write-up, Gabriel!

        • mdebusk says:

          You both appear to have misunderstood what he wrote.

          What to type when yanking four lines to a register is a quote mark, a letter a, a numeral 4, and two letters y. Like this: “a4yy

          The author was not surrounding a4yy with quotes.

  7. Gabor says:

    I use Xubuntu 14.04 (which IS an Ubuntu derivative), but “aptitude” does not work here
    I installed vim using:
    “sudo apt-get update && sudo apt-get install vim”

    • @Gabor,
      That indicates that aptitude is not present on your system.
      If you want to use it, you can install it as follows:

      sudo apt-get install aptitude

      and then start enjoying the bounties of one of the most powerful package management systems out there ;).

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.