CSCI-1411 F undamentals o f C omputing L ab

9
CSCI-1411 FUNDAMENTALS OF COMPUTING LAB Shane Transue Spring 2014 1

description

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? - PowerPoint PPT Presentation

Transcript of CSCI-1411 F undamentals o f C omputing L ab

Page 1: CSCI-1411 F undamentals  o f  C omputing  L ab

1

CSCI-1411 FUNDAMENTALS OF COMPUTING LAB

Shane Transue Spring 2014

Page 2: CSCI-1411 F undamentals  o f  C omputing  L ab

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)?

Page 3: CSCI-1411 F undamentals  o f  C omputing  L ab

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

Page 4: CSCI-1411 F undamentals  o f  C omputing  L ab

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

Page 5: CSCI-1411 F undamentals  o f  C omputing  L ab

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

Page 6: CSCI-1411 F undamentals  o f  C omputing  L ab

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

Page 7: CSCI-1411 F undamentals  o f  C omputing  L ab

7

vi Overview

Command Driven Text Editor Commands Mode

Creating/Opening Files Navigation Saving a file

Insert Mode Navigation Writing a quick C++ program

Page 8: CSCI-1411 F undamentals  o f  C omputing  L ab

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

Page 9: CSCI-1411 F undamentals  o f  C omputing  L ab

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