mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-22 04:21:03 +00:00
Auto create folders on write
This commit is contained in:
parent
c6e845e390
commit
8b966f24b9
1 changed files with 13 additions and 1 deletions
|
|
@ -1,3 +1,15 @@
|
|||
-- Create parent directories when saving a file
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
local dir = vim.fn.expand("<afile>:p:h")
|
||||
if vim.fn.isdirectory(dir) == 0 then
|
||||
vim.fn.mkdir(dir, "p")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Load project specific configuration
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
local project_config = vim.fn.getcwd() .. "/.project.lua"
|
||||
|
|
@ -7,7 +19,7 @@ vim.api.nvim_create_autocmd("VimEnter", {
|
|||
end,
|
||||
})
|
||||
|
||||
-- remove trailing spaces
|
||||
-- Remove trailing spaces
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue