-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
139 lines (124 loc) · 3.54 KB
/
init.lua
File metadata and controls
139 lines (124 loc) · 3.54 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
vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/"
vim.g.mapleader = " "
vim.g.vscode_snippets_path = vim.fn.stdpath "config" .. "/custom/snippets/vscode"
vim.g.snipmate_snippets_path = vim.fn.stdpath "config" .. "/custom/snippets/snipmate"
vim.o.termguicolors = true
vim.g.is_mac = vim.loop.os_uname().sysname == "Darwin"
vim.g.navic_silence = true
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.g.maplocalleader = "\\"
vim.opt.rtp:prepend(lazypath)
vim.opt.splitbelow = false
-- disbale mouse scroll
vim.opt.mouse = ""
vim.opt.mousescroll = "ver:0,hor:0"
local lazy_config = require "configs.lazy"
Icons = require "configs.icons"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
config = function()
require "options"
end,
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "nvchad.autocmds"
vim.schedule(function()
require "mappings"
end)
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "solarized",
-- group = ...,
callback = function()
vim.api.nvim_set_hl(0, "CopilotSuggestion", {
fg = "#555555",
ctermfg = 8,
force = true,
})
end,
})
vim.g.merginal_splitType = ""
vim.g.merginal_showCommands = 0
vim.g.sandwich_no_default_key_mappings = 0
vim.g.operator_sandwich_no_default_key_mappings = 0
vim.cmd "set nu!"
vim.cmd "set rnu"
local autocmd = vim.api.nvim_create_autocmd
vim.g.hl_search = false
vim.cmd "set nohlsearch"
autocmd("CmdlineChanged", {
pattern = "*",
callback = function()
if
vim.fn.getcmdtype() == "/"
or vim.fn.getcmdtype() == "?"
or string.sub(vim.fn.getcmdline(), 1, 2) == "g/"
or string.sub(vim.fn.getcmdline(), 1, 3) == "g!/"
or string.sub(vim.fn.getcmdline(), 1, 2) == "v/"
then
vim.cmd "set hlsearch"
else
if not vim.g.hl_search then
vim.cmd "set nohlsearch"
end
end
end,
})
autocmd("CmdlineLeave", {
pattern = "*",
callback = function()
if not vim.g.hl_search then
vim.cmd "set nohlsearch"
end
end,
})
vim.keymap.set("n", "<leader>h", "")
vim.keymap.set("n", "<leader>hl", function()
vim.g.hl_search = not vim.g.hl_search
if vim.g.hl_search then
vim.notify "Highlight Search is enabled"
vim.cmd "set hlsearch"
else
vim.notify "Highlight Search is disabled"
vim.cmd "set nohlsearch"
end
end)
vim.cmd "set nu!"
require("flash").toggle()
-- require("base46").toggle_transparency()
vim.api.nvim_create_autocmd("User", {
pattern = "OilActionsPost",
callback = function(event)
if event.data.actions.type == "move" then
Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
end
end,
})
-- vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function()
-- require "base46".toggle_transparency()
-- end,
-- once = true,
-- })
vim.opt.conceallevel = 2
vim.g.mkdp_echo_preview_url = true
vim.opt.ssop = "blank,buffers,curdir,folds,tabpages,winsize,terminal,winpos,localoptions"
vim.opt.spellfile = vim.fn.stdpath "config" .. "/spell/en.utf-8.add"
vim.g.lsp_enabled = true
-- vim.lsp.enable { "clangd" }
-- vim.keymap.set("n", "<Space>", function()
-- require("which-key").show({"<Space>", loop=true})
-- end)