This repository was archived by the owner on Dec 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcore.lua
More file actions
194 lines (194 loc) · 6.59 KB
/
core.lua
File metadata and controls
194 lines (194 loc) · 6.59 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
return {
-- customize alpha options
{
"AstroNvim/astrotheme",
commit = "7a52efdd9a5bd302445d284a424467f92e4b1d44",
optional = true,
},
{
"nvim-neo-tree/neo-tree.nvim",
enabled = false,
},
{
"goolord/alpha-nvim",
opts = function(_, opts)
-- customize the dashboard header
opts.section.header.val = require("user.header")
return opts
end,
},
{
"L3MON4D3/LuaSnip",
config = function(plugin, opts)
require("plugins.configs.luasnip")(plugin, opts) -- include the default astronvim config that calls the setup call
-- add more custom luasnip configuration such as filetype extend or custom snippets
-- load snippets paths
require("luasnip.loaders.from_vscode").lazy_load {
-- this can be used if your configuration lives in ~/.config/nvim
-- if your configuration lives in ~/.config/astronvim, the full path
-- must be specified in the next line
paths = { vim.env.XDG_CONFIG_HOME .. "/astronvim/lua/user/snippets" },
}
end,
},
-- {
-- "windwp/nvim-autopairs",
-- config = function(plugin, opts)
-- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- add more custom autopairs configuration such as custom rules
-- local npairs = require "nvim-autopairs"
-- local Rule = require "nvim-autopairs.rule"
-- local cond = require "nvim-autopairs.conds"
-- npairs.add_rules(
-- {
-- Rule("$", "$", { "tex", "latex" })
-- -- don't add a pair if the next character is %
-- :with_pair(cond.not_after_regex "%%")
-- -- don't add a pair if the previous character is xxx
-- :with_pair(
-- cond.not_before_regex("xxx", 3)
-- )
-- -- don't move right when repeat character
-- :with_move(cond.none())
-- -- don't delete if the next character is xx
-- :with_del(cond.not_after_regex "xx")
-- -- disable adding a newline when you press <cr>
-- :with_cr(cond.none()),
-- },
-- -- disable for .vim files, but it work for another filetypes
-- Rule("a", "a", "-vim")
-- )
-- end,
-- },
-- By adding to the which-key config and using our helper function you can add more which-key registered bindings
-- {
-- "folke/which-key.nvim",
-- config = function(plugin, opts)
-- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- Add bindings which show up as group name
-- local wk = require "which-key"
-- wk.register({
-- b = { name = "Buffer" },
-- }, { mode = "n", prefix = "<leader>" })
-- end,
-- },
{
"max397574/better-escape.nvim",
opts = function(_, opts)
opts.mapping = { "JK", "JJ", "jk", "jj" }
opts.keys = function() return vim.api.nvim_win_get_cursor(0)[2] > 1 and "<esc>l" or "<esc>" end
end,
},
{
"onsails/lspkind.nvim",
opts = function(_, opts)
-- use codicons preset
opts.preset = "codicons"
-- set some missing symbol types
opts.symbol_map = {
Array = "",
Boolean = "",
Key = "",
Namespace = "",
Null = "",
Number = "",
Object = "",
Package = "",
String = "",
}
opts.mode = "symbol_text"
opts.menu = {
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
orgmode = "[Org]",
}
return opts
end,
},
{
-- override nvim-cmp plugin
"hrsh7th/nvim-cmp",
keys = { ":", "/", "?" }, -- lazy load cmp on more keys along with insert mode
dependencies = {
"hrsh7th/cmp-cmdline", -- add cmp-cmdline as dependency of cmp
},
opts = function(_, opts)
local cmp = require("cmp")
-- configure `cmp-cmdline` as described in their repo: https://github.com/hrsh7th/cmp-cmdline#setup
opts.sources = cmp.config.sources {
{ name = "nvim_lsp", priority = 1000 },
{ name = "luasnip", priority = 750 },
{ name = "orgmode", priority = 650 },
{ name = "buffer", priority = 500 },
{ name = "path", priority = 250 },
}
---@diagnostic disable-next-line: missing-fields
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
---@diagnostic disable-next-line: missing-fields
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" },
},
},
}),
})
opts.mapping["<M-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" })
return opts
end,
},
{
"kevinhwang91/nvim-ufo",
opts = function(_, opts)
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (" %d "):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, "MoreMsg" })
return newVirtText
end
opts.fold_virt_text_handler = handler
end,
},
{
"mfussenegger/nvim-dap",
dependencies = { "theHamsta/nvim-dap-virtual-text", config = true },
},
{
"lukas-reineke/indent-blankline.nvim",
opts = function(_, opts) require("astronvim.utils").extend_tbl(opts.filetype_exclude, { "oil" }) end,
},
}