-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.nvim.lua
More file actions
42 lines (37 loc) · 1.03 KB
/
.nvim.lua
File metadata and controls
42 lines (37 loc) · 1.03 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
vim.o.autoread = true
vim.g.rustaceanvim = {
server = {
settings = {
["rust-analyzer"] = {
rustfmt = {
extraArgs = { "+nightly" },
},
},
},
},
}
local running = false
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.java",
callback = function(args)
if running then
return
end
running = true
vim.fn.jobstart({ "./mvnw", "spotless:apply", "-DspotlessFiles=" .. args.file }, {
stdout_buffered = true,
stderr_buffered = true,
on_exit = function(_, code)
vim.schedule(function()
if code ~= 0 then
vim.notify("spotless failed (" .. code .. ")", vim.log.levels.ERROR)
running = false
return
end
vim.cmd("checktime")
running = false
end)
end,
})
end,
})