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?

Acupressure Mat & Pillow

Aching back from coding all day? Try Back Problems

Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.

$$ Check price
144.87144.87Amazon 4.5 logo(1,890+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

How Linux Works

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

In this completely revised second edition of the perennial best seller How Linux Works, author Brian Ward makes the concepts behind Linux internals accessible to anyone curious about the inner workings of the operating system. Inside, you'll find the kind of knowledge that normally comes from years of experience doing things the hard way.

$ Check price
39.9539.95Amazon 5 logo(114+ reviews)

More Linux & UNIX resources