04. Navigating sentences and paragraphs {, } (braces), (, ) (parantheses)

Now let's see how to navigate through sentences or big blocks of code! Use these keys to wade through sentences in a paragraph: ( - start of sentence ) - end of sentence (Again, apologies, but these don't work in-browser. They will work in external vim, however.) This is a sample sentence. This is another sample sentence. Does a question mark complete the a sentence? How about an exclamation point? Yes! Yes they all do! Isn't this so exciting? Yes. Yes it is. To find the end of a sentence, Vim looks for "?", ".", or "!". To skip entire paragraphs, use: { - start of paragraph } - end of paragraph Vim considers any block of text surrounded with blank lines as a paragraph. /** * A class that demonstrates the usefulness of vim * keyboard shortcuts. Simply navigate this class * file using the { and } keys. * * @author CodeSnippetsAcademy * @version 1.0, December 11, 2014 * */ public class Car { public String color; // color of our car public int speed; // How fast our car is moving (mph) /** Parameterized constructor * @param aColor - the color of a car * @param aSpeed - the speed of the car */ public Car(String aColor, int aSpeed) { color = aColor; speed = aSpeed; } /** Default constructor */ public Car() { color = "blue"; speed = "50"; /** set the color of the car */ public void setColor(String newColor) { color = newColor; } /** set the speed of the car */ public void setSpeed(int newSpeed) { speed = newSpeed; } /** apply brakes */ public void applyBrake(int decrement) { speed -= decrement; } /** speed up */ public void speedUp(int increment) { speed += increment; } } Review Questions 1) How would you navigate through lines of code, where there are indentations? 2) What's the difference between using "0" and "^"? Solution: 1) You can use "-" and "+" or "-" and "[return]". Using the [return] is more efficient since you don't have to hold the [shift] key. 2) "0" is to the beginning of the line, while "^" is to the first non-white space of a line.

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

The Linux Command Line

Take your Linux skills to the next level! Try Linux & UNIX

The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.

$ Check price
39.9539.95Amazon 4.5 logo(274+ reviews)

More Linux & UNIX resources

Ad