Skip to content

Instantly share code, notes, and snippets.

@tomnomnom
Created May 7, 2012 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomnomnom/2627430 to your computer and use it in GitHub Desktop.
Save tomnomnom/2627430 to your computer and use it in GitHub Desktop.
Vim "in" and "ambient" motions exercise
<!doctype html>
<html lang="en">
<head>
<title>My awesome homepage</title>
<script type="text/javascript">
(function(){
// Press ci" (Change In quotes) with the cursor between
// the quotes below to remove the text and be left in insert mode
var welcomeMessage = "Welcome to my homepage!";
// Press ci( (Change In braces) with the cursor between the braces
// below to remove the text between the braces and be left in insert mode
alert(theWrongVariable);
})();
// Now press di{ (Delete In curly braces) with the cursor
// inside the function body above to remove it
</script>
</head>
<body>
<!-- Press cit (Change In Tag) with the cursor between the h1
tags to delete the text and be left in insert mode -->
<h1>This is the heading</h1>
<!-- Press yat (Yank Ambient Tag) with the cursor between the p
tags to yank the whole block including the p tags -->
<p>
This is the first paragraph.
It's a pretty boring paragraph.
</p>
<!-- Press cat (Change Ambient Tag) with the curor between the em tags to
remove the text including the em tags and be left in insert mode-->
<p>
This is the <em>second paragraph</em>
</p>
<!-- Now press dit (Delete In Tag) with the cursor down here
to remove everything between the body tags -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment