Extract plugin list into json file
Adjust line-breaks within strings Simplify if clause
This commit is contained in:
parent
7a05624f36
commit
04e6f9b160
@ -3,19 +3,15 @@ from subprocess import call
|
|||||||
from PyInquirer import prompt
|
from PyInquirer import prompt
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
class VimModule(AbstractModule):
|
class VimModule(AbstractModule):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.plugins = {
|
self.plugins = {}
|
||||||
"Colorschemes": "Plug 'https://github.com/rafi/awesome-vim-colorschemes.git'",
|
with open("modules/vim/vim_plugins.json") as plugins:
|
||||||
"Unix Operations": "Plug 'https://github.com/tpope/vim-eunuch.git'",
|
self.plugins = json.load(plugins)['plugins']
|
||||||
"Emmet": "Plug 'https://github.com/mattn/emmet-vim.git'",
|
|
||||||
"Meta5 Theme": "Plug 'https://github.com/christophermca/meta5.git'",
|
|
||||||
"Nerdtree": "Plug 'https://github.com/scrooloose/nerdtree'",
|
|
||||||
"Lightline": "Plug 'https://github.com/itchyny/lightline.vim'"
|
|
||||||
}
|
|
||||||
|
|
||||||
def do_module_selection(self):
|
def do_module_selection(self):
|
||||||
mapped_list = []
|
mapped_list = []
|
||||||
@ -33,11 +29,11 @@ class VimModule(AbstractModule):
|
|||||||
'choices': mapped_list
|
'choices': mapped_list
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
return prompt(module_selection)
|
return prompt(module_selection)['modules']
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
selected_modules = self.do_module_selection()['modules']
|
selected_modules = self.do_module_selection()
|
||||||
|
|
||||||
# print out selected plugins
|
# print out selected plugins
|
||||||
[print(x) for x in selected_modules]
|
[print(x) for x in selected_modules]
|
||||||
@ -71,14 +67,21 @@ class VimModule(AbstractModule):
|
|||||||
autoloaddir_exists = os.path.isdir("/home/clay/Gitlab/linux-tools/testdirectory/autoload/")
|
autoloaddir_exists = os.path.isdir("/home/clay/Gitlab/linux-tools/testdirectory/autoload/")
|
||||||
|
|
||||||
# Create necessary folder structure for Plugin Manager
|
# Create necessary folder structure for Plugin Manager
|
||||||
if autoloaddir_exists == False:
|
if not autoloaddir_exists:
|
||||||
if vimdir_exists:
|
if vimdir_exists:
|
||||||
install_vimplug = "cd ~/Gitlab/linux-tools/testdirectory/ && mkdir autoload && cd autoload && touch test.txt"
|
install_vimplug = "cd ~/Gitlab/linux-tools/testdirectory/ " \
|
||||||
|
"&& mkdir autoload " \
|
||||||
|
"&& cd autoload " \
|
||||||
|
"&& touch test.txt"
|
||||||
call(install_vimplug, shell=True)
|
call(install_vimplug, shell=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
make_vimdir = """cd ~/Gitlab/linux-tools/ && mkdir testdirectory && cd testdirectory && mkdir autoload &&
|
make_vimdir = "cd ~/Gitlab/linux-tools/ " \
|
||||||
cd autoload && touch test.txt"""
|
"&& mkdir testdirectory " \
|
||||||
|
"&& cd testdirectory " \
|
||||||
|
"&& mkdir autoload " \
|
||||||
|
"&& cd autoload " \
|
||||||
|
"&& touch test.txt"
|
||||||
call(make_vimdir, shell=True)
|
call(make_vimdir, shell=True)
|
||||||
else:
|
else:
|
||||||
print("Vim-Plug already installed!")
|
print("Vim-Plug already installed!")
|
||||||
|
10
modules/vim/vim_plugins.json
Normal file
10
modules/vim/vim_plugins.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"plugins": {
|
||||||
|
"Colorschemes": "Plug 'https://github.com/rafi/awesome-vim-colorschemes.git'",
|
||||||
|
"Unix Operations": "Plug 'https://github.com/tpope/vim-eunuch.git'",
|
||||||
|
"Emmet": "Plug 'https://github.com/mattn/emmet-vim.git'",
|
||||||
|
"Meta5 Theme": "Plug 'https://github.com/christophermca/meta5.git'",
|
||||||
|
"Nerdtree": "Plug 'https://github.com/scrooloose/nerdtree'",
|
||||||
|
"Lightline": "Plug 'https://github.com/itchyny/lightline.vim'"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user