Add comments, Fix path errors, Check if vim folders already exist

This commit is contained in:
Lucas Noki 2019-12-19 14:03:31 +01:00 committed by Marcel Schwarz
parent 3b261cc736
commit 4c8815ad92

View File

@ -51,6 +51,8 @@ class VimModule(IModule):
temp_file.write(line) temp_file.write(line)
temp_file.close() temp_file.close()
shutil.move('temp', 'testfile') shutil.move('temp', 'testfile')
# Merge duplicates to first ocassion with awk
sorted_file = "awk -i inplace ' !x[$0]++' ~/Gitlab/linux-tools/testfile" sorted_file = "awk -i inplace ' !x[$0]++' ~/Gitlab/linux-tools/testfile"
call(sorted_file, shell=True) call(sorted_file, shell=True)
@ -63,11 +65,17 @@ class VimModule(IModule):
vimrc_file.write("call plug#end()\n") vimrc_file.write("call plug#end()\n")
vimdir_exists = os.path.isdir("/home/clay/Gitlab/linux-tools/testdirectory/") vimdir_exists = os.path.isdir("/home/clay/Gitlab/linux-tools/testdirectory/")
autoloaddir_exists = os.path.isdir("/home/clay/Gitlab/linux-tools/testdirectory/autoload/")
if vimdir_exists: # Create necessary folder structure for Plugin Manager
install_vimplug = "cd ~/Gitlab/linux-tools/testdirectory/ && mkdir autoload && cd autoload && touch test.txt" if autoloaddir_exists == False:
call(install_vimplug, shell=True) if vimdir_exists:
install_vimplug = "cd ~/Gitlab/linux-tools/testdirectory/ && mkdir autoload && cd autoload && touch test.txt"
call(install_vimplug, shell=True)
else:
make_vimdir = """cd ~/Gitlab/linux-tools/ && mkdir testdirectory && cd testdirectory && mkdir autoload &&
cd autoload && touch test.txt"""
call(make_vimdir, shell=True)
else: else:
make_vimdir = "cd ~/Gitlab/linux-tools/ && mkdir testdirectory && cd testdirectory && mkdir autoload && cd autoload && touch test.txt" print("Vim-Plug already installed!")
call(make_vimdir, shell=True)