Intel® Tiber™ Developer Cloud for oneAPI

Overview Get Started Documentation Forum external link

Introduction

The default text editor on the Intel® DevCloud Secure Shell (SSH) client terminal is vi, which stands for visual editor. As the Intel DevCloud SSH client terminal has a set of Basic Shell Commands required to operate and navigate through the Intel DevCloud server, the vi editor has its own set of commands. Each vi command falls under one of three categories, defined as follows:

  1. vi Mode: This is the default mode that vi starts in when you launch the editor. Most of the commands in this mode are defined by specific keys or a set of keys on your keyboard.
  2. Command Mode: To enable this mode you must first be in vi mode, and then select “:” on your keyboard. This mode is primarily used to make changes such as saving, writing, and so on to the file you are editing.
  3. Insert Mode: To enable this mode you must first be in vi mode, and then select “i” on your keyboard. In this mode you can insert data into the file. Once you are finished inserting data into the file, select “Esc” on your keyboard to escape input mode.

Starting vi

To launch the vi editor, type the vi command on the command line in the Intel DevCloud terminal. This command can be used for both creating and/or opening a file for editing, and supports the use of XML, TeX, HTML, and programming languages, but does not support binary files such as Word* or OpenDocument.

Syntax:

To launch the vi editor:

vi [file-name]

To recover a file that was being edited after a system crash:

vi -r [file-name]

Vi Mode

Moving the Cursor

In the vi editor you cannot move the cursor with your mouse. To navigate through the file easily you are required to learn a set of vi mode commands. Remember that vi mode is the default mode, and it is activated when you launch vi. If vi mode is not activated, select Esc on your keyboard to enter vi mode.

What the Command DoesKeyboard Command
Moves the cursor down one line j, <Return> or Down Arrow
Moves the cursor up one line k or Up Arrow
Moves the cursor left one character h, <Backspace> or Left Arrow
Moves the cursor right one character l, <Space> or Right Arrow
Moves the cursor to start of current line 0 (zero)
Moves the cursor to beginning of next word w
Moves the cursor back to beginning of preceding word b
Moves the cursor to the first line in the file 1G
Moves the cursor to line n nG
Moves the cursor to the last line in the file G

Manipulation of the vi Editor Screen

In the vi editor screen you can move up or down several lines (screens) and refresh your screen. You can input these commands by holding down the ctrl key and then selecting the corresponding command letter.

What the Command DoesKeyboard Command
Move forward one screen <ctrl> + f
Move backward one screen <ctrl> + b
Move down one-half screen <ctrl> + d
Move up one-half screen <ctrl> + u
Redraw the screen <ctrl> + l
Redraw the screen and remove deleted lines <ctrl> + r

Changing Text

These commands let you modify existing text in the vi editor. All these commands stop after you select Esc.

What the Command DoesKeyboard Command
Change the current word with new text cw
Change N words (for example, c2w changes 2 words) cNw
Replace the characters in the current line C
Replace the entire current line cc
Replace the next N lines, starting with current line Ncc

Deleting Text

These commands let you delete text in the vi editor.

What the Command DoesKeyboard Command
Deletes a single character under the cursor x
Deletes N characters, starting with character under cursor Nx
Deletes a single word, starting with character under cursor dw
Deletes N words, starting with character under cursor dNw
Deletes the rest of the line, starting with character under cursor D
Deletes the entire current line dd
Deletes N lines, starting with the current line Ndd

Cutting/Pasting Text

These commands let you copy and paste text in the vi editor.

What the Command DoesKeyboard Command
Copies the current line yy
Copies the next N lines (including the current line) Nyy
Pastes the line(s) into the text after the current line p

Undoing/Redoing Commands

These commands allow you to undo and redo last commands in the vi editor.

What the Command Does Keyboard Command
Undo whatever you just did in the text editor u
Redo changes that were undone (undo the undo’s) <ctrl> + r

Searching Through Text

These commands let you search through the text in the vi editor, and either replace or locate a specific string or character.

What the Command DoesKeyboard Command
Searches forward for occurrence of the string /string
Searches backward for occurrence of the string ?string
Moves to next occurrence of search string n
Moves to next occurrence of search string in opposite direction N

Command Mode

Exiting vi

There are several ways to exit out of the vi editor. Complete each command by selecting Enter or Return on your keyboard.

What the Command DoesKeyboard Command
Quits the vi editor :q
Quits the vi editor without latest changes being saved :q!
Quits vi, writing out modified file :x
Quits vi, and writes out the modified file :wq

Saving and Reading Files

These commands let you input and output files other than the file you are currently working with. These commands are completed by selecting Enter or Return on your keyboard.

What the Command DoesKeyboard Command
Reads a file and insert after current line :r file-name
Writes the current contents of the original file and file name :w
Writes the current contents to a different file name :w file-name
Writes the contents of the lines numbered to a new file name (for example, - :15, 50w newfile -- Writes out lines 15-50 to newfile) :N, Nw file-name
Writes out current content overwriting a pre-existing file :w! file-name

Line Numbers

These commands let you determine the line numbers of the current line or the total number of lines in the file being edited.

What the Command Does Keyboard Command
Returns the line number of current line :.=
Returns the total number of lines :=
Displays the line number next to each line in the file :set number

Input Mode

Commands

These commands let you insert text into the vi editor. To enter input mode, select i on your keyboard. To end input mode, select Esc on your keyboard.

What the Command DoesKeyboard Command
Enter input mode and insert text before cursor i
Inserts text at the beginning of the current line I
Appends text after the cursor a
Appends text to the end of the current line A
Open and output text in a new line below the current line o
Open and put text in a new line above the current line O
Replace a single character under the cursor r
Overwrite characters starting at the current cursor position R

Conclusion

This article highlighted the commands required to navigate and engage with the default text editor, vi. Refer to this guide while using the vi editor on the Intel DevCloud. For more information related to navigation of the Intel DevCloud, refer to the following additional resources.

Additional Resources

Basic Shell Commands for the Intel® DevCloud Terminal

Notices

No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.

Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.

This document contains information on products, services and/or processes in development. All information provided here is subject to change without notice. Contact your Intel representative to obtain the latest forecast, schedule, specifications and roadmaps.

The products and services described may contain defects or errors known as errata which may cause deviations from published specifications. Current characterized errata are available on request.

Copies of documents which have an order number and are referenced in this document may be obtained by calling 1-800-548-4725 or by visiting www.intel.com/design/literature.htm.

This sample source code is released under the Intel Sample Source Code License Agreement.

Intel, the Intel logo, and Xeon are trademarks of Intel Corporation in the U.S. and/or other countries.

Microsoft, Windows, and the Windows logo are trademarks, or registered trademarks of Microsoft Corporation in the United States and/or other countries.

*Other names and brands may be claimed as the property of others.

© 2019 Intel Corporation


Tweet: Intel DevCloud integrated optimized frameworks, tools, and libraries let you develop, test, and run AI workloads on Intel Xeon Scalable processors.

Summary: Intel DevCloud integrated optimized frameworks, tools, and libraries let you develop, test, and run AI workloads on Intel Xeon Scalable processors.