ftplugin: Only load the python plugin once

This makes opening wiki pages significantly faster and also prevents
clearing the entire cache every time.
This commit is contained in:
Tomas Janousek 2020-06-07 22:49:08 +02:00 committed by Tomas Babej
parent b722c29f9e
commit f3fe7aca21
3 changed files with 30 additions and 7 deletions

18
tests/test_ftplugin.py Normal file
View file

@ -0,0 +1,18 @@
import os
from tests.base import IntegrationTest
class TestCachePreserved(IntegrationTest):
def execute(self):
testfile2 = os.path.join(self.dir, "testwiki2.txt")
self.command("w", regex="written$", lines=1)
self.command("w {}".format(testfile2), regex="written$", lines=1)
self.client.edit(testfile2)
# check that all buffers have a cache entry
cache_keys = self.client.eval('py3eval("sorted(cache.caches.keys())")')
buffers = self.client.eval('py3eval("sorted(b.number for b in vim.buffers)")')
assert cache_keys == buffers