Presentation is loading. Please wait.

Presentation is loading. Please wait.

You do want to create and edit programs?

Similar presentations


Presentation on theme: "You do want to create and edit programs?"— Presentation transcript:

1 You do want to create and edit programs?
UNIX/LINUX Editors You do want to create and edit programs? Copyright © 2017 – Curt Hill

2 Introduction We will not use a nice GUI IDE in dealing with LINUX
Such do exist but we will not use them Instead we use an editor that can use the console interface This presentation looks at some of these Copyright © 2017 – Curt Hill

3 Profusion The UNIX philosophy is that any piece of software could be incrementally improved or substantially changed This has led to all manner of variations of editors Some of these have come to replace their predecessors Or installed under their own name with an alias of what they replaced Copyright © 2017 – Curt Hill

4 Editors There are many available Vi EMACS PICO JOE
Here are some of the most popular Vi VIM EMACS PICO Nano JOE Copyright © 2017 – Curt Hill

5 Types of Editors There are general types of editors
Modal and modeless A modal editor has modes In each mode there are only certain actions that can be done Often one for commands, one for typing A modal editor usually has a special type of command structure that everything can be done from one screen Copyright © 2017 – Curt Hill

6 Vi Originally created by Bill Joy in about 1976
Loosely based on the ATT ed editor Attempted to make the dumb glass teletypes of the day do something akin to full screen editing Bill Joy used a Lear Siegler ADM 3a See the display case Probably the most popular editor for UNIX Certainly so prior to EMACS Copyright © 2017 – Curt Hill

7 Modes Vi has two modes Insert mode allows characters to be typed in
Insert mode and Normal mode Insert mode allows characters to be typed in The initial creation of text is necessarily in insert mode Normal mode allows the entry of numerous commands Typing an i in normal mode puts in insert mode An Escape in insert returns to normal Copyright © 2017 – Curt Hill

8 Insert Mode At the bottom of the screen you should be able to see the word insert The backspace deletes Normal typing is inserted into the document Escape leaves Copyright © 2017 – Curt Hill

9 Picture Copyright © 2017 – Curt Hill

10 Normal Enter this mode with an escape from insert mode
Most commands are one or two letters Cursor motion j - move down k – move up h – move left l – move right Copyright © 2017 – Curt Hill

11 File Commands Start with a : :r filename – Reads a file
:w – Saves the file :w newfilename – Save as another name :x – Exits Vi. Saves file :q – Quits Vi without a save Copyright © 2017 – Curt Hill

12 VIM Vi IMproved Mostly similar to Vi Does allow our cursor keys
Allows syntax highlighting for some languages Default Vi for Ubuntu Copyright © 2017 – Curt Hill

13 EMACS Another very popular editor for the UNIX
Also ported to most platforms including Windows Dates to about 1976 at the MIT AI lab Two important contributors are Guy Steele and Richard Stallman An extraordinarily flexible editor Our cursor keys will allow movement Include PgUp, PgDn and Home Written in a dialect of LISP Copyright © 2017 – Curt Hill

14 Control Codes Like many modeless editors it uses a series of control codes File ^x^s – save current file ^x^c – exit EMACS Search ^s – forward ^r – backward Moves as you type Escape leaves search mode Copyright © 2017 – Curt Hill

15 Picture Copyright © 2017 – Curt Hill

16 A Little LISP Please (defun calc-do-quick-calc (&optional insert)
(require 'calc-ext) (calc-check-defines) (if (eq major-mode 'calc-mode) (calc-algebraic-entry t) (let (buf shortbuf) (save-excursion (calc-create-buffer) (let* ((calc-command-flags nil) (calc-dollar-values calc-quick-prev-results) (calc-dollar-used 0) (enable-recursive-minibuffers t) (calc-language (if (memq calc-language '(nil big)) 'flat calc-language)) Copyright © 2017 – Curt Hill

17 Digression on Languages
The previous page was either the worst or best programming language It is all a matter of opinion LISP is functional language Most common AI language Copyright © 2017 – Curt Hill

18 Pico Originally the text editor for the Pine email system
A simple modeless editor It uses control codes to move the cursor and all the other actions Nano is a derivative Next is a nano screen Copyright © 2017 – Curt Hill

19 Some Codes Cursor control Control ^f – forward ^b – backward
^n – next line ^p – previous line Control ^o – save file ^x – exit Copyright © 2017 – Curt Hill

20 Picture Copyright © 2017 – Curt Hill

21 Installation By default Vi (or VIM) and Nano (variant of Pico) are installed If you attempt to use EMACS or Joe it will ask you to install these with: sudo apt install joe It will then attempt to do the install This only works on packages that it knows about but are not installed Copyright © 2017 – Curt Hill

22 Picture Copyright © 2017 – Curt Hill

23 Summary All of these have more than adequate documentation on the web
GNU maintains several of the them Even Wikipedia has entries on all of them Some of these even have a short reference card to aid in use Typically we use it until we are comfortable with the commands Copyright © 2017 – Curt Hill


Download ppt "You do want to create and edit programs?"

Similar presentations


Ads by Google