.config/nvim/lua/config/autocmds.lua

changeset 1165
840f0fde07e2
parent 1161
2543467f42da
child 1166
34bf03fa07e4
equal deleted inserted replaced
1164:a8b6384c8738 1165:840f0fde07e2
19 end 19 end
20 pcall(cmd.wa) 20 pcall(cmd.wa)
21 end) 21 end)
22 22
23 -- >> auto mkpath on write 23 -- >> auto mkpath on write
24 autocmd(g, "BufWritePre", "*", { 24 autocmd(g, "BufWritePre", "*", function(ctx)
25 callback = function(ctx) 25 if vim.bo[ctx.buf].buftype == "" and not string.match(ctx.file, "^[%w]+:") then
26 if vim.bo[ctx.buf].buftype == "" and not string.match(ctx.file, "^[%w]+:") then 26 fn.mkdir(fn.fnamemodify(ctx.file, ":p:h"), "p")
27 fn.mkdir(fn.fnamemodify(ctx.file, ":p:h"), "p") 27 end
28 end 28 end)
29 end,
30 })
31 29
32 -- >> auto session ? 30 -- >> auto session ?
33 31
34 -- >> jump to last position on open 32 -- >> jump to last position on open
35 local nojump = vim.regex([[mail\|commit\|rebase]]) 33 local nojump = vim.regex([[mail\|commit\|rebase]])

mercurial