2. vim-intro . If your system does not have vim installed, you can install it by
ID: 671776 • Letter: 2
Question
2. vim-intro. If your system does not have vim installed, you can install it by:
sudo apt-get install -y vim
USING TERMINAL FROM XUBUNTU THANKS
vim has a built-in tutorial program, called vimtutor. Open vimtutor, complete all lessons, and answer the question of what keystroke(s) to do the following actions. Assume that we have no custom-mapped keys.
B. Lesson 2
a. Move cursor 3 words forward
b. Move cursor to the end of second word forward
c. Move cursor to beginning of line
d. Delete 5 words
e. Delete to end of line
f. Delete 3 lines
g. Undo last change
h. Redo changes
C. Lesson 3
a. Paste after cursor
b. Paste before cursor
c. Replace character at cursor
d. Change 2 words
e. Change to end of 3 words
f. Change to end of line
D. Lesson 4
a. Go to line 12
b. Go to last line in file
c. Go to first line in file
d. Forward search for "errroor" (without quotes)
e. Backward search for "oops" (without quotes)
f. Go to matching parenthesis or bracket
g. Replace "bad" (without quotes) with "good" (without quotes) in current line
h. Replace "ugly" (without quotes) with "pretty" (without quotes) in entire file
E. Lesson 5
a. Run shell command to list the your current working directory
b. Open visual mode
c. Save current file as "new_file.txt” (without quotes)
d. Read in file “file.txt” (without quotes)
F. Lesson 6
a. Open new line below
b. Open new line above
c. Append after the cursor
d. Enter replace mode
e. Copy one word
f. Copy to end of current line
F. Lesson 7
a. What is the pathname of the vim startup script?
Explanation / Answer
Lesson 7:
>:source /full/path/to/the/scriptfile.vim
Lesson 2:
>3w Move forward three words.
>e Move to the end of a word.
>0 Move to the beginning of the line
>5x to delte 5 words
>.,$d delete to end of file
>3dd - delete three lines
>u: undo last change
>Ctrl-R: Redo changes
You can also use [ctrl] + r to redo changes. It is easier and faster.
Lesson 3:
>p - put (paste) the clipboard after cursor
>P - put (paste) before cursor
>c$ -change (replace) to the end of line
>r - replace character
>cw - change (replace) to the end of word
Lesson 5:
>$ lsof -p <PID> | grep cwd
>v - start visual mode, mark lines, then do command
>:w to save file without quotes
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.