nvim/init.lua

35 lines
951 B
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

G = require('G')
-- lazy.nvim 必须在 VSCode 和原生环境都可用原生用它装插件VSCode 的 vsc.lua 也需要 require('lazy')
local lazypath = G.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not G.loop.fs_stat(lazypath) then
G.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
})
end
G.opt.rtp:prepend(lazypath)
-- keymap 在两个环境都加载(基础键位都不依赖插件)
require('keymap')
if G.g.vscode then
-- VSCode Neovim 模式:只加载编辑插件,不加载 LSP/补全/主题/选项
require('vscode')
else
require('options')
local clone_prefix = G.use_ssh and 'git@github.com:%s.git' or 'https://github.com/%s.git'
require('lazy').setup(
require('plugs'), {
lockfile = G.fn.stdpath('data') .. '/lazy/lazy-lock.json',
git = {
url_format = clone_prefix,
}
}
)
end