mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-24 21:41:04 +00:00
Autocommand
This commit is contained in:
parent
a2d591a173
commit
c6e845e390
4 changed files with 20 additions and 19 deletions
1
init.lua
1
init.lua
|
|
@ -1,6 +1,7 @@
|
||||||
require("user.options")
|
require("user.options")
|
||||||
require("user.keymaps")
|
require("user.keymaps")
|
||||||
require("user.plugins")
|
require("user.plugins")
|
||||||
|
require("user.autocmds")
|
||||||
|
|
||||||
vim.cmd.colorscheme("tokyonight-storm")
|
vim.cmd.colorscheme("tokyonight-storm")
|
||||||
|
|
||||||
|
|
|
||||||
17
lua/user/autocmds.lua
Normal file
17
lua/user/autocmds.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
callback = function()
|
||||||
|
local project_config = vim.fn.getcwd() .. "/.project.lua"
|
||||||
|
if vim.fn.filereadable(project_config) == 1 then
|
||||||
|
dofile(project_config)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- remove trailing spaces
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("%s/\\s\\+$//e")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
-- Autocmds are automatically loaded on the VeryLazy event
|
|
||||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
|
||||||
--
|
|
||||||
-- Add any additional autocmds here
|
|
||||||
-- with `vim.api.nvim_create_autocmd`
|
|
||||||
--
|
|
||||||
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
|
||||||
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("VimEnter", {
|
|
||||||
callback = function()
|
|
||||||
local project_config = vim.fn.getcwd() .. "/.project.lua"
|
|
||||||
if vim.fn.filereadable(project_config) == 1 then
|
|
||||||
dofile(project_config)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
Loading…
Add table
Reference in a new issue