% echo "#include <iostream>> using namespace std;>> int main() {> cout << "2 + 2 = " << 4 << endl;>> return 0;> } " > math.cpp
"name an editor" ->
Why even talk about editors?
Walk and code has some depth:
1 Cool article questioning the "origin of QWERTY was to slow down typists" myth
The Basics
Marcus struggles mightily with emacs
And then does great in vim
We cover where the mouse is a winner
The Fancy Stuff
In "old" editors
In "new" editors
And what each other can't do
emacs | vim | gedit | |
---|---|---|---|
--------------------------- | ----------------- | --------------- | -------------- |
Save file | C-x C-s |
:w |
click save |
--------------------------- | ----------------- | --------------- | -------------- |
Quit without saving | C-x C-c n yes |
:q! |
click quit |
M-x kill-emacs |
click no | ||
--------------------------- | ----------------- | --------------- | -------------- |
Save and quit | C-x C-s then C-x C-c |
:w then :q |
click save |
C-x C-c y |
:wq |
click quit | |
:x |
|||
ZZ |
|||
--------------------------- | ----------------- | --------------- | -------------- |
emacs | vim | gedit | |
---|---|---|---|
--------------------------- | ----------------- | --------------- | -------------- |
Save file | C-x C-s |
:w |
click save |
--------------------------- | ----------------- | --------------- | -------------- |
Quit without saving | C-x C-c n yes |
:q! |
click quit |
M-x kill-emacs |
click no | ||
--------------------------- | ----------------- | --------------- | -------------- |
Save and quit | C-x C-s then C-x C-c |
:w then :q |
click save |
C-x C-c y |
:wq |
click quit | |
:x |
|||
ZZ |
|||
--------------------------- | ----------------- | --------------- | -------------- |
:w
always writes, :x
only if changedemacs | vim | gedit | |
---|---|---|---|
--------------------------- | ----------------- | --------------- | -------------- |
Save file | C-x C-s |
:w |
click save |
--------------------------- | ----------------- | --------------- | -------------- |
Quit without saving | C-x C-c n yes |
:q! |
click quit |
M-x kill-emacs |
click no | ||
--------------------------- | ----------------- | --------------- | -------------- |
Save and quit | C-x C-c y |
:x or ZZ |
click save |
:wq |
click quit | ||
--------------------------- | ----------------- | --------------- | -------------- |
Enter some text | ...just type | i then type |
...just type |
--------------------------- | ----------------- | --------------- | -------------- |
Search for a string | C-s |
/ |
make search appear |
click search |
i
is the easiest, yet probably least used, way to enter texti
- Go into insert mode hereI
- Go into insert mode at the beginning of the linea
- Go into insert mode right after hereA
- Go into insert mode at the end of the lineo
- Insert a new line below and go into insert modeO
- Insert a new line above and go into insert modes
- Delete this character and go into insert modeS
- Delete this line and go into insert modeC
- Delete the line from here and go into insert modeR
- Enter replace modeRemember Homework 2?
$ wget 'https://drive.google.com/uc?id=0B4qlH840ZwikbkZLS3Z5YTVSeW8&export=download' -O eecs280-w15-p2.tgz$ tar -xf eecs280-w15-p2.tgz$ echo -e '#include <cassert>\n#include "p2.h"\n' > p2.cpp$ grep ';' p2.h | grep -v ' \*' >> p2.cpp$ vim p2.cpp# press 'jjj' so that your cursor is on the i of int sum(...# press 'qq' to begin recording a macro into the vim register q# press 'f;' jump to the ';' character# press 's' remove character under the cursor and enter insert mode# insert the needed text:# '<space>{<enter>assert(false);<enter>}<enter><escape>'# press 'j' so that your cursor is on the i of int product(...# press 'q' to finish recording the macro# press '16@q' 16 times play the commands stored in register q
y
ank and p
aste instead"+y
and "+p
to yank and paste from the system clipboardset mouse=a
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |