I have the following in ~ / .vim / ftplugin / python.vim to highlight long lines, random tabs and extra spaces in Python files:
hi CustomPythonErrors ctermbg=red ctermfg=white guibg=
au BufWinEnter *.py call matchadd('CustomPythonErrors', '\%>80v.\+', -1)
au BufWinEnter *.py call matchadd('CustomPythonErrors', '/^\t\+/', -1)
au BufWinEnter *.py call matchadd('CustomPythonErrors', '\s\+$', -1)
au BufWinLeave *.py call clearmatches()
BufWinLeave - this is so that matches are deleted when I switch to another file, if this file is not a .py file. This is an important feature for me when working with something like Django.
Everything works great for random periods of time; from ten minutes to hours (I think it depends on how many files I open / close). But in the end, when any line is displayed with more than 80 characters, GVim slows down and requires a restart.
Does anyone have any idea why this is ultimately slowing down?
source
share