I have always wanted to change to emacs, but it is hard to work efficiently, so vim has not completely abandoned it. My colleagues who want to be python may have the same troubles:
When maintaining others' code, it is found that many tabs and spaces are mixed or the spaces at the end of the line are not deleted.
I may not have noticed this problem before, that is, consciously using the ed mode: % s/s + $/g and: retab. Recently, the boss reminded me: he asked me if vim can be set to automatic mode? With my understanding of vim, it will certainly not be involved in personal editing, so it is possible to use the hook method.
This is my vary. vim principle: the command is automatically executed when the file is saved (: w. in fact, I think you may ask, why is it when I save it, not when I open it? Which will be discussed below
For installation configuration, see README of the project.
After installation, if not configured, it only takes effect for the python language by default-the team and language style are different.
Modify my vim plugin
I have been wondering which method is more reasonable (when the file is opened and modified or saved). By default, I save it, but you can actually modify my autocmd command:
The code is as follows: |
Copy code |
Autocmd BufReadPost *: call StripTrailingWhite () Autocmd BufReadPost *: call RetabIndents ()
|
Indicates that the modification is made before the file is opened, and the modified result is displayed to you.