1 / 9

CSCI-1411 F undamentals o f C omputing L ab

CSCI-1411 F undamentals o f C omputing L ab. Shane Transue. Spring 2014. Introduction. Problem: Need simple editors that can be used in the Unix console (why?) Moving files back-and-forth is tedious and error-prone Other editors may do things you don’t intend What editors should we use?

cara
Download Presentation

CSCI-1411 F undamentals o f C omputing L ab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI-1411 Fundamentals of Computing Lab Shane Transue Spring 2014

  2. Introduction • Problem: Need simple editors that can be used in the Unix console (why?) • Moving files back-and-forth is tedious and error-prone • Other editors may do things you don’t intend • What editors should we use? • nano • vi • Why use simple console editors? • How do we use (nano and vi)?

  3. Editor Introduction • Editors Covered • nano • Basic console-based text editor (simple) • vi • Command-based text editor (advanced) • What are we doing? • Creating a file • Editing the file • Saving the file • Exiting the editor

  4. Why are we using Unix editors? • Edit, Compile, Run all from the command line (terminal) • Faster than always copying files • Practice! • More complex editors are easy to misuse • A .docx file will never compile using a C++ compiler (g++) • Provide an understanding for more complex editing environments (such as IDEs) • Need to understand what they are doing internally • What if a more complex editor is not doing what you want? • Part of a larger Software Engineering Ecosystem • Programmers and software engineers will understand what you are doing

  5. nano Overview • Simple Text Editor • Opening and Editing Files (txt, cpp) • Creating a new file/Editing an existing file • What you see is what you get (WYSIWYG) • Help Ctrl+G • Basic Navigation • Moving around using arrow keys and tab • Saving and Exiting • Writing out to a file • Exiting nano

  6. Using nano • Creating/Opening a file • nano test.cpp • Editing a file • Arrow Keys, Type away • Cut/Paste • Ctrl+^ (to select) • Ctrl + K (to cut), Ctrl + U (to paste) • Saving a file • Ctrl+O(type in filename and hit enter) • Exiting nano • Ctrl+X

  7. vi Overview • Command Driven Text Editor • Commands Mode • Creating/Opening Files • Navigation • Saving a file • Insert Mode • Navigation • Writing a quick C++ program

  8. Using vi • vi test.cpp • Command Mode • Default Mode • Enter Command mode with the “Esc” Key • :w filename.cpp (save to file: filename.cpp) • :q (Quit the vi editor) • Movement • H (Move left), L (right), J (down), K (up) • Insert Mode • Normal Input (like everyone is used to) • Enter Insert mode with the “i” key • Movement • Arrow Keys

  9. Reference Guides and Links • Nano Website (GNU):http://www.nano-editor.org/ • Nano Guide: http://mintaka.sdsu.edu/reu/nano.html • Intractive Vi Tutorial: http://www.openvim.com/tutorial.html • Vi Cheat Sheet:http://www.lagmonster.org/docs/vi.html

More Related