Do you want to know the actual operations and related code of Python configuration? If you are interested in the practical application solutions related to Python configuration, you can understand it through the following articles. The following is what you will gain when you forget about gymnastics in this article.
Vim's default configuration has limited support for Python. you can install plug-ins and other methods to improve the efficiency of writing Python programs in Vim.
- < typetype="text/javascript">
Set indent in ~ /. Add the following settings to vimrc: "automatically detect the file type and load the corresponding settings.
- filetype plugin indent on
We recommend that you use spaces instead of tabs in the Python configuration file. In addition, the indentation should be four spaces. Therefore, you can add the following again:
- autocmd FileType python setlocal et sta sw=4 sts=4
Tip:
For more information about the preceding settings, see Vim code indent settings.
Better syntax highlighting
The default Python syntax highlighting function is limited, for example, the number is not highlighted.
Comment management
The vim plug-in EnhCommentify or comments provides the Comment management function. For details, see vim and program annotations.
Enhanced Code Completion prompt
Vim's code auto-completion function Ctrl-N) is very useful, see VI (VIM) programming skills ). By default, Vim can only recognize the variable names in the current file, which makes Code Completion meaningless for Python library functions. [1] pydiction has changed this situation. Python configuration can help to automatically complete Python library functions.