-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
258 lines (219 loc) · 7.56 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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
-- NEOVIM CONFIG MADE BY @me_kebab_man (DISCORD), @MeKebabMan (GITHUB)
-- Copyright MeKebabMan 2024 Mit License
-- NEOVIM CONFIG MADE BY @me_kebab_man (DISCORD), @MeKebabMan (GITHUB)
-- KEBAB VIM GITHUB REPOSITORY: https://github.com/MeKebabMan/KebabVim
-- SUPPORTED OS:
-- Linux / Unix
-- Mac OS (Not tested)
-- WSL+ with Windows
-- UNSUPPORTED OS:
-- Windows (WORKING ON IT!)
-- LOAD USER VARIABLES!
local function GetVariables(_config_file)
if _config_file and type(_config_file) ~= "string" then
vim.notify("Could not parse Kebabvim config", vim.log.levels.ERROR, {
title = "ERROR",
})
return false
end
local config_file = vim.fn.expand(tostring(_config_file))
-- read the file
local file = io.open(config_file, "r")
if not file then
vim.notify("Could not parse Kebabvim config", vim.log.levels.ERROR, {
title = "ERROR",
})
return false
end
local content = file:read("*all")
file:close()
-- parse the file content
local data = {}
for line in content:gmatch("[^\r\n]+") do
local key, value = line:match("([^=]+)=([^=]+)")
if key and value then
data[key:match("^%s*(.-)%s*$")] = value:match("^%s*(.-)%s*$")
end
end
-- Convert all the variables into readable data
for key, value in pairs(data) do
if key and value then
if key and string.lower(tostring(value)) == string.lower(tostring("true")) then
vim.g[key] = true
elseif key and string.lower(tostring(value)) == string.lower(tostring("false")) then
vim.g[key] = false
elseif key and value:sub(1, 1) == '"' and value:sub(-1) == '"' then
vim.g[key] = tostring(value:sub(2, -2))
elseif key and string.lower(tostring(value)) == string.lower(tostring("null")) then
vim.g[key] = nil
elseif key and string.lower(value:sub(1, 1)) == string.lower("P") then
if value:sub(2, 2) == '"' and value:sub(-1) == '"' then
vim.g[key] = vim.fn.expand(tostring(value:sub(3, -2)))
end
else
vim.g[key] = value
end
end
end
return true
end
local os = require("os")
GetVariables("~/.config/nvim/KebabVim.config")
-- Lazy.nvim plugin manager
-- PLUGIN MANAGER: https://github.com/folke/lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- KEBAB VIM SET UP!
local function directory_exists(directory)
local stat = vim.loop.fs_stat(vim.fn.expand(directory))
return stat and stat.type == "directory"
end
-- SET DEFAULT VARIABLES
if not vim.g.NvimPath then
vim.g.NvimPath = vim.fn.expand("~/.config/nvim/")
end
if not vim.g.KebabVimPath then
vim.g.KebabVimPath = vim.fn.expand("~/.config/nvim/KebabVim/")
end
if not vim.g.AutoUpdate then
vim.g.AutoUpdate = true
end
if not vim.g.UseDefaultHomeScreen then
vim.g.UseDefaultHomeScreen = true
end
if not vim.g.ReadMeTXT then
vim.g.ReadMeTXT = "NVIM_README.txt"
end
if not vim.g.GitBranch then
vim.g.GitBranch = "main"
end
if not vim.g.UseExtraPlugins then
vim.g.UseExtraPlugins = true
end
if directory_exists(vim.fn.expand(tostring(vim.g.KebabVimPath))) then
if not vim.g.KebabVimPath or not vim.g.NvimPath then
return
end
vim.opt.rtp:prepend(vim.fn.expand(tostring(vim.g.KebabVimPath)))
package.path = package.path .. ";" .. vim.fn.expand(tostring(vim.g.KebabVimPath)) .. "/?.lua"
local KebabVim_config = require("KebabVim_config")
-- Plugin manager
require("lazy").setup(KebabVim_config.plugins, {})
local KebabVim_utils = require("KebabVim_utils")
local plugin_module = require("plugin_module")
local vim_options = require("vim_options")
KebabVim_utils.StartUp()
-- Vim options
vim_options.SetKebabVimDefault()
-- Plugins
if vim.g.UseDefaultHomeScreen == true then
plugin_module.alphanvim()
end
plugin_module.SetTheme("kanagawa")
plugin_module.lualine()
plugin_module.nvim_treesitter(KebabVim_config.treesitter)
plugin_module.KebabVimCMP()
plugin_module.KebabVimLSP(KebabVim_config.language_servers)
plugin_module.KebabVimNone_ls()
plugin_module.KebabVimFileExplorer("<C-e>", {
window = {
width = 25,
},
})
plugin_module.Telescope()
plugin_module.Autotag()
plugin_module.KebabVimAutoPairs()
plugin_module.KebabVim_SetUp_DefaultNotify()
plugin_module.barbar()
if vim.g.UseExtraPlugins == true then
require("Comment").setup({})
require("gitsigns").setup({})
plugin_module.which_key()
if vim.g.AutoUpdate == true then
if not KebabVim_utils.UPDATE() then
vim.notify("Failed to do a update check!", vim.log.levels.ERROR, {
title = "ERROR",
})
end
end
end
else
require("lazy").setup({
{
"rcarriga/nvim-notify",
},
{
"maxmx03/solarized.nvim",
},
{
"nvim-treesitter/nvim-treesitter",
},
{
"goolord/alpha-nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
},
}, {})
vim.opt.termguicolors = true
vim.notify = require("notify")
vim.notify("KebabVim directory does not exist! Falling back!", vim.log.levels.ERROR)
vim.cmd([[
syntax enable
set background=dark
colorscheme solarized
set number
set cursorline
set laststatus=3
]])
require("nvim-treesitter").setup()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"lua",
"c",
"markdown",
"vim",
"vimdoc",
"query",
"typescript",
"javascript",
"html",
"css",
"json",
"yaml",
"xml",
"c_sharp",
},
highlight = {
enable = true,
},
})
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
[[██╗░░██╗███████╗██████╗░░█████╗░██████╗░██╗░░░██╗██╗███╗░░░███╗ ░░██╗ ██╗░░██╗ ██╗░░]],
[[██║░██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗██║░░░██║██║████╗░████║ ░██╔╝ ╚██╗██╔╝ ╚██╗░]],
[[█████═╝░█████╗░░██████╦╝███████║██████╦╝╚██╗░██╔╝██║██╔████╔██║ ██╔╝░ ░╚███╔╝░ ░╚██╗]],
[[██╔═██╗░██╔══╝░░██╔══██╗██╔══██║██╔══██╗░╚████╔╝░██║██║╚██╔╝██║ ╚██╗░ ░██╔██╗░ ░██╔╝]],
[[██║░╚██╗███████╗██████╦╝██║░░██║██████╦╝░░╚██╔╝░░██║██║░╚═╝░██║ ░╚██╗ ██╔╝╚██╗ ██╔╝░]],
[[╚═╝░░╚═╝╚══════╝╚═════╝░╚═╝░░╚═╝╚═════╝░░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝ ░░╚═╝ ╚═╝░░╚═╝ ╚═╝░░]],
}
dashboard.section.buttons.val = {
dashboard.button("e", " New file (DEFAULT)", ":ene <BAR> startinsert <CR>"),
dashboard.button("q", " Quit NVIM (DEFAULT)", ":qa<CR>"),
}
alpha.setup(dashboard.opts)
end