Tutorial 1) Part 7:  Editing text files with the Vi editor


Objective:  practice typing in insert mode (hit i) and scrolling the cursor in command mode (hit escape and then the hjkl keys).

A simple text editor can be used to modify the text data in an ASCII file. The Vi or Vi IMproved (VIM) editor is commonly bundled with UNIX systems. Terminal editors have a specific set of key commands to learn, but are a powerful tool for programmers. In contrast to graphical user interfaces (GUIs) like MS Word, a terminal text editor can be used while logged on remotely to a multi-user server. A fun introduction to Vi can be found in this Zelda game.

First you will want to download the Vi system settings, or run commands file:  Files: my.vimrc  

We need to move my.vimrc from your Downloads folder to your Unix home directory:

 PC: cd /cygdrive/c/Users tab tab  use tab auto-completion after each folder to find the correct path and your username

    cd /cygdrive/c/Users/username/Downloads   once the path to Downloads is correct hit enter

Mac:  cd ~/Downloads

debug1:  pwd  make sure you moved to the Downloads folder:

/Users/rhills/Downloads


debug2:  ls -lrt make sure the file is there and hasn't changed name (-rt shows the most recent files last):

my.vimrc  

 cp my.vimrc ~/.vimrc    rename the file to begin with dot (.), making it a hidden system file in your home directory.

 ls -alrt ~    use the -a flag to show all/hidden files in your home


Now download the text file by clicking here: Files: data  


Since your terminal is already inside the Downloads directory, it is easy to move it to your home directory:

  ls -lrt  check that you downloaded the file data (Safari might add .dms to data.dms)


cp data ~/day1  using tab is another way to check that your file data exists, otherwise try to download the file again.

( Safari: cp ~/Downloads/data.dms ~/day1/data )

cd ~/day1  resume the tutorial in your working folder..

  ls  check that the data file is there.