Programming Basics
  Home arrow Programming Basics arrow Intro to Vim
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PROGRAMMING BASICS

Intro to Vim
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-04-02

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    This tutorial is not written to make you a guru at Vim (vi Improved) this is written for those that have shell access and need to login in and make changes to files.

    By : postalcow

    This tutorial is not written to make you a guru at Vim (vi Improved) this is written for those that have shell access and need to login in and make changes to files.

    A little bit about VI first. VI is not what you would consider a user friendly editor. But once you become comfortable with VI you will be sending me emails saying "Cow.. You Really Know Your Pies" VI is the best thing since Fillet Mignon. At the end of this down and dirty tutorial I will give you some sites to get more information on VI.

    In this tutorial you'll be working in two modes Editing and Command.

    Editing, Self explanatory. This is the mode that will give you the ability to edit the file.

    Command, This mode is where commands are given to VI to do such things as writing, saving and quitting. If you get the urge to learn more about VI you can turn on text coloring, auto indentation, folding features and 100's of others.

    Starting VI and opening a file.

      vi somefile.php

    To start editing a file you need to enter one of the edit modes. These commands are case sensitive, 'i' is not the same as 'I'. Also, always remember <esc> takes you out of an editing mode.

    Lets dig in to basic VI

        1) To enter VI, type: vi somefile.xxx &lt;Enter&gt;
        2) To go into the insert mode type: i
        3) Enter some text. Postal I love using VI
        4) Press the &lt;esc&gt; key to leave insert mode
        5) Save the file type &lt;esc&gt; :wq  (that means write and quit)

    Moving around in VI.

    You can use your cursor keys <left> <down> <up> <right> or h j k l for left,down,up,right.

    In command mode you can use the following commands wherever your cursor is.

        x   deletes a character.

        dd  deletes the whole line the cursor is on.

        r   replaces a character

    Displaying Line numbers
        &lt;esc&gt; :set nu         Turns on line numbering

        &lt;esc&gt; :set nonu     Turns off line numbering

    Quitting VI
         :wq    Write, then quit
      
         :q     Quit (will only work if file has not been changed)
      
         :q!    Quit without saving changes to file

    That's the Basics. Here are a few advanced commands.

    Going from command mode to text mode
            i       Insert text before current character
      
            a       Append text after current character
      
            I       Begin text insertion at the beginning of a line
      
            A       Append text at end of a line
      
            o       Open a new line below current line
      
            O       Open a new line above current line

    Command mode commands
            .       Repeat last command
      
            n.      Repeat last command n number of times
      
            J       Join next line to current line
      
            u       Undo last single change
      
            U       Restore current line

    Useful Sites

    The official siteAn introduction to display editing with VIA good reference manual


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Programming Basics Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! "ebook: Exploring IBM SOA Technology & Practice

    Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success.
    FREE! Go There Now!


    NEW! Addressing software-as-a-service challenges using Tivoli security and WebSphere solutions

    Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base.
    FREE! Go There Now!


    NEW! Application Development Tools for the Mainframe Developer

    You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! Download a free trial of Lotus Quickr 8.0

    Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications.
    FREE! Go There Now!


    NEW! Download IBM Rational Developer for System z

    Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects.
    FREE! Go There Now!


    NEW! Evaluate IBM Lotus Sametime Standard V8.0

    Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Software Analyzer V7.0

    Download a free trial version of IBM Rational Software Analyzer Developer Edition V7.0 to identify bug defects earlier in the software development cycle. Rational Software Analyzer is an extensible software development solution that reduces the expense of bug-fixes by enabling static analysis code reviews and bug identification very early in the development cycle.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Functional Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications.
    FREE! Go There Now!


    NEW! Webcast: Eclipse: Empowering the universal platform

    The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now.
    FREE! Go There Now!


    NEW! Whitepaper: Delivering SOA solutions: service lifecycle management

    The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    PROGRAMMING BASICS ARTICLES

    - PHP: Hypertext Preprocessor: What is it?
    - Loops and PHP Decision Making
    - Operators, Conditionals, and PHP Decision-Ma...
    - PHP Decision-Making
    - Coding
    - Server Statistics
    - Looping in PHP
    - Cookies in PHP
    - Working with text files
    - Beginning Object Oriented Programming in PHP
    - A Tour of Decision Making Structures in PHP
    - PHP Strings Primer
    - PHP Control Structures
    - Intro to Vim
    - Reading Directorys with PHP





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek