feat: better modules aragement.
This commit is contained in:
parent
de11ee0676
commit
6e967a751f
49 changed files with 27 additions and 19 deletions
25
modules/cross-platform/home-manager/nvim/autocommands.lua
Normal file
25
modules/cross-platform/home-manager/nvim/autocommands.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("crony_" .. name, { clear = true })
|
||||
end
|
||||
|
||||
-- [[ Auto create parent directory if it doesn't exist ]]
|
||||
autocmd({ "BufWritePre" }, {
|
||||
group = augroup("auto_create_dir"),
|
||||
callback = function(event)
|
||||
if event.match:match("^%w%w+://") then
|
||||
return
|
||||
end
|
||||
local file = vim.loop.fs_realpath(event.match) or event.match
|
||||
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||
end,
|
||||
})
|
||||
|
||||
-- [[ Settings for default neovim terminal ]]
|
||||
autocmd({ "TermOpen" }, {
|
||||
group = augroup("term_open"),
|
||||
callback = function()
|
||||
vim.opt.number = false
|
||||
vim.opt.relativenumber = false
|
||||
end
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue