diff --git a/modules/vim/module.py b/modules/vim/module.py index 7793f73..13d8593 100644 --- a/modules/vim/module.py +++ b/modules/vim/module.py @@ -40,9 +40,14 @@ class VimModule(IModule): vimrc_exists = os.path.isfile("testfile") if vimrc_exists: - vimrc_file = open("testfile", "a+") - vimrc_file.write("\n" + plugins[selection][1]) - vimrc_file.close() + with open("testfile", "r") as vimrc_in_file: + buf = vimrc_in_file.readlines() + + with open("testfile", "w") as vimrc_out_file: + for line in buf: + if line == "call plug#begin('~/.vim/plugged')\n": + line = line + plugins[selection][1] + "\n" + vimrc_out_file.write(line) else: vimrc_file = open("testfile", "w+")