Linux editors

24
PREPARED BY: Nikunj Savdasiya Hetarth Patel LINUX EDITORS

Transcript of Linux editors

Page 1: Linux editors

PREPARED BY: Nikunj Savdasiya

Hetarth Patel

LINUX EDITORS

Page 2: Linux editors

WHAT IS A TEXT EDITOR?• A software that helps in editing the text file.

• Familiar text editors.

• Word processors (stored in binary format)

• Character encoding UTF-8 or ASCII

• Formatting with markup tags like in html.

Page 3: Linux editors

TYPES OF LINUX EDITORS

• Text editors.

• Console based editors.

• Gui based editors.

• Structures editors.

• Html editors.

• Xml editors.

Page 4: Linux editors

TEXT EDITORS

• Console based editors.

• Vim• Emac• Jed• Nano• Pico

• Gui based editors

• Gedit gvim• Nedit• Tea• subtime

Page 5: Linux editors

VI EDITOR

COMMAND MODE

EDIT MODE

CTRL +C a,i or o

Page 6: Linux editors

• Commands for vi editor.• Cursor movement.

• H / left arrow – Move one space left.• J / down arrow – Move one space down.• K / up arrow – Move one space up.• L / right arrow – Move one space right.• $ - Last column on the current line.• 0 - Move cursor to the dirt column on the current line.• ^ - Move the cursor to first nonblank column on the current line.• b - Move to the beginning of the previous word or punctuation mark.• B - Move to the beginning of the previous word , ignores punctuation.• e - End of the first next word or punctuation mark.• E - End of the next word ignoring punctuation.

Page 7: Linux editors

Screen Movement• G - Move to the last line in the file.

• xG - Move to line X.

• z+ - Move current line to top of screen.

• z - Move current line to the middle of screen

• z- - Move current line to the bottom of screen

• ^F - Move forward one screen.

• ^B - Move backward one line.

• ^D - Move forward one half screen.

• ^U - Move backward one half screen.

• ^R - Redraw screen

• ^L - Redraw screen

Page 8: Linux editors

Inserting• r - Replace character under cursor with next character typed.

• R -keep replacing character until [esc] is hit.

• i - insert before cursor .

• a - append after cursor.

• A -append at end of line.

• O -open line above cursor and enter append mode.

Deleting• x - Delete character under cursor.

• dd - Delete line under cursor.

• dw - Delete word under cursor.

• db - Delete word before cursor.

Writing into file::w - Write into the file

:q - Quit the vi editor

:q! - Quit without saving

:wq - save and quit.

Page 9: Linux editors

EMACS EDITOR

• Screen editor• Unlike vi , emacs is not an insertion mode editor , meaning that any

character typed in emacs is automatically inserted into the file , unless it includes a command prefix.

• Commands in emacs are either control characters (hold down the <Ctrl> key while typing another character) or are prefixed by one of a set of reserved characters: <Esc> or <Ctrl>.

• One other distinction between emacs and vi is that emacs allows you to edit several files at once. The window for emacs can be divided into several windows, each of which contains a view into a buffer. Each buffer typically corresponds to a different file.

Page 10: Linux editors

EMACS COMMANDS

C-x C-f find-file: first prompts for a filename and then loads that file into a editor buffer of the same name.

C-x C-s save-buffer: saves the buffer into the associated filename.C-x C-w write-named-file: prompts for a new filename and writes the buffer

into it.

File reading and Writing commands

Page 11: Linux editors

Cursor/Screen Movement Commands

C-a Move cursor to (at) beginning-of-line.C-e Move cursor to end-of-line.C-f Move cursor forward one character.C-b Move cursor backward one character.C-n Move cursor to next line.C-p Move cursor to previous line.C-v Scroll file forward by one screenful.ESC v Scroll file backward by one screenful.ESC < Go to beginning-of-buffer.ESC > Go to end-of-buffer.ESC f Move cursor forward one word.ESC b Move cursor backward one word.

Page 12: Linux editors

Search commands

C-s isearch-forward: prompts for text string and then searches from the current cursor position forwards in the buffer

C-r isearch-backward: like isearch-forward, but searches from the current cursor position to end of buffer for text string.

ESC % query-replace: prompts for a search string and a string with which to replace the search string.

Copy and Delete Commands

C-d delete-charESC d delete-wordC-k kill-lineC-@ set-mark-commandC-w kill-regionC-y yankESC w copy-region-as-kill

Page 13: Linux editors

JED EDITOR• JED is a text editor that makes extensive use of the S-Lang library.

• It is highly cross-platform compatible

• JED runs on Windows and all flavors on Linux and Unix. Older versions are available for DOS.

• It is also very lightweight (meaning very parsimonious in its use of system resources), which makes it an ideal editor for older systems, embedded systems, etc. JED's Emacs mode is one of the most faithful emulations available.

Page 14: Linux editors

JED COMMANDSControl:• ^a

• ^b• ^d• ^e• ^f• ^g• ^h• ^I• ^k• ^l• ^n• ^o

Go to start of line Move backward by charactersForward delete characterGo to end of lineMove forward by charactersAbort out of thingsHelp "Smart" line indentKill to end of linePut current line in centerMove forward by linesOpen up a blank line

Escape:• Esc q• Esc s• Esc v• Esc w• Esc x• Esc y• Esc %• Esc <• Esc >• Esc $

Format paragraphCenter lineMove backword by pagesCopy region to kill bufferExecute JED commandYank and popQuery search and replaceMove to start of bufferMove to end of bufferInvoke ispell

Page 15: Linux editors

JED COMMANDSControl:^p^r^s^v^w^x^y^z^_^@

Move backward by lines Search backwardsSearch forward Move forward by pagesKill region Command prefixYank back from kill bufferSuspend JEDUndoSet mark

Control –x^x b^x d^x f^x I^x k^x s^x u^x ^b^x ^c^x ^f^x ^o^x ^a^x ^w

Switch to bufferInvoke directory editorSet fill columnInsert fileKill bufferSave buffersUndoDisplay buffer listExit JEDFind fileCollapse blank lines to one Save current bufferWrite buffer to file

Page 16: Linux editors

NANO EDITORIntroduction• Nano is a text editor suited to working in UNIX. It is not as powerful as PC window-based

editors, but still has many useful features.

• Most nano commands are invoked by holding down the Ctrl key (that is, the control key), and pressing one of the other keys. In this text, the control key is referred to using ^.

• For example, ^X means ``hold down the CTRL key and press the x key''.

Starting nano• To edit a file called filename, type nano filename.

• In nano, you can insert another file:

• ^R -read an existing file into nano (inserted at the current cursor position)

• ^T -opens a browser that allows you to select a file name from a list of files and directories

Page 17: Linux editors

NANO EDITOR

• Commands

• Navigation

• ^A -move to beginning of line

• ^E -move to end of line

• ^Y -move down a page

• ^V -move up a page

• ^_ -move to a specific line (^_^V moves to the top of the file, ^_^Y to the bottom)

• ^C -find out what line the cursor is currently on

• ^W - search for some text.

Page 18: Linux editors

NANO EDITOR• Commands

• Delete• ^D -delete character currently under the cursor• BackSpace -delete character currently in front of the cursor• ^K -delete entire line• ^\ -search for (and replace) a string of characters

• Save and Exit• ^O -save contents without exiting (you will be

prompted for a file to save to)• ^X -exit nano (you will be prompted to save your file if

you haven't)• ^T -when saving a file, opens a browser that allows

you to select a file name from a list of files and directories

Page 19: Linux editors

PICO EDITOR

• Introduction• The UNIX Pico editor is a full screen editor which is very easy to use.

• To use Pico on a file, enter ‘pico filename’

• If the file named filename exists, then the first page (or screen) of the file is displayed; if the file does not exist, then an empty file and screen is created into which you may enter text. Stars to the left of commands below indicate those to learn immediately.

• The following is a near facsimile of how your screen (or window) would appear if you had typed ‘pico junkfile.C’.

• At a UNIX command prompt and then invoked the help menu for Pico.

Page 20: Linux editors

PICO EDITOR• Commands

• Navigation

• ^G (F1) -Display this help text.

• ^F -move Forward a character.

• ^B -move Backward a character.

• ^P -move to the Previous line.

• ^N -move to the Next line.

• ^A -move to the beginning of the current line.

• ^E -move to the End of the current line.

• ^V (F8) -move forward a page of text.

• ^Y (F7) -move backward a page of text.

• ^W (F6) -Search for (where is) text, neglecting case.

• ^L -Refresh the display.

Page 21: Linux editors

PICO EDITOR

• Commands

• Delete

• ^D -Delete the character at the cursor position.

• Cut and Paste

• ^K (F9) -Cut selected text (displayed in inverse characters).

• ^U (F10) -Uncut (paste) last cut text inserting it at the current cursor position.

Page 22: Linux editors

PICO EDITOR• Other use full commands

• ^^ -Mark cursor position as beginning of selected text.

• ^I -Insert a tab at the current cursor position.

• ^J (F4) -Format (justify) the current paragraph.

• ^T (F12) -To invoke the spelling checker.

• ^C (F11) -Report current cursor position.

• ^R (F5) -Insert an external file at the current cursor position.

• ^O (F3) -Output the current buffer to a file, saving it.

• ^X (F2) -Exit pico, saving buffer.

Page 23: Linux editors

OTHER GUI EDITORS• Gedit : This is the default text editor for the Linux Gnome desktop. It supports

syntax highlighting, printing, a variety of plug-ins, multi-language spell check, tabbed for multiple files, etc.

• Gvim:This an attempt to provide a GUI editor based on the vim console editor. While it provides many of the features offered by a GUI text editor, it will still require knowledge of vim to stay out of trouble.

• Nedit:This is one of the original Unix GUI editors programmed in Motif. It is your basic intuitive and easy to use GUI editor

• Tea : Qt based GUI editor. Syntax highlighting, cross platform, plain text, programming language support, regular expression search and replace, file manager, ridiculously comprehensive, almost an IDE.

Page 24: Linux editors

THANK YOU