2019-12-14 04:48:57 +01:00
|
|
|
from IModule import IModule
|
2019-12-15 07:30:20 +01:00
|
|
|
import os.path
|
2019-12-14 04:48:57 +01:00
|
|
|
|
2019-12-14 05:47:33 +01:00
|
|
|
|
2019-12-14 04:48:57 +01:00
|
|
|
class VimModule(IModule):
|
2019-12-14 04:22:34 +01:00
|
|
|
def __init__(self):
|
2019-12-14 05:47:33 +01:00
|
|
|
super().__init__()
|
|
|
|
|
2019-12-14 04:48:57 +01:00
|
|
|
def get_command(self):
|
2019-12-14 05:47:33 +01:00
|
|
|
|
2019-12-14 04:22:34 +01:00
|
|
|
plugins = [
|
2019-12-14 05:47:33 +01:00
|
|
|
("1. Colorschemes", "Plug 'https://github.com/rafi/awesome-vim-colorschemes.git'"),
|
|
|
|
("2. Unix Operations", "Plug 'https://github.com/tpope/vim-eunuch.git'"),
|
|
|
|
("3. Emmet", "Plug 'https://github.com/mattn/emmet-vim.git'"),
|
|
|
|
("4. Meta5 Theme", "Plug 'https://github.com/christophermca/meta5.git'"),
|
|
|
|
("5. Nerdtree", "Plug 'https://github.com/scrooloose/nerdtree'"),
|
|
|
|
("6. Lightline", "Plug 'https://github.com/itchyny/lightline.vim'")
|
2019-12-14 04:22:34 +01:00
|
|
|
]
|
|
|
|
|
2019-12-15 07:26:21 +01:00
|
|
|
print("Available Plugins:\n")
|
2019-12-14 04:22:34 +01:00
|
|
|
|
|
|
|
for key in plugins:
|
|
|
|
print(key[0])
|
|
|
|
|
|
|
|
print("")
|
|
|
|
|
2019-12-15 07:30:20 +01:00
|
|
|
# Select Plugins
|
|
|
|
user_input = [int(userInput) for userInput in input("Select modules: ").split()]
|
|
|
|
clean_plugin_list = set(user_input)
|
|
|
|
|
|
|
|
# print out selected plugins
|
|
|
|
for element in clean_plugin_list:
|
|
|
|
selection = element - 1
|
|
|
|
try:
|
|
|
|
print(plugins[selection][0])
|
|
|
|
except Exception:
|
|
|
|
print("Fail")
|
|
|
|
|
|
|
|
# Create vimrc file
|
|
|
|
vimrc_exists = os.path.isfile("testfile")
|
|
|
|
|
|
|
|
if vimrc_exists:
|
|
|
|
vimrc_file = open("testfile", "a+")
|
|
|
|
vimrc_file.write("\n" + plugins[selection][1])
|
|
|
|
vimrc_file.close()
|
|
|
|
|
|
|
|
else:
|
|
|
|
vimrc_file = open("testfile", "w+")
|
2019-12-15 22:22:44 +01:00
|
|
|
vimrc_file.write("\n" + "call plug#begin('~/.vim/plugged')\n")
|
|
|
|
for element in clean_plugin_list:
|
|
|
|
selection = element -1
|
|
|
|
vimrc_file.write(plugins[selection][1] + "\n")
|
|
|
|
vimrc_file.write("call plug#end()\n")
|
2019-12-15 07:30:20 +01:00
|
|
|
vimrc_file.close()
|