[Skip Navigation] [CSUSB] / [CNS] / [Comp Sci & Eng Dept] / [R J Botting] / [CSci201] / vi.intro
[Text Version] [Syllabus] [Schedule] [Glossary] [Labs] [Projects] [Resources] [Grading] [Contact] [Search ]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
Labs: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10]
Wed Jan 20 16:30:27 PST 2010
Opening the PDF files on this page may require you to download Adobe Reader or an equivalent viewer (GhostScript).

Contents


    Using vi -- For Remote Editting and Masochists


      (vi): Hints for beginning vi:
    1. Before you first use vi input the following command which turns on numbering, extra display info, adds a compile and test key, and turns off magic (don't ask):
       		~dick/bin/Q cs201
    2. Always tell vi what file you want to edit when you call it.
    3. To start vi editting a file called "fig03_01.cpp" type in the following command into a terminal window:
       		vi fig03_01.cpp
    4. Before you input text -- tap the 'i' key.
    5. Use arrow keys move around and delete keys to delete input.
    6. To end inputting text -- tap the ' esc 'key (top left hand corner of keyboard).
    7. To compile -- get out of insert mode (tap esc) and tap 'q'.
    8. To save a file -- get out of insert mode (tap esc) and input ":w" and tap the Enter/Return key.
    9. To save a copy -- get out of insert mode (tap esc) and input ":w fileName" and tap the Enter/Return key. (include the extension!).
    10. To save a copy and quit vi -- get out of insert mode (tap esc) and input ":wq" and tap the Enter/Return key.
    11. To force a quit without saving changes -- get out of insert mode (tap esc) and input ":q!" and tap the Enter/Return key.
    12. Out of insert mode You have 50+ powerful commands you can use. Each key on your keyboard does something to your file. Here is a quick list of useful commands
      • 15G -- Goto line 15 -- good for finding errors in along file
      • dd -- delete current line.
      • d6d -- delete six lines.
      • dw -- delete word
      • x -- delete character (X out!)
      • yy -- copY current line -- also called "Yank".
      • y6y -- yank 6 lines.
      • yl -- yank next character
      • yw -- yank word
      • p -- paste last delete or yank.
      • xp -- delete character and put back after next character -- good for fixing "teh"!

      More on vi

      Here are some resources I have gathered over the years [ vi1.gif ] [ vi2.gif ] [ vi.archives ] [ vi_charts.pdf ] [ vi_charts.ps ] [ vi.commands ] [ vi.FAQ ] [ vi.html ] [ vi.notes.html ] [ vi.notes.mth ] [ vi.notes.txt ] [ vi.txt ]

    Abbreviations

  1. Algorithm::=A precise description of a series of steps to attain a goal, [ Algorithm ] (Wikipedia).
  2. Class::=A description of a type of object that includes data it knows and the functions that can change it.
  3. Function::programming=A selfcontained and named piece of program that knows how to do something.
  4. Gnu::="Gnu's Not Unix", a long running open source project that supplies a very popular and free C++ compiler.
  5. OOP::="Object-Oriented Programming", Current paradigm for programming.
  6. Semantics::=Rules determining the meaning of correct statements in a language.
  7. SP::="Structured Programming", a previous paradigm for programming.
  8. Syntax::=The rules determining the correctness and structure of statements in a language, grammar.
  9. Q::software="A program I wrote to make software easier to develop",
  10. TBA::="To Be Announced", something I should do.
  11. TBD::="To Be Done", something you have to do.
  12. UML::="Unified Modeling Language", industry standard design and documentation diagrams.
  13. void::C++Keyword="Indicates a function that has no return".

End