Units of Measure


Many vim commands operate on a block of textranging from one character to many paragraphs. You specify the size of a block of text with a Unit of Measure. You can specify multiple Units of Measure by preceding a Unit of Measure with a Repeat Factor (page 191). This section defines the various Units of Measure.

Character

A character is one charactervisible or not, printable or notincluding SPACEs and TABs. Some examples of characters are

a q A . 5 R - > TAB SPACE


Word

A word, similar to an ordinary word in the English language, is a string of one or more characters bounded on both sides by any combination of one or more of the following elements: a punctuation mark, SPACE, TAB, numeral, or NEWLINE. In addition, vim considers each group of punctuation marks to be a word (Table 6-8).

Table 6-8. Words

Word count

Text

1

pear

2

pear!

2

pear!)

3

pear!) The

4

pear!) "The

11

This is a short, concise line (no frills).


Blank-Delimited Word

A blank-delimited word is the same as a word but includes adjacent punctuation. Blank-delimited words are separated by one or more of the following elements: a SPACE, TAB, or NEWLINE (Table 6-9).

Table 6-9. Blank-delimited words

Word count

Text

1

pear

1

pear!

1

pear!)

2

pear!) The

2

pear!) "The

8

This is a short, concise line (no frills).


Line

A line is a string of characters bounded by NEWLINEs that is not necessarily displayed as a single physical line on the screen. You can enter a very long single (logical) line that wraps around (continues on the next physical line) several times or disappears off the right edge of the display. It is a good idea to avoid long logical lines by terminating lines with a RETURN before they reach the right side of the screen. Terminating lines in this manner ensures that each physical line contains one logical line and avoids confusion when you edit and format text. Some commands do not appear to work properly on physical lines that are longer than the width of the screen. For example, with the cursor on a long logical line that wraps around several physical lines, pressing RETURN once appears to move the cursor down more than one line. You can use fmt (page 736) to break long logical lines into shorter ones.

Sentence

A sentence is an English sentence or the equivalent. A sentence starts at the end of the previous sentence and ends with a period, exclamation point, or question mark, followed by two SPACEs or a NEWLINE (Table 6-10).

Table 6-10. Sentences

Sentence count

Text

One: only one SPACE after the first period and a NEWLINE after the second period

That's it. This is one sentence.

Two: two SPACEs after the first period and a NEWLINE after the second period

That's it. This is two sentences.

Three: two SPACEs after the first two question marks and a NEWLINE after the exclamation point

What? Three sentences? One line!

One: NEWLINE after the period

 This sentence takes up a total of three lines.



Paragraph

A paragraph is preceded and followed by one or more blank lines. A blank line is composed of two NEWLINE characters in a row (Table 6-11).

Table 6-11. Paragraphs

Paragraph count

Text

One: blank line before and after text

One paragraph

One: blank line before and after text

        This may appear to be more than one paragraph.        Just because there are two indentions does not mean it qualifies as two paragraphs. 


Three: three blocks of text separated by blank lines

 Even though in English this is only one sentence, vim considers it to be three paragraphs. 



Window

Under vim, a screen or terminal emulator window can display one or more logical windows of information. A window displays all or part of a Work buffer. Figure 6-5 on page 151 shows a screen with two windows.

Repeat Factor

A number that precedes a Unit of Measure (page 188) is a Repeat Factor. Just as the 5 in 5 inches causes you to consider 5 inches as a single Unit of Measure, so a Repeat Factor causes vim to group more than one Unit of Measure and consider it as a single Unit of Measure. For example, the command w moves the cursor forward 1 word, the command 5w moves it forward 5 words, and the command 250w moves it forward 250 words. If you do not specify a Repeat Factor, vim assumes a Repeat Factor of 1. If the Repeat Factor would move the cursor past the end of the file, the cursor is left at the end of the file.




A Practical Guide to UNIX[r] for Mac OS[r] X Users
A Practical Guide to UNIX for Mac OS X Users
ISBN: 0131863339
EAN: 2147483647
Year: 2005
Pages: 234

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net