13,420
edits
Changes
→Part 2: Creating Text Files Using The vi Text Editor
The major different between nano and vi is that '''vi starts in COMMAND LINE mode'''. You need to issue letter commands to perform text editing or press colon “: ” to enter last line mode to issue more complex commands.
'''Perform the Following Steps:'''
# Issue the following Linux command to edit a text file called '''mytext.txt''' in the '''linux/practice''' directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">nano textedit/practice/mytext.txt</span><br><br>'''NOTE:''' When using the '''Nano''' text editor, you are placed in '''INPUT''' mode, so you can enter text immediately.<br><br>[[Image:nano-text-editor-2.png|right|400px|thumb|Enter the following text that appears in this diagram.]]
# Enter the lines shown in the other diagram of the nano text editor on the right side.<br><br>
'''NOTE:''' Refer to the table below for a list of the most common '''vi''' ('''vim''') navigation & editing commands:<br><table cellpadding="5"><tr><th style="border-bottom: 1px solid black;">Key(s)</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td style="font-family:courier">'''i'''</td><td>Enter '''INPUT''' mode</td></tr><tr><td style="font-family:courier">'''<esc>'''</td><td>Return to '''COMMAND''' MODE</td></tr><tr><td style="font-family:courier">'''W'''</td><td>Move forward one word</td></tr><tr><td style="font-family:courier">'''B'''</td><td>Move back one word</td></tr><tr><td style="font-family:courier">'''dd'''</td><td>Cut line</td></tr><tr><td style="font-family:courier">'''yy'''</td><td>Copy Line</td></tr><tr><td style="font-family:courier">'''<ctrl>u'''</td><td>Paste Cut/Copied Text</td></tr><tr><td style="font-family:courier">''':help'''</td><td>Display help screen ('':q!'' to exit help screen)</td></tr></table><br>
# Issue the following to run the vi online tutorial:<br><span style="color:blue;font-weight:bold;font-family:courier;">/home/murray.saul/vi-tutorial<br><br>