feat: add nvim
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
.SpaceVim.d/.netrwhist
|
.SpaceVim.d/.netrwhist
|
||||||
.SpaceVim.d/init.vim
|
.SpaceVim.d/init.vim
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
nvim/plugin
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ vim.o.guifont = "FiraCode Nerd Font:h17"
|
|||||||
vim.g.vimspector_enable_mappings = 'HUMAN'
|
vim.g.vimspector_enable_mappings = 'HUMAN'
|
||||||
vim.g['test#go#rspec#options'] = { nearest= '--v', suite= '--v' }
|
vim.g['test#go#rspec#options'] = { nearest= '--v', suite= '--v' }
|
||||||
vim.o.background = "dark"
|
vim.o.background = "dark"
|
||||||
require('monokai')
|
--require('monokai')
|
||||||
vim.cmd('colorscheme monokai_pro')
|
--vim.cmd('colorscheme monokai_pro')
|
||||||
--require('nightfox').set()
|
--require('nightfox').set()
|
||||||
--vim.cmd('colorscheme one-monokai')
|
--vim.cmd('colorscheme one-monokai')
|
||||||
--vim.cmd([[colorscheme gruvbox]])
|
--vim.cmd([[colorscheme gruvbox]])
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ O.python.analysis.use_library_code_types = true
|
|||||||
-- TODO look into stylua
|
-- TODO look into stylua
|
||||||
O.lua.formatter = 'lua-format'
|
O.lua.formatter = 'lua-format'
|
||||||
-- O.lua.formatter = 'lua-format'
|
-- O.lua.formatter = 'lua-format'
|
||||||
O.lua.autoformat = false
|
--O.lua.autoformat = false
|
||||||
|
|
||||||
-- javascript
|
-- javascript
|
||||||
O.tsserver.formatter = 'prettier'
|
O.tsserver.formatter = 'prettier'
|
||||||
|
|||||||
@@ -2,45 +2,85 @@
|
|||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
home_dir = os.getenv("HOME")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-i","--install", help="install tools",type=str)
|
parser.add_argument("-i","--install", help="install tools",type=str)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
install_val = args.install
|
installer = Installer()
|
||||||
if install_val == "":
|
installer.install(args.install)
|
||||||
print("install value is empty")
|
|
||||||
exit()
|
class Base(object):
|
||||||
if install_val in install_map:
|
def cmd_exist(self, name):
|
||||||
install_map.get(args.install)()
|
from shutil import which
|
||||||
else:
|
return which(name) is not None
|
||||||
print("cmd not support, install: "+args.install)
|
|
||||||
|
def check_link(self, name:str,target:str):
|
||||||
|
if os.path.islink(name):
|
||||||
|
t = os.readlink(name)
|
||||||
|
if t == target:
|
||||||
|
return
|
||||||
|
os.system("mv %s %s.bak"%(name,name))
|
||||||
|
os.system("ln -s %s %s"%(target,name))
|
||||||
|
class Installer(Base):
|
||||||
|
def install(self, val:str):
|
||||||
|
if val== "":
|
||||||
|
print("install value is empty")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
install_map = {
|
||||||
|
"neovim": self.install_neovim,
|
||||||
|
"z": self.install_z,
|
||||||
|
"git": self.install_git,
|
||||||
|
"packer": self.install_packer,
|
||||||
|
}
|
||||||
|
if val in install_map:
|
||||||
|
install_map.get(val)()
|
||||||
|
else:
|
||||||
|
print("cmd not support, install: "+val)
|
||||||
|
|
||||||
|
|
||||||
# install neovim
|
# install neovim
|
||||||
def install_neovim():
|
def install_neovim(self):
|
||||||
os.chdir("/usr/local")
|
if not self.cmd_exist("nvim"):
|
||||||
os.system("wget https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-macos.tar.gz")
|
os.chdir("/usr/local")
|
||||||
os.system("tar zxf nvim-macos.tar.gz")
|
os.system("wget https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-macos.tar.gz")
|
||||||
os.system("ln -s /usr/local/nvim-osx64 /usr/local/nvim")
|
os.system("tar zxf nvim-macos.tar.gz")
|
||||||
|
os.system("ln -s /usr/local/nvim-osx64 /usr/local/nvim")
|
||||||
|
self.check_link(home_dir+"/.config/nvim",home_dir+"/.doftile/nvim")
|
||||||
|
|
||||||
|
def install_z(self):
|
||||||
|
if not os.path.exists("/usr/local/z.lua"):
|
||||||
|
os.system("git clone --depth=1 https://github.com/skywind3000/z.lua.git /usr/local/z.lua")
|
||||||
|
|
||||||
|
def install_git(self):
|
||||||
|
if not self.cmd_exist("git"):
|
||||||
|
print("git is not exist")
|
||||||
|
self.check_link(home_dir+"~/.gitconfig", home_dir+"/.dotfile/git/.gitconfig")
|
||||||
|
|
||||||
|
def install_packer(self):
|
||||||
|
if not os.path.exists(home_dir+"/.local/share/nvim/site/pack/packer/start/packer.nvim"):
|
||||||
|
os.system("git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim")
|
||||||
|
else:
|
||||||
|
print("packer already installed")
|
||||||
|
class Base(object):
|
||||||
|
def cmd_exist(self, name):
|
||||||
|
from shutil import which
|
||||||
|
return which(name) is not None
|
||||||
|
|
||||||
|
def check_link(self, name:str,target:str):
|
||||||
|
if os.path.islink(name):
|
||||||
|
t = os.readlink(name)
|
||||||
|
if t == target:
|
||||||
|
print("path is right: %s"%name)
|
||||||
|
return
|
||||||
|
os.system("mv %s %s.bak"%(name,name))
|
||||||
|
os.system("ln -s %s %s"%(target,name))
|
||||||
|
|
||||||
def install_z():
|
|
||||||
os.system("git clone --depth=1 https://github.com/skywind3000/z.lua.git /usr/local/z.lua")
|
|
||||||
|
|
||||||
def install_git():
|
|
||||||
if not cmd_exist("git"):
|
|
||||||
print("git is not exist")
|
|
||||||
os.system("mv ~/.gitconfig ~/.gitconfig.bak")
|
|
||||||
os.system("ln -s ~/.dotfile/git/.gitconfig ~/.gitconfig")
|
|
||||||
|
|
||||||
def cmd_exist(name):
|
|
||||||
from shutil import which
|
|
||||||
return which(name) is not None
|
|
||||||
|
|
||||||
install_map = {
|
|
||||||
"neovim": install_neovim,
|
|
||||||
"z": install_z,
|
|
||||||
"git": install_git,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user