Pages

Sunday, February 14, 2016

Unix Editors

  The Vi Editor

 

The vi editor is a screen editor which is available in Unix systems. It has no means, but instead uses an order of combinations of key strokes to accomplish commands. Thus it can be known as a program that can be used to create and modify files.   

 

Starting vi

      To start using vi, at the Unix prompt type vi followed by the filename


% vi filename

In this way you can either open an already existing file or create a new file. Once you press Enter, you'll be shown with blank lines with tildes and the name and status of the file

 

 

Vi Modes

Vi has two modes. Knowing the mode you are working at a given time is essential. The two modes are


  1.  Command mode

    letters in the keyboard will be interpreted as commands. vi always starts out in command mode. To leave the insert mode you are in, hit ESC key

  2.  Insert mode 

      letters in keyboard will type or edit text. Hit i to enter this mode.

        

    Entering Text

    First change to insert mode by typing the letter i. Hit Enter at the end of each line. If you make a mistake, use Backspace key to remove the error. In case it doesn't work properly on your system, use Ctrl + h combination.

     

    Cursor Movement

     To move the cursor to another position of your file, you must be in Command mode

     


  3.  

     Basic Editing

     To issue editing commands, one should be in Command mode. Uppercase, Lowercase affects for the interpretation of the command

     




    Closing and Saving files

     When we are editing a file in vi, we are actually editing a copy of the file rather than the original

     

     

     

      The Vim Editor

     

    Vim is the contracted form of "Vi Improved". It is actually an improved version of the Vi editor distributed with most Unix systems. Vim is a free and an open source software.  

     

    Vim is designed to be used both from Command Line Interface and Graphical User Interface. The GUI mode of Vim is gvim. It has menues and toolbars for the commonly used commands. But its full functionality is achieved through the Command Line Interface.   

     

    In summary Vim can be considered as the superset of Vi. Thus everything explained in Vi is included in Vim too with some added features like : 

     

    1.   Is compatible with much wider range of OS's than Vi.

    2.   Supportive for several programming languages like Perl, pyhton, C/C++

    3.     Scan edit files inside a compressed crchive(zip, tar, gzip etc)

    4.   Ability to edit multiple files.

    5.    Can be used to edit files using network protocols like HTTP etc.

    6.   Support scripting languages like vimscript, perl, python

    7.    Includes builtin diff for comparing files  

    8.   Includes multilevel undo/redo


        

       

      Emacs  Editor 

        GNU Emacs is a free, customizable and extensible text editor. It is also portable and runs under many operating systems. The main ones are :


       A especial feature of emacs is that we can not only customize all its usage like font, color, mousage, menus, windows etc, but also we can program emacs to perform totally new things. Emacs does more than a typical editor. It is designed as a programmers' editor. Some general functionalities of emacs are :
     
    • It provides an 'edit mode' , which enables to edit the code together with the context sensitive facility

    • It allows to compile the written code within emacs 

    • Can debug the program within emacs and provides links to the source  

    • Interact directly with the language interpretor  when appropriate

    • Interact with the revision control system

    •  Manage change logs

    •  Also provide other necessities for programming like mail readers, news readers, World Wide Web, spell checkers,FTP clients etc

       

    How to install... ??

      1. First download the GNU Emacs latest version which is available as a tar file. You can use the following site. 

        https://www.gnu.org/software/emacs/

      2.  Unzip the tar file using the command 

        $ tar -zxvf emacs-24.5.tar.gz 

      3. Then open the uncompressed folder using the command 

        cd emacs-24.5

      4.        Open the INSTALL file in it using vi editor and can follow the      instructions given
        

       

      Problems Encountered.......

      • When ./configure was run an error popped proposing the remedy as to add  '--without-x'. Thus  ./configure  --without-x was typed

      • Above step in turn gave an error as libtinfo, libncurses, libterminfo, libtermcap, libcurses packages were missing and asked to install at least one of them. 

      • When tried to install above packages warning came as unable to locate packages. After google search the below solution worked for me

      sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe"
      sudo apt-get update
      sudo apt-get install libncurses5-dev
       
      •       Afterwards  mentioned procedure was carried out from ./configure  --without-x
      
      
       

       

      


     

     

     

     

     

 




No comments:

Post a Comment