Add check for vimplug file, curl vimplug file
This commit is contained in:
parent
f92cb202b3
commit
7bf711875b
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PyInquirer import prompt
|
from PyInquirer import prompt
|
||||||
@ -24,6 +25,17 @@ class VimModule(AbstractModule):
|
|||||||
os.makedirs(str(get_vim_root().joinpath("autoload")), exist_ok=True)
|
os.makedirs(str(get_vim_root().joinpath("autoload")), exist_ok=True)
|
||||||
os.makedirs(str(get_vim_root().joinpath("plugged")), exist_ok=True)
|
os.makedirs(str(get_vim_root().joinpath("plugged")), exist_ok=True)
|
||||||
|
|
||||||
|
def get_vimplug_file(self):
|
||||||
|
vimplug_filepath = Path(str(get_vim_root().joinpath("autoload")))
|
||||||
|
print(vimplug_filepath)
|
||||||
|
if os.path.isfile(str(get_vim_root().joinpath("autoload", "plug.vim"))):
|
||||||
|
print("Vimplug already installed!")
|
||||||
|
else:
|
||||||
|
curl_request = "curl https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim " + \
|
||||||
|
"-o " + \
|
||||||
|
str(get_vim_root().joinpath("autoload", "plug.vim"))
|
||||||
|
subprocess.call(curl_request, shell=True)
|
||||||
|
|
||||||
def create_plugin_section(self):
|
def create_plugin_section(self):
|
||||||
vimrc_content = []
|
vimrc_content = []
|
||||||
mapped_list = []
|
mapped_list = []
|
||||||
@ -56,8 +68,6 @@ class VimModule(AbstractModule):
|
|||||||
vimrc_content.append(plugins[element] + "\n")
|
vimrc_content.append(plugins[element] + "\n")
|
||||||
vimrc_content.append("call plug#end()\n")
|
vimrc_content.append("call plug#end()\n")
|
||||||
|
|
||||||
# TODO: check if existing plugin manager file
|
|
||||||
# TODO: else download plugin manager
|
|
||||||
return vimrc_content
|
return vimrc_content
|
||||||
|
|
||||||
def create_setting_section(self):
|
def create_setting_section(self):
|
||||||
@ -95,6 +105,7 @@ class VimModule(AbstractModule):
|
|||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
self.create_folder_structure()
|
self.create_folder_structure()
|
||||||
|
self.get_vimplug_file()
|
||||||
plugin_section = self.create_plugin_section()
|
plugin_section = self.create_plugin_section()
|
||||||
settings_section = self.create_setting_section()
|
settings_section = self.create_setting_section()
|
||||||
self.write_vimfile(settings_section + plugin_section)
|
self.write_vimfile(settings_section + plugin_section)
|
||||||
|
Loading…
Reference in New Issue
Block a user