DispersedNet
SiteMap
Unix Concepts
Shell Programming
Shell Scripting
Unix Questions
vi editing
«Prev
Next»
Unix Concepts
File Management
List Files Command
Copy Directories Command
Removing Directories Quickly
Unix About Links
Creating File Link
Find Command Search
File Management Conclusion
Unix Customization
Creating Aliases Unix
list current Aliases
Displaying Previous Commands
Repeating Previous Commands
Modifying Previous Command
Changing System Prompt
Storing shell Settings
Customize-environment
Grep Regular Expression
Define Regex
Using Quotes with Regex
Matching Pattern Occurrences
Matching Pattern Position
Turnoff Character Meaning
Regex Conclusion
Pattern Matching - Quiz
editing with vi
vi Review
Text in vi
Creating Text
Creating Command Shortcuts
Configure Editing Environment
Storing Custom Settings
Esditing Multiple Files
Pasting Text Files
vi Editing Conclusion
Managing Disk Space
Checking Disk Usage
Compressing Uncompressing Files
Viewing Compressed Files
File Archives
Create Archive
Listing Archives
Extracting Archive Files
Managing Disk Space Conclusion
Storing Custom Settings for vi - Exercise
Course project: Creating an
.exrc
file
Objective:
Create an
.exrc
file to store some custom vi settings.
Exercise scoring
You will receive 5 points for this exercise.
Background/overview
As you work on the eCyberCom web site, you will frequently use vi to edit files. To make editing easier, you have decided to customize vi by adding commands to your
.exrc
file. Your course account already gives you an
.exrc
file, so you will edit the existing file rather than creating a new one.
In this exercise, you will define a keyboard map, an abbreviation, and a vi configuration option.
Instructions, Part I
Log in to your course account.
In your home directory, use the vi editor to open the file named
.exrc
.
Define some text abbreviations, keyboard maps, or configuration options that you would find useful while editing the web site files.
When you are finished, save your changes and quit vi.
Test your new
.exrc
settings. Using vi again, open an existing file or create a new file.
In the file, use the
:ab
,
:map
, and
:set
commands to list your abbreviations, maps, and options. Do they appear as you defined them in
.exrc
?
Now edit your
.exrc
file and add intentional mistakes. For example, add a blank line as the first line, or use uppercase letters for the commands (
AB
,
MAP
,
SET
).
Write and quit the
.exrc
file.
Start another vi session, and check your settings again by entering
:ab
,
:map
, and
:set
. Are your intended
.exrc
settings listed this time?
Fix your .exrc file..
When you are done, quit vi and log out.
You can define multiple options using a single
set
command. For example, in your
.exrc
file, you can type a single line that reads,
set ic showmode
.
Instructions, Part II
List the
.exrc
settings you created for Part I and describe what each command does and why you created it.
Hints
You will notice that your
.exrc
file already contains the line
set showmode
. As you add new lines of text, it doesn't matter whether you add them above or below the existing line. It doesn't matter in what order you place your custom settings.
In an
.exrc
file, using a colon (:) before the
set
,
ab
, and
map
commands is optional.
If you made errors while editing your
.exrc
file, your custom settings might not take effect as you expect. You can check your results byvusing
:ab
,
:map
, and
:set
to list your definitions. To fix errors, open the
.exrc
file in vi and make thevnecessary edits.
Submitting your exercise
Submit your exercis clicking the submit button below.
Submit