-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
115 lines (103 loc) · 4.41 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
-- NOTE: NIXCATS USERS:
-- NOTE: there are also notes added as a tutorial of how to use the nixCats lazy wrapper.
-- you can search for the following string in order to find them:
-- NOTE: nixCats:
-- like this one:
-- NOTE: nixCats: this just gives nixCats global command a default value
-- so that it doesnt throw an error if you didnt install via nix.
-- usage of both this setup and the nixCats command is optional,
-- but it is very useful for passing info from nix to lua so you will likely use it at least once.
require('nixCatsUtils').setup {
non_nix_value = true,
}
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Python-like string formatting with %
getmetatable('').__mod = function(a, b)
if not b then
return a
elseif type(b) == 'table' then
return string.format(a, unpack(b))
else
return string.format(a, b)
end
end
-- print('%5.2f' % math.pi)
-- print('%-10.10s %04d' % { 'test', 123 })
-- Set to true if you have a Nerd Font installed and selected in the terminal
-- NOTE: nixCats: we asked nix if we have it instead of setting it here.
-- because nix is more likely to know if we have a nerd font or not.
vim.g.have_nerd_font = nixCats 'have_nerd_font'
-- NOTE: nixCats: this is where we define some arguments for the lazy wrapper.
local pluginList = nil
local nixLazyPath = nil
if require('nixCatsUtils').isNixCats then
local allPlugins = require('nixCats').pawsible.allPlugins
-- it is called pluginList because we only need to pass in the names
-- this list literally just tells lazy.nvim not to download the plugins in the list.
pluginList = require('nixCatsUtils.lazyCat').mergePluginTables(allPlugins.start, allPlugins.opt)
-- it wasnt detecting that these were already added
-- because the names are slightly different from the url.
-- when that happens, add them to the list, then also specify the new name in the lazySpec
-- pluginList[ [[Comment.nvim]] ] = ''
pluginList[ [[LuaSnip]] ] = ''
-- alternatively you can do it all in the plugins spec instead of modifying this list.
-- just set the name and then add `dev = require('nixCatsUtils').lazyAdd(false, true)` to the spec
-- HINT: to view the names of all plugins downloaded via nix, use the `:NixCats pawsible` command.
-- we also want to pass in lazy.nvim's path
-- so that the wrapper can add it to the runtime path
-- as the normal lazy installation instructions dictate
nixLazyPath = allPlugins.start[ [[lazy.nvim]] ]
end
-- NOTE: nixCats: You might want to move the lazy-lock.json file
local function getlockfilepath()
if require('nixCatsUtils').isNixCats and type(require('nixCats').settings.unwrappedCfgPath) == 'string' then
return require('nixCats').settings.unwrappedCfgPath .. '/lazy-lock.json'
else
return vim.fn.stdpath 'config' .. '/lazy-lock.json'
end
end
local lazyOptions = {
lockfile = getlockfilepath(),
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
cmd = '⌘',
config = '🛠',
event = '📅',
ft = '📂',
init = '⚙',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
}
-- [[ Configure and install plugins ]]
--
-- To check the current status of your plugins, run
-- :Lazy
--
-- You can press `?` in this menu for help. Use `:q` to close the window
--
-- To update plugins you can run
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
-- NOTE: nixCats: this the lazy wrapper.
require('nixCatsUtils.lazyCat').setup(pluginList, nixLazyPath, {
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
{ import = 'custom.plugins' },
}, lazyOptions)
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et