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
|
--[[
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
" ------------------------------------------------
Author: srdusr
Email: graytrevor98@gmail.com
Url: https://github.com/srdusr/nvim.git
------------------------------------------------ "
--]]
--[[init.]]
-- ========================================================================== --
-- == DEPENDENCIES == --
-- ========================================================================== --
-- ripgrep - https://github.com/BurntSushi/ripgrep
-- fd - https://github.com/sharkdp/fd
-- git - https://git-scm.com/
-- make - https://www.gnu.org/software/make/
-- c compiler - gcc or tcc or zig
-- -------------------------------------------------------------------------- --
-- Initialize config with this one liner in the terminal
--nvim --headless -c 'call mkdir(stdpath("config"), "p") | exe "edit" stdpath("config") . "/init.lua" | write | quit'
-- See startup time
--nvim --startuptime startup.log -c exit && tail -100 startup.log
local impatient_ok, impatient = pcall(require, "impatient")
if impatient_ok then
impatient.enable_profile()
end
--local stdpath = vim.fn.stdpath
local utils = require("user.utils")
vim.g.snippets = "luasnip"
-- check if we have the latest stable version of nvim
local expected_ver = "0.8.0"
local nvim_ver = utils.get_nvim_version()
if nvim_ver ~= expected_ver then
local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver)
vim.api.nvim_err_writeln(msg)
return
end
-- Schedule reading shadafile to improve the startup time
vim.opt.shadafile = "NONE"
vim.schedule(function()
vim.opt.shadafile = ""
vim.cmd("silent! rsh")
end)
-- IMPORTS
--require("impatient")
-- Load/reload modules here
local modules = {
"user.pack", -- Packer plugin manager
"user.opts", -- Options
"user.keys", -- Keymaps
"user.utils", -- Utilities
--"user.mods", -- Modules/functions
--"user.deps", -- Plugins
--"user.scripts",
"plugins.treesitter",
"plugins.telescope",
"plugins.nvim-tree",
"plugins.cmp",
"plugins.luasnip",
"plugins.colorizer",
"plugins.prettier",
"plugins.git",
"plugins.gitsigns",
"plugins.neoscroll",
"plugins.lsp",
"plugins.autopairs",
"plugins.null-ls",
"plugins.web-devicons",
"plugins.zen-mode",
"plugins.colorscheme",
"plugins.heirline",
--"plugins.dap",
--"plugins.toggleterm",
--"plugins.floatterm",
vim.notify("Nvim configuration reloaded!") -- print this when reloaded
}
-- Refresh module cache
for k, v in pairs(modules) do
package.loaded[v] = nil
require(v)
end
-- Improve speed by disabling some default plugins/modules
local builtins = {
"gzip",
"zip",
"zipPlugin",
"tar",
"tarPlugin",
"getscript",
"getscriptPlugin",
"vimball",
"vimballPlugin",
"2html_plugin",
--"matchit",
--"matchparen",
"logiPat",
"rrhelper",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"tutor_mode_plugin",
"fzf",
"spellfile_plugin",
"sleuth",
}
for _, plugin in ipairs(builtins) do
vim.g["loaded_" .. plugin] = 1
end
vim.g.do_filetype_nvim = 1
vim.g.did_load_filetypes = 0
|