python15. Use vim to edit python code


Multiple branch versions of deepin Linux are derived from
windows such as ubuntu. Multiple branch versions include cmd, xp, 8, 10 and other
os

Common Commands
Linux Common Commands: (Huawei's pre-installed system is Linux) In
Linux, if Linux is installed in windows powershell, you can use his command to view the user directory of windows (such as laptop-42r9o1j4\86189 user directory),
virtual When the machine enters to view the pyvip user directory
window, you can also use his own commands such as dir

(/) The root directory, which contains all files, is the source, and the slash is the
home directory, which is contained in the root directory. . . Also known as the user directory, it contains (pyvip, etc.). Generally, when logging in with a virtual machine, you will first enter the user directory and
enter the first letter of the file or directory. Press the tab key to automatically complete the original content (the same initials will only be completed to the total the letters appear in front), then appeared twice details
cd home / home directory and then jump type cd directory name plus plus / jump or jump on other non-family home directory need to play the full path
(path of a single file The slash is at the end, and multiple absolute paths are in front of or before and after /home/pyvip/) to get to the user directory of home.
cd~ This is to jump to the user directory where it is, the branch of the home directory, and it does not jump to it. Display, so you have to enter ls to view the
current path. Adding can have a relative path or an absolute path. The name and color of the folder and the file to be viewed are different. Add -a to view all hidden files (before the file). With. is a hidden file)
In the directory or file in the path, you can use ls to add its name to view the
cd. Nothing will be added. It will return to the directory you entered at the beginning. Add... is an error, add... is the upper level, add …/... is the upper level of the previous level (returns as many levels as there are slashes),
add. means nothing is executed, add-is to go back to the last time, directly add-without a space, the
directory will usually be displayed before an error is reported .
You can add a specified path before the file to create a file at the level of touch to precisely add it. The mkdir creates a folder
cat can only see the content of the file (the hidden files of the script file can be seen), ls can not see the content, only the name
copy file To
move a file or folder to a file mv, change the suffix folder to a file will become the prefix content to overwrite the content of the latter file,
But the name remains unchanged and the former disappears. For different levels, you need to enter a relative path or an absolute path. You
don’t need to add a slash after the name.

Linux does not have a recycle bin mechanism, and the deletion is gone, so you need to create a temporary file and call it out. Use
rm to delete files but not directly delete folders with files. For special files, you need to add sudo to elevate privileges, but you must enter the user password to unlock the root super User, hostname hostname
rm is generally used to add parameters -f or -r (-r is to delete the folder and the files in the recursive form of recursive deletion, -f is for forced deletion), -rf is the strongest deletion The command can delete the root directory (delete the system), and the deletion in the virtual machine will not have real impact
. The parameters here can be added before or after the deleted file. The parameters of the linux command can be used flexibly.

To view function commands by man, you can add before the command to view the command usage, and then press Q to exit, press F or B to scroll up and down to see the content. Some commands have the same effect.
You can also see the command usage by adding --help, but man is more detailed

vim editor (equivalent to notepad with plug-in):
you can use commands to manipulate
vim without the mouse and add the file name (if there is no such file name, vim can automatically create it), enter the file and start editing
command mode (text operation) shift and zz means save and exit, save and exit, there are: x, input mode (edit), last line mode (press shift and: in command mode, there are more complicated functions) they execute different commands
/add content Add N to search forward, press n/, it will automatically change? Is forward search,? Adding content and adding n will change by pressing N backwards (this kind of command is used in conjunction with search), and forward and backward are determined by pressing N or n.
Some installed plug-ins just press the shortcut key F.
9yy copies 9 lines in command mode, the number determines how many lines, 3d and carriage return is 3 plus 1 line, 3dd is 3 lines to delete, dw cursor starts to delete to the end of the line, x deletes the character where the cursor is, and dd has cut The function will affect the copy, so after yy, you must consider whether dd
u cancels the last operation, ctrl+r reverses the undo,
s replaces and then enters the insert mode, s/char1/char2 replaces the first one in the current line, and then adds g to change All of the current line, add g, and add% before s. Change all lines to
v and follow the cursor to select, ctrl+v to select vertically, V to select all lines horizontally, add gg or G, etc. to skip directly, all selected Characters can be executed together with the command
shift+> is the right indentation, shift+> is the left indentation

Python file operation
If there are multiple python versions, you must create a virtual environment to run one of the versions
workon plus python 3 (version name) when you run it . When nothing is added, you can view all versions, and then python -V can view the virtual execution Version, and then python can be executed by adding the file name without writing the version name in detail (write the version name is not executed in a virtual environment), and then press deactivate to exit

Guess you like

Origin blog.csdn.net/qwe863226687/article/details/113969198