-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
128 lines (117 loc) · 3.24 KB
/
init.lua
File metadata and controls
128 lines (117 loc) · 3.24 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
local lazy_available = false
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
if vim.fn.executable("git") == 1 then
vim.fn.system({
"git", "clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
lazy_available = true
end
else
lazy_available = true
end
-- disable, so which-key does not fall back to it
vim.keymap.set({ "n", "v" }, "s", "<Nop>")
vim.keymap.set({ "n", "x" }, "gc", "<Nop>")
vim.keymap.set({ "n", "x" }, "gcc", "<Nop>")
if 1 == vim.fn.has("nvim-0.11") then
-- delete default lsp-related keybinds (replaced by picker-based)
vim.keymap.del("n", "gra") -- code action
vim.keymap.del("n", "grr") -- references
vim.keymap.del("n", "gri") -- implementation
vim.keymap.del("n", "gO") -- document symbols
vim.keymap.del("n", "grn") -- rename
vim.keymap.del("n", "grt") -- type definiton
end
-- custom global variables
vim.g.solutionfmt = {
["begin"] = "@solution begin",
["end"] = "@solution end"
}
---@type "nightfox" | "dayfox" | "dawnfox" | "duskfox" | "nordfox" | "terafox" | "carbonfox"
vim.g.nightfox_flavour = "nordfox"
---@type "none" | "single" | "rounded" | "solid" | "shadow"
vim.g.float_border_style = "single"
vim.g.signs = {
Error = "",
Warn = "",
Hint = "",
Info = "",
}
vim.g.transparent = vim.env["TERM_TRANSPARENT"] ~= nil
vim.opt.cmdheight = 0
vim.opt.laststatus = 3
if lazy_available then
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins", {
change_detection = {
enabled = false,
},
performance = {
cache = { enabled = true },
rtp = {
reset = true,
disabled_plugins = {
"tutor",
"netrwPlugin"
},
},
readme = {
enabled = false
}
},
})
end
vim.g.c_syntax_for_h = 1 -- assume .h files are c, not c++
vim.opt.guicursor = "i-n-v-c-sm:block,ci-ve:ver25,r-cr-o:hor20" -- block cursor in insert
vim.opt.mouse = "a"
vim.opt.clipboard = "unnamedplus"
vim.opt.virtualedit = "block"
vim.opt.number = true
vim.opt.relativenumber = false
vim.opt.wrap = false
vim.opt.signcolumn = "yes"
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.smartcase = true
vim.opt.expandtab = true
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.sidescrolloff = 3
vim.opt.scrolloff = 1
vim.opt.history = 100
vim.opt.showmode = false
vim.opt.synmaxcol = 360
vim.opt.exrc = true
vim.opt.updatetime = 2000
if vim.env["NVIM_SWAP_DIR"] then
if vim.env["NVIM_SWAP_DIR"] == "ram" then
vim.opt.updatetime = 750
vim.api.nvim_set_option_value(
"directory",
"/tmp/.nvim_swap_dir_" .. (vim.env["USER"] or "") .. "//",
{ scope = "global" })
else
vim.api.nvim_set_option_value(
"directory",
vim.env["NVIM_SWAP_DIR"],
{ scope = "global" })
end
end
require("config.autocmds")
-- load config after loading all UI elements
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
require("config.commands")
require("config.maps")
end,
})
if not lazy_available then
vim.api.nvim_exec_autocmds("User", { pattern = "VeryLazy" })
end