Load vimrc into memory for safer editing
Allow plugins to be installed after initial run
This commit is contained in:
parent
963a164611
commit
39a3560bdf
@ -40,9 +40,14 @@ class VimModule(IModule):
|
|||||||
vimrc_exists = os.path.isfile("testfile")
|
vimrc_exists = os.path.isfile("testfile")
|
||||||
|
|
||||||
if vimrc_exists:
|
if vimrc_exists:
|
||||||
vimrc_file = open("testfile", "a+")
|
with open("testfile", "r") as vimrc_in_file:
|
||||||
vimrc_file.write("\n" + plugins[selection][1])
|
buf = vimrc_in_file.readlines()
|
||||||
vimrc_file.close()
|
|
||||||
|
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:
|
else:
|
||||||
vimrc_file = open("testfile", "w+")
|
vimrc_file = open("testfile", "w+")
|
||||||
|
Loading…
Reference in New Issue
Block a user