Monday, August 24, 2009

Re: Suggest a vim task for a college workshop

2009/8/24 Vlad Dogaru <ddvlad@rosedu.org>:
> ...
> I'm helping out with writing a task/tutorial-based lab for a freshman
> college class. I thought of including a couple of vim tasks, and am
> asking for your input.
> ...

Following are several things that I sometimes do and/or give
as exercises to students. All are related to searching and
therefore require some understanding of regexes.

* Searching for HTML tags of the form, say:
<\/\?[hH][1-6][^>]*> .

* Searching for or removing whitespace near line ends.
Similarly for lines beginning with whitespace or another
specific pattern.

* Replacing each `internal' whitespace sequence within a line
with a single space or comma.

* Reducing sequences of empty lines (including ones containing
only whitespace) to a single empty line (a line end character).

* Searching for repeated words, separated by whitespace
(possibly including new line).

* Searching for string constants like those in C (including
escapes and spanning more than one line).

* Here is something a bit more complicated: find a pattern to
search for a `sentence' composed of `words', ending with [.?!],
and correctly using commas and dashes. (Assume that a `word' is
a sequence of letters.) For example, "this, that" is acceptable
as a part of a sentence while "this,that" and "this , that" are
not.

Writing an useful macro might also interest you and your
students, especially one that combines relative movement and
text changing. For a simple example, a macro that puts `' or
<em></em> around a word or around a visually marked area.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: