Presentation is loading. Please wait.

Presentation is loading. Please wait.

Text Editors Vim (Chapter 6) Emacs (Chapter 7)

Similar presentations


Presentation on theme: "Text Editors Vim (Chapter 6) Emacs (Chapter 7)"— Presentation transcript:

1 Text Editors Vim (Chapter 6) Emacs (Chapter 7)
John Carelli, Instructor Kutztown University

2 Unix Text Editors Two popular choices, Emacs and Vim Emacs Vim
non-modal no separate editing mode commands make use of key combinations (cntl, alt, …) slower, complex, extensible Vim “vi improved” inherently modal command vs. text entry modes faster, simpler

3 Basic operation Emacs Vim to enter text, just start typing
navigate with movement commands key combinations (using cntl, alt, esc, …) additional commands to copy/paste, etc. Vim to enter text, first enter “insert mode” enter text return to “command mode” with esc key in command mode navigate, copy/paste, etc. basic commands are one character

4 EMACS some basic commands

5 Emacs Cursor Movement CTRL-f forward one character CTRL-b
Back one character ESC-f Forward one word ESC-b Back one word CTRL-a Beginning of current line CTRL-e End of current line CTRL-p Previous line CTRL-n Next line ESC-a Beginning of current sentence ESC-e End of current sentence CTRL-v Forward one page ESC-v Back one page ESC-< Beginning of buffer ESC-> End of buffer

6 CTRL-x CTRL-s Save file CTRL-x CTRL f Open a file CTRL-h Help CTRL-_ Undo

7 CTRL-k Delete line from cursor to end and puts it in kill ring (buffer) CTRL-y Yank kill ring contents to current position CTRL-s Search forward for word CTRL-_r Search backward for word

8 Esc-x set-mark also works; set Mark to current position ESC-w Copy region to kill ring (buffer) CTRL-w Cut region and paste in kill ring (buffer)

9 CTRL-x CTRL-b Open a new window CTRL-x b Switch to named window CTRL-2 Split window into 2 horizontally CTRL-3 Split window into 2 vertically CTRL-x o Switch to the other window CTRL-x 0 Close current window

10 Esc-l Convert word to lowercase Esc-u Convert word to uppercase Esc-c Convert word to initial caps CTRL-x CTRL-l Convert region to lowercase CTRL-x CTRL-u Convert region to uppercase

11 CTRL-x ( Start recording a macro CTRL-x ) Stop recording a macro CTRL-e Run the macro Esc-# CTRL-e Run the macro # times

12 Vim some basic commands

13 Vim Modes Typically starts in “command mode”
keystrokes are interpreted as commands edit, navigate, etc. “Insert mode” enter with insert command esc key return to command mode Note: vim is based on vi, which was based on ed (more on ed here) Some Insert Commands i before current location a after current location I at beginning of line A at end of line o new line below O New line above

14 Vim Cursor Movement l forward one character h Back one character w
Forward one word b Back one word ^ Beginning of current line $ End of current line Enter Beginning of next line k Character above j Character below e End of word CTRL-f Forward one page ESC-b Back one page

15 :w Save file :wq (or ZZ) Save file and exit :q! Exit without saving :e name Open a file :help Help u Undo r redo

16 d$ Delete line from cursor to end and put it in buffer p Paste buffer contents to current position /word Search forward for “word” ?word Search backward for word

17 ma set Mark “a” to current position (can use any letter to set multiple marks) c’a Copy lines from present location to the mark into the buffer d’a Delete lines from present location to the mark and store in the buffer v Highlight a region by moving the cursor (subsequent commands work on the highlighted text) esc Remove highlighting

18 CTRL-w CTRL-s (or :sp) Split window into 2 horizontally CTRL-w CTRL-w Cycle through open windows CTRL-w CTRL-v Split window into 2 vertically :q Close current window

19 ~ Switch case u Make highlighted text lowercase U Make highlighted text uppercase

20 qa Start recording macro “a” (can use any letter to record multiple macros) q Stop recording a macro @a Run macro “a” Rerun last macro Run the macro # times

21 Initialization files Customize editor behavior
located in home directory .emacs file .vimrc file Key Mappings Colors Default behavior etc…


Download ppt "Text Editors Vim (Chapter 6) Emacs (Chapter 7)"

Similar presentations


Ads by Google