Commonly used compilers in Linux include VI (UBUNTU), VIM (VI improved), and Emacs. I prefer the vim editor in Ubuntu. I am not familiar with the emacs editor. I have read the two source code writing editors. Currently, I think Vim is easier to learn, so we should select Vim as the starting point for learning Linux.
Let's take a closer look at the vim tutorial tonight. By the way, I will write an article to consolidate it.
The Vim editor has two modes: 1. Normal Mode (command mode) and 2. insert mode. Note: The two modes are converted using the ESC key.
I. Operations in Normal Mode
In command mode, you can use "colon + command" to perform operations. The first basic operation is to save and exit the operation:
: Q # exit. If it is not saved, an error message is displayed:W<FILENAME># Saving files: WQ # saving and exiting (Common Operations): Q! # Force exit
Edit data in Normal Mode:
X |
Delete the character at which the current cursor is located |
Dd |
Delete the row where the current cursor is located |
DW |
Delete the word at the current cursor position |
D $ |
Delete the content from the current cursor position to the ending line |
J |
Delete the linefeed at the end of the row where the current cursor is located (concatenate rows) |
U |
Undo the previous edit command |
A |
Add data to the current cursor |
A |
Append data at the end of the current cursor row |
R char |
Use Char to replace the word character at the current cursor position |
R text |
Overwrite the data at the cursor position with text until you press the ESC key. |
Copy and paste:
YW indicates copying words, y $ indicates copying to the end of a line, and P indicates pasting. In addition, when selecting a specified string, you need to enter the visual mode to select the string.
There are also search and replace operations, which are rarely used and not detailed.
========================================================== ========================================================== ======================
Configure the C/C ++ development environment in the vim Editor
Step 1: Find the vimrc file under the/etc/Vim/directory;
Step 2: Switch the terminal to the root user permission and switch the working path to the directory in step 1;
Step 3: Use the vim editor to open the vimrc file (Vim vimrc );
Step 4: switch to the insert mode and add the following to the vimrc file:Code:
Set tabstop = 4
Set shiftwidth = 4
Set cindent
Set cinoptions = {s, T0, N-2, P2s, (03 S, =. 5 S,> 1 s, = 1 s,: 1 s
Set number
Step 5: Save and exit. After the C/C ++ environment is set, a line feed and indentation are automatically generated, which is similar to that in the VC environment.
For details, see Vim configuration details.
You need to configure Vim to edit Python code.