-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautocmds.lua
More file actions
40 lines (38 loc) · 895 Bytes
/
Copy pathautocmds.lua
File metadata and controls
40 lines (38 loc) · 895 Bytes
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
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = require("custom.util").group,
callback = function()
vim.highlight.on_yank()
end,
})
-- Indent 2 spaces for these files
vim.api.nvim_create_autocmd("FileType", {
group = require("custom.util").group,
pattern = {
"html",
"javascript",
"javascriptreact",
"json",
"lua",
"sh",
"svelte",
"typescript",
"typescriptreact",
"xml",
"yaml",
},
callback = function()
vim.opt_local.softtabstop = 2
vim.opt_local.shiftwidth = 2
end,
})
-- Stop adding 'o' to the formatoptions.
-- This flag makes sure that the 'o' motion does not continue a comment
-- on a new line.
vim.api.nvim_create_autocmd("FileType", {
group = require("custom.util").group,
callback = function()
vim.opt.formatoptions:remove("o")
vim.opt.formatoptions:append("r")
end,
})