Skip to content
Browse files

Merge branch 'master' into vagrant

  • Loading branch information...
2 parents 8ec1128 + 0ebd095 commit 774c09491cab1561e157d9125735bae9fe7ef037 @heim committed
View
17 lesson01/navigation.txt
@@ -4,6 +4,7 @@ Welcome to VIM for aspiring #ithipsters.
# Basic navigation
In this lesson you will learn to navigate around a text document.
+Navigation is also called movement-commands.
Use h/j/k/l to navigate this document.
@@ -21,9 +22,23 @@ To go to the beginning of a line press '0', and use '$' to go to the end of a li
To navigate to the beginning of the document issue the command 'gg'. Capital G gets you to the end of the document.
If you want to go directly to a line, issue the line number + 'G', like this '15G'.
+You can also do a quick search forward or backward for a character. Use 'f' followed by the character you want to search for.
+Example: To move the cursor to the next occurence of the letter 'u', you issue 'fu'.
+To search for the *previous* occurence of 'u', we can issue 'Fu'.
+When you search with 'f' or 'F' the jump is inclusive. If you want to move the
+cursor to the position *before* the match, you must use 't' or 'T'.
+
+
+Before you move onto the next lesson, please get somewhat familiar with navigating with the different navigation motions.
+
+
+When you are ready to move on to the next lesson, please do the following.
+- make sure you are not accidentally in some other mode than normal mode by pressing 'Esc'.
+- open the next lesson by issuing the command ':e! lesson02/insert-mode.txt'
+- (This opens a new file, ':' to enter command-mode, 'e' to edit a file, '!' to ignore changes)
+
Below this line is some text you can play with.
-When done, then ESC yourself. Hit ESC then ':' then 'q'
--------------------------------------------------------------------------------------------
"You gettee in," he added, motioning to me with his tomahawk, and throwing the clothes to one side. He really did this in not only a civil but a really kind and
View
9 lesson02/insert-mode.txt
@@ -15,6 +15,7 @@ PROTIP: If you screw something up, exit insert-mode and press 'u' to undo the la
------------------------------------------------------------
Task01: Inserting
+-----------------
Correct the following line.
@@ -22,6 +23,7 @@ Helo word.
Task02: Appending
+-----------------
As you might have noticed, 'i' inserts new characters at the current cursor position.
If you want to insert characters after the cursor position you can use 'a'.
@@ -30,6 +32,7 @@ Try this by putting a punctuation mark of your choice at the end of this line
Task03: Inserting and appending at the start and end of the line
+----------------------------------------------------------------
Some times you want to edit directly at the start or the end of a line. To solve this you could issue '0i' to edit at the beginning, or '$a' to edit at the end of a line.
Luckily VIM provides a shorthand for this.
@@ -40,3 +43,9 @@ When done get out with a bang: Hit ESC type ':' then 'q!'
You just left this place without leaving a trace.
IM for aspiring #ithipster
+
+
+
+------------------------------------------------------------------------------------------------------
+When you are done, move on to the next lesson by opening the next file ':e lesson03/deleting-text.txt'
+------------------------------------------------------------------------------------------------------
View
16 lesson03/deleting-text.txt
@@ -12,7 +12,7 @@ Task01: Deleting characters
---------------------------
You can delete the character under the current cursor using 'x'.
-Correct the following line:
+Correct the following line: (use 'h/j/k/l', 'w' or 'b' to navigate)
As a jjava programmmer I somettimess ennvy the C#-syntaxx.
@@ -44,8 +44,8 @@ You can issue all sorts of movement commands to the delete command (and a huge a
Try these on for size:
dd: delete the current line.
-d$ or D: delete from current posittion to the end of the line.
-dG: delete from current positionto the end of the document.
+d$ or D: delete from current position to the end of the line.
+dG: delete from current position to the end of the document.
dgg: delete from current position to the start of the document
dw: delete from current position forward one word.
db: delete from current position backward one word.
@@ -66,3 +66,13 @@ While playing with deletion-commands on the next few lines, you should undo the
* Delete the extra extra words words in this line using 'db'.
* Delete multiple lines using 'd49G'.
+
+
+-----------------------------------------------------------------
+When you are finished let us move to the next lesson.
+If you want to you can also save your changes before you move on:
+- make sure you are in normal-mode by 'Esc'-ing.
+- type ':w' and hit enter.
+- voila, you have saved a file
+- open the next lesson by typing ':e lesson04/changing-text.txt'
+-----------------------------------------------------------------
View
50 lesson04/changing-text.txt
@@ -16,27 +16,28 @@ Tasks begin here:
Task01: Change a word.
+----------------------
Unsurprisingly the change-command is dependent of a corresponding movement command.
To change a word, stand at the beginning of a word and press 'cw'.
If you are positioned at the end of a word, use the 'cb'-command.
Change the misspelled word on the next line.
-<<<<<<< HEAD
Hello word.
Task02: Change a whole line
+---------------------------
If you issue the double 'c', aka 'cc' you will change the whole line.
Change the following line to something more reasonable.
Well, I guess that I just should go to my nearest electronics shop and buy an android phone.
-Task03:
+Task03: Go play
+---------------
Try some of these commands if you like. They are based on the same principle as the delete commands from the previous lesson.
-
cc: change the current line.
c$ or D: change from current posittion to the end of the line.
cG: change from current positionto the end of the document.
@@ -59,40 +60,19 @@ While playing with change-commands on the next few lines, you should undo the ch
* Change multiple lines using 'd49G'.
-Hello word.
-
-Task02: Change a whole line
-
-If you issue the double 'c', aka 'cc' you will change the whole line.
-Change the following line to something more reasonable.
-
-Well, I guess that I just should go to my nearest electronics shop and buy an android phone.
-
-Task03:
+---------------------------------------------------------------------------------------------------------
+Let us move on to the next lesson.
+- can you figure out how to open it yourself?
+- hint: the filename is 'lesson05/delete-copy-and-paste.txt'
-Try some of these commands if you like. They are based on the same principle as the delete commands from the previous lesson.
+Still here?
-cc: change the current line.
-c$ or D: change from current posittion to the end of the line.
-cG: change from current positionto the end of the document.
-cgg: change from current position to the start of the document
-cw: change from current position forward one word.
-cb: change from current position backward one word.
-c15G: change from current position to line 15.
-
-
-While playing with change-commands on the next few lines, you should undo the changes afterwards.
-
-* Change this line.
-
-* Change from - to the end of the line.
-
-* Change from any position in this line to the beginning of the document.
-
-* Change from any position in this line to the end of the document.
-
-* Change multiple lines using 'd49G'.
+Want to learn a trick?
+- all the files you have opened reside in their own buffer.
+- check which buffers are open by issuing ':ls'.
+- see that each buffer has an id?
+- try to open the firs buffer ':b1', and switch back again. (you might have to save or undo your changes)
+---------------------------------------------------------------------------------------------------------
-Prepare for the next chapter, then you will learn how to use text-objects.
View
8 lesson05/delete-copy-and-paste.txt
@@ -57,3 +57,11 @@ VIM lets you inspect the contents of the different registers with the ':reg' com
Do you see the contents of the named registers? What about the registers from 0-9 you may ask. This is a stack containing all the 10 latest pieces of text
that has been 'd'eleted or 'c'hanged. Try it out now with some various commands and inspect the register afterwards to see what effect the different commands
have on the contents of the registers. Can you figure out what the name of the anonymous register is (the one that gets populated when you do a regular 'yy')?
+
+
+
+----------------------------------------------------------------------------------
+Time for another lesson.
+- it is called 'lesson06/visual-mode.txt'
+- you can do it!
+----------------------------------------------------------------------------------
View
7 lesson06/visual-mode.txt
@@ -87,3 +87,10 @@ console.log("hello")
alert("world")
console.log("bye")
alert("cruel world")
+
+
+
+----------------------------------------
+Time for the last lesson.
+- 'lesson07/text-objects.txt'
+----------------------------------------
View
108 lesson07/text-objects.txt
@@ -2,17 +2,97 @@ Lesson 07
#Text objects
-Surgical selection of pieces of text
-
-T1
-Visual select of inner word
-T2
-Visual select inner paranthesis
-T3
-Visual select outer parenthesis
-T4
-Visual select outer word
-T5
-put it together, delete
-T6
-Yank inner word
+This lesson is about interacting with pieces of text with surgical precision. Onward with the tasks.
+Task 01: Visual select of inner word
+------------------------------------
+
+To enter visual-mode and select an inner word, place the cursor inside the word
+and issue 'viw'. (*v*isual *i*nner *w*ord)
+
+Try to visually select *this* word (or any other, you're the boss)
+
+(Stuck in visual mode? Just press 'Esc' a couple of times)
+
+Task 02: Visual select inner parenthesis
+----------------------------------------
+
+If you are using a programming language which utilize parenthesis, this might come in handy.
+Visually select the inner content of parenthesis by issuing 'vi)'
+
+Try (it on) this (line (right here), it might give you an) eye (opener).
+
+Task 03: Visual select outer parenthesis
+----------------------------------------
+
+Outer parenthesis you say? This includes the parenthesis.
+Issue 'va)'. (*v*isual *a*round *)*... parenthesis).
+
+Try (it on) this (line (right here), it might give you another) eye (opener).
+
+Task 04: Visual select outer word
+---------------------------------
+
+You can also select around a word, can you figure out how?
+
+This is some text to play with.
+
+Task 05: Delete inner and outer word
+--------------------------
+
+But what happens if you replace the 'v' in e.g. 'viw' with the delete command 'd'?
+
+Try it out here:
+
+Delete the extra extra words words.
+
+What happens if you select around the words instead?
+
+Task 06: Yank inner and outer word
+----------------------------------
+
+It is useful to yank words, and other stuff. You probably can figure out how to
+modify the commands to be able to yank ('y') text-objects?
+
+Try to yank something (from this (line)).
+
+Task 07: Change inner and outer word, or other.
+--------------------------
+
+This might not come as a surprise, if you issue 'c' instead of 'y', you can precisely change a word or contents of a parenthesis.
+
+Try to change the contents of the next few lines.
+
+I really like pizzzza.
+
+if(misssspelledMethod == false)
+
+
+Task 08: And what about tags?
+-----------------------------
+
+HTML you say? VIM I say!
+
+Change inner and outer contents of tags with 'cit' and 'cat'. Try to experiment with different cursor placements.
+Remember, here 'u' is your friend.
+
+<div>
+ <p>Hello world</p>
+</div>
+
+Task 09: ...oh, and one last thing...
+--------------------------------------
+
+I almost forgot to mention, it works with strings as well.
+E.g. 'ci"' and 'ci''
+
+
+var text = "This is some changeable text"
+var other = 'So is this, man text-objects are neat'
+
+
+
+************************************************************************************
+* Congratulations, you are now one step further on your path to VIM-enlightenment. *
+* Now remains only one last thing to master, MACROS. *
+* You can find the last task in lesson08/macros.txt *
+************************************************************************************
View
41 lesson08/macros.txt
@@ -0,0 +1,41 @@
+Lesson 08
+
+# Macros
+
+Macros are at the heart of VIM, this is an advanced topic, so dont
+be alarmed if you don't master these techniques at once.
+
+Macros record a sequence of keystrokes, and can be executed afterwards an
+arbitrary number of times.
+
+A quick example.
+
+Say that we wanted to record a macro for 'delete inner word'.
+This is what we had to type.
+- 'qa' 'q' to start recording macro, and 'a' to put it in macro register 'a'
+- 'diw' to delete inner word
+- 'q' to stop recording
+- to execute the macro, we would issue '@a' (execute macro in register 'a').
+
+
+
+Raiders of The Last Task(tm).
+-----------------------------
+
+Below is a list of strings that represent various javascript files.
+Can you create a macro that wraps those strings in a <script>-tag?
+
+E.g. this:
+js/jquery.js
+Should become this:
+<script src="js/jquery.js"></script>
+
+
+
+js/jquery.js
+js/underscore.js
+js/backbone.js
+js/obscure.js
+js/app.js
+
+
View
BIN presentation/images/purr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN presentation/images/thisguy.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
81 presentation/index.html
@@ -121,33 +121,48 @@
<body>
<div id="impress">
+ <div class="step" data-scale="13" data-y="-3000">
+ <p>VIM for aspiring #ithipsters</p>
+ </div>
<div id="start" class="step slide">
- <p>VIM for aspiring #ithipsters</p>
- <p class="small">Andreas Heim</p>
+ <p>Andreas Heim</p>
+ <p>BEKK Consulting</p>
</div>
<div id="step1" class="step slide" data-x="1200">
- <p> blog (occationally) </p>
- <p><a href="http://heim.no">heim.no</a></p>
+ <p> blog (occasionally) </p>
+ <p>heim.no</p>
</div>
<div id="slide2" class="step slide" data-x="2400">
<p> twitter (norwegian ranting) </p>
- <p><a href="http://twitter.com/heim">@heim</a></p>
+ <p>@heim</p>
+ </div>
+ <div class="step slide" data-x="2400">
+ <p>github.com/heim</p>
+ <p>github.com/heim/vimtutorial</p>
+ <p>(pull requests welcome)</p>
</div>
+
<div id="vim" class="step" data-x="3600" data-y="500" data-scale="3" data-rotate="150">
<p>VIM</p>
</div>
<div id="small-part" class="step" data-x="3600" data-y="500" data-z="-6000" data-rotate="-150">
<p>Small part.</p>
</div>
-
+ <div class="step" data-x="3600" data-y="1000" data-z="-6000">
+ <img src="/images/thisguy.gif" width="532" height="356"/>
+ </div>
+ <div class="step" data-x="3600" data-y="2000" data-z="-6000">
+ <img src="/images/purr.gif" width="550" height="356"/>
+ </div>
<div id="slide4" class="step slide" data-x="0" data-y="800">
<p>Why VIM?</p>
<ul>
<li>widely available</li>
- <li>more efficient editing</li>
- <li>#it-hipster credibility</li>
+ <li>edit at the speed of thought</li>
+ <li>#ithipster credibility</li>
+ <li>atomate boring tasks</li>
</ul>
</div>
<div class="step slide" data-x="1200" data-y="800">
@@ -189,48 +204,32 @@
</div>
<div class="step slide" data-x="0" data-y="1600">
- <p>Harsh mistress</p>
- <img src="/images/harsh.gif" height="287" width="380"/>
+ <p>VIM is a harsh mistress</p>
+ <img src="/images/harsh.gif" width="492" height="372"/>
</div>
<div class="step slide" data-x="1200" data-y="1600">
- <p>It will make a fool out of you!</p>
- <img src="/images/fool.gif" height="287" width="380"/>
+ <p>It will make a fool out of you...</p>
+ <img src="/images/fool.gif" width="378" height="274"/>
</div>
<div class="step slide" data-x="2400" data-y="1600">
- <p>Give you great speed</p>
- <img src="/images/speed.gif" height="287" width="380"/>
+ <p>... but it can give you great speed...</p>
+ <img src="/images/speed.gif" width="450" height="195"/>
</div>
<div class="step slide" data-x="3600" data-y="1600">
- <p>... and you will be able to do amazing things</p>
- <img src="/images/amazing.gif" height="287" width="380"/>
+ <p>... and you will be able to do amazing things...</p>
+ <img src="/images/amazing.gif" width="380" height="287"/>
</div>
-
-<!--
-
- <div id="slide5" class="step" data-x="3200" data-rotate="150">
- <p>This Slide Rotates Clockwise Around z-axis</p>
+
+ <div class="step slide" data-x="4800" data-y="1600">
+ <p>Further reading</p>
+ <p class="small">Practical Vim, Drew Neil - Pragmatic Programmers</p>
+ <p class="small">Vi and VIM editors, Arnold Robbins, Elbert Hannah, Linda Lamb - O'Reilly</p>
</div>
-
- <div id="slide6" class="step" data-x="6200" data-scale='3'>
- <p>This Slide Scales 3 Times</p>
- </div>
-
- <div id="slide7" class="step" data-x="4200" data-y='1500' data-z='1500'>
- <p>Away</p>
- </div>
-
- <div id="slide8" class="step" data-x="4900" data-y='1500' data-z='100'>
- <p>Towards</p>
- </div>
-
- <div id="slide9" class="step" data-x="5600" data-y='1500' data-z='-1500'>
- <p>Futher Towards</p>
- </div>
-
- <div id="slide10" class="step" data-x="6600" data-y='3000' data-scale='10'>
- <p>Visualization Slide Positions</p>
+ <div class="step slide" data-x="6000" data-y="1600">
+ <p> Thank you for attending </p>
+ <p class="small">all images courtesy of animalsbeingdicks.com</p>
+ <p class="small">presentation is cc-by, and created with impress.js</p>
</div>
--->
</div>
<div class="fallback-message">

0 comments on commit 774c094

Please sign in to comment.
Something went wrong with that request. Please try again.