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.

Take your Linux skills to the next level!

Linux for Beginners

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

Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.

$ Check price
24.9924.99Amazon 4.5 logo(101+ reviews)

More Linux & UNIX resources

Aching back from coding all day?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources

Ad