Spark's way of cultivation (basic)--linux Big Data Development Basics: Fifth: VI, VIM editor (i)

Source: Internet
Author: User

The main contents of this section
    1. Three modes of the VIM editor
    2. Move cursor
    3. Input mode
    4. Modify text

Zhou Zhihu L.
Number: Zhouzhihubeyond
NET Name: Rocking Teen Dream

1. Three modes of the VI editor

Learning to use the VI editor is one of the most essential techniques to learn Linux systems, because Linux servers are not GUI-based, and Linux operations and developers are mostly text-edited or programmed by command-line methods. VI Editor is a Linux built-in text editor, almost all Unix-like systems have built-in VI editor, and other editors are not necessarily, and many other software will call VI Editor for content writing, such as crontab timed tasks. The vi editing speed is the fastest compared to other editors or GUI editors. The Vim editor can be seen as an advanced version of VI, which enables the display of special information using color, for example, in Java programming, where it displays color for certain keywords.
VI Editor:

Vim Editor:

The VI editor has three modes, namely General mode, edit mode and command line mode.
1 General mode, using VI command to enter the general mode directly
For example

root@ubuntu:/home/xtwy/compresse_demo# vi /etc/profile


In general mode, you can move the cursor around, delete characters, lines, and copy and paste operations.

2 edit mode, in the general mode by "I,l,o,o,a,a,r,r" and so on any one character, will enter the editing mode, the following is given in the general mode of input "I", the resulting editing mode window.

The –insert– is displayed at the bottom of the window, where you can edit the text content, and note that there is a color on the display because Vim is already installed on the machine.

3 command-line mode
In edit mode, press ESC to return to normal mode. In general mode, enter ":,/,?" To do any one character, the cursor will move to the bottom of the window, at which time you can save the edited file or leave the VI editor, and give the input ":" and then get the command line mode window

2. Move the cursor

1 single character movement
In general modelling, the use of up ARROW, the DOWN ARROW key can be left and right to move characters, you can also use the H, L keys on the keyboard to move around characters
The spacebar can also be moved to the right with a single character.

2 move to a specific character
Use the FX command for character positioning, such as FS to navigate to the next position of the same line s

Position of the cursor after pressing FS

With the FX command, you can position the cursor where the x character appears on the same line once

3 Press Word to move

The W command moves the cursor to the first letter of Word, and the punctuation mark is a word. For example, the following text is available:

【光标在这】class Student(name:String,age:Int,val studentNo:String) extends Person在一般模式下,按1w之后class 【光标在这】Student(name:String,age:Int,val studentNo:String) extends Person

The W command uses a space to move the cursor, for example

class 【光标在这】Student(name:String,age:Int,val studentNo:String) extends Person在一般模式下,按1W之后class Student(name:String,age:Int,val 【光标在这】studentNo:String) extends Person

The b command uses a space to move the cursor backwards, for example

class Student(name:String,age:Int,val 【光标在这】studentNo:String) extends Person在一般模式下,按1W之后class 【光标在这】Student(name:String,age:Int,val studentNo:String) extends Person

The b command uses word including punctuation to move the cursor backwards, for example

class 【光标在这】Student(name:String,age:Int,val studentNo:String) extends Person在一般模式下,按1b之后【光标在这】class Student(name:String,age:Int,val studentNo:String) extends Person

The e command moves the cursor to the end of the next word, for example

class Student(name:String,age:Int,val studentNo:String)【光标在这】 extends Person在一般模式下,按1e之后class Student(name:String,age:Int,val studentNo:String) extends【光标在这】 Person

The e command moves the cursor to the end of the next space-delimited word, such as

class 【光标在这】Student(name:String,age:Int,val studentNo:String) extends Person在一般模式下,按1E之后class Student(name:String,age:Int,val【光标在这】 studentNo:String) extends Person

4 move by row

K Key, UP ARROW key move to previous line
J Key, DOWN ARROW to move to the next line

5 sentence, paragraph movement
(Move the beginning of the sentence,) move to the end of the sentence, just given below (the demo

Apache Spark isaFast andGeneral-purpose cluster computingsystem. "Cursor in this" it provides high-level APIsinchJava, Scala, Python andR and  anOptimized engine that supports general execution graphs. It also supportsaRichSet  ofHigher-level tools including Spark SQL forSql andStructured data processing, MLlib forMachine learning, GraphX forGraph processing, andSpark streaming.downloading In general mode, enter (after "cursor in this" Apache Spark isaFast andGeneral-purpose cluster computingsystem. IT provides high-level APIsinchJava, Scala, Python andR and  anOptimized engine that supports general execution graphs. It also supportsaRichSet  ofHigher-level tools including Spark SQL forSql andStructured data processing, MLlib forMachine learning, GraphX forGraph processing, andSpark streaming.downloading

{Move to the beginning of the paragraph,} move to the end of the paragraph, give a demonstration below}

Spark Overview "cursor in this" Apache Spark isaFast andGeneral-purpose cluster computingsystem. IT provides high-level APIsinchJava, Scala, Python andR and  anOptimized engine that supports general execution graphs. It also supportsaRichSet  ofHigher-level tools including Spark SQL forSql andStructured data processing, MLlib forMachine learning, GraphX forGraph processing, andSpark streaming.downloading in general mode, input (after Spark Overviewapache Spark isaFast andGeneral-purpose cluster computingsystem. IT provides high-level APIsinchJava, Scala, Python andR and  anOptimized engine that supports general execution graphs. It also supportsaRichSet  ofHigher-level tools including Spark SQL forSql andStructured data processing, MLlib forMachine learning, GraphX forGraph processing, andSpark streaming.downloading "cursor in this"

5 Screen Position Movement
H (Home) moves to the top of the screen, the following figure is the cursor position when the H key is not pressed

When you finish pressing the key,

Press the L key to move the cursor to the bottom of the screen, the following figure is the effect after pressing the L key

Press the M key to move the cursor to the middle of the screen, which is the effect of pressing m keys

Ctr+d (down) scroll down the screen to move the cursor, ctr+u (UP) scroll up the screen to move the cursor, the command can also add a number to indicate how many rows of screen

Ctr+f (Forward) and PageDown keys, display the next screen of text, ctr+b (backward) and PageUp display the previous screen to change the text.

The G (Globalize) command moves the cursor to the specified line number, such as 1G, to the first line of text

3. Edit mode

1 Inserting text
In general mode, the text is inserted by "I, I, a, or a", where the I command is used to insert text content before the cursor, I means that the line begins to be inserted, A is inserted after the cursor, and a indicates the insertion at the end of the line.

(I在这插入)Downloa(i在这插入)【光标在这】(a在这插入)ding(A在这插入)

2 New Line Input

o indicates that a new row is created below the line, o means that a new row is opened above the current line

//O在光标所在行的上方插入新行【光标在这】Downloading//o在光标所在行的下方插入新行

3 Text substitution
The command R replaces a single character, returns the normal mode after the replacement is complete, and the command R joins the text substitution, manually pressing ESC to return to the general mode

4. Modify the text

Make text changes in general mode
1 undo Changes

U Undo Last Modification

//修改前Downloading//修改后DWDDDDDDDD//在一般模式下,按u后Downloading

U continuous execution can perform several undo

2 deleting characters

X Delete the character to the right of the cursor, delete one at a time, and if you specify 3x, delete each three
x Delete the characters to the left of the cursor, delete one at a time, and if you specify 3X, delete each three

3 Bulk Delete
Common Delete commands are:
DD command to delete a row
DL Delete character, same as x command
D0 deleted from the beginning of the line, at the cursor
d^ from the beginning of the first character at the beginning of the line to the cursor
DW starts at the current cursor and deletes to the end of Word
D3W starts at the current cursor and deletes to the end of the third character
d) Delete to the end of the sentence starting at the current cursor
D} starts at the current cursor and deletes to the end of the paragraph
D (Delete to the beginning of the sentence from the current cursor)
D{starts at the current cursor and deletes to the beginning of the paragraph
D start at the current cursor and delete to the end of the line
d$ and D are equivalent

4 Batch Modification

Common commands:
CL modifies the current character
CW starts at the cursor and changes to the end of the word
The CB is modified from the beginning of Word until it is at the cursor
c) Change to the end of the sentence starting at the current cursor
C} starts at the current cursor and changes to the end of the paragraph
C (start with the current cursor and change to the beginning of the sentence
C{starts at the current cursor and changes to the beginning of the paragraph
C starts at the current cursor and modifies to the end of the line
CC changes when moving forward
NCC modifies n rows starting from the current line

5 text substitution

s delete the current character, and then enter the replacement character
S Delete the current line, and then enter the replacement character as the current line

6 Case Conversion
~ If the character is uppercase, it is automatically converted to lowercase, and if it is lowercase, it is automatically converted to uppercase

Add a public number to find out more about the latest spark and Scala technical information

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Spark's way of cultivation (basic)--linux Big Data Development Basics: Fifth: VI, VIM editor (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.