-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinit.lua
58 lines (46 loc) · 1.84 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- NOTE: Current Lua version is 5.1 in neovim 0.8
-- Learn nvim-lua: https://github.com/nanotee/nvim-lua-guide
local util = require('one.util')
local CM = require('one.config')
local consts = require('one.consts')
local PM = require('one.plugin-manager')
local One = require('one.one')
local FT = require('one.filetype')
local dynamic = require('one.plugins.completion.dynamic.source')
One.CM = CM
One.PM = PM
One.FT = FT
One.consts = consts
One.util = util
One.cmp = { add = dynamic.add }
local function preset()
if vim.loader then vim.loader.enable() end
table.unpack = unpack
-- Set default highlights before plugins loaded
vim.cmd [[ colorscheme habamax ]] -- habamax is the nvim builtin colorscheme.
vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'black' }) -- The default background is ugly. (NormalFloat -> Pmenu)
end
-- @type PlugOpts see ../../doc/types.md
-- @param [opts] {table}
-- @param [opts.config] {table}
-- @param [opts.configFn] {function(config):table}
-- The returned table will be merged into config.
-- @param [opts.onlyPlugins] {string[]|nil}
-- It's useful for debug. Defaults to nil.
-- If set empty table, all builtin and user-defined plugins are disabled.
-- If set non-empty table, only these plugins are not disabled.
-- @param [opts.plugins] {PlugOpts[]|function(builtin: function(path: string):PlugOpts, config: Config):PlugOpts[]}
-- If passed a function, the first parameter is used to get the builtin PlugOpts.
-- The second parameter is the config of framework.
One.setup = function(opts)
preset()
CM.setup(opts.config or {})
local config = CM.config
if config.global then _G[config.global] = One end
-- Do not set mapleader in vim-options plugin. Because user may use `onlyPlugins` to disable all plugins.
vim.g.mapleader = config.leaderKey
PM.setup(opts)
FT.setup()
vim.opt.rtp:append(consts.ONE_DIR)
end
return One