-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
83 lines (73 loc) · 1.87 KB
/
init.lua
File metadata and controls
83 lines (73 loc) · 1.87 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
vim.opt.termguicolors = true
require("config.lazy")
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
group = vim.api.nvim_create_augroup("YankHl", { clear = true }),
callback = function()
vim.hl.on_yank({ higroup = "Visual", timeout = 200 })
end,
})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = require("config.utils.lsp").on_attach,
})
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = "Disable autoformat-on-save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
end, {
desc = "Re-enable autoformat-on-save",
})
vim.api.nvim_create_autocmd("User", {
pattern = "TelescopeFindPre",
callback = function()
vim.opt_local.winborder = "none"
vim.api.nvim_create_autocmd("WinLeave", {
once = true,
callback = function()
vim.opt_local.winborder = "rounded"
end,
})
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = "*",
callback = function()
local ft = vim.bo.filetype
local has_parser = pcall(vim.treesitter.get_parser, 0, ft)
if has_parser then
vim.treesitter.start()
end
end,
})
vim.diagnostic.config({
virtual_text = false,
virtual_lines = false,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = " ",
[vim.diagnostic.severity.WARN] = " ",
[vim.diagnostic.severity.HINT] = " ",
[vim.diagnostic.severity.INFO] = " ",
},
},
update_in_insert = true,
underline = false,
severity_sort = true,
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = true,
header = "",
prefix = "",
},
})