mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
revert config loading refactor and inline augroups
This commit is contained in:
parent
e05d7658fb
commit
7f02013e5a
2 changed files with 7 additions and 12 deletions
|
|
@ -4,16 +4,15 @@
|
||||||
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { command = "checktime" })
|
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { command = "checktime" })
|
||||||
|
|
||||||
-- Highlight on yank
|
-- Highlight on yank
|
||||||
vim.api.nvim_create_augroup("_lazy_vim_highlight_on_yank", {})
|
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
end,
|
||||||
group = "_lazy_vim_highlight_on_yank",
|
group = vim.api.nvim_create_augroup("_lazy_vim_highlight_on_yank", { clear = true }),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- resize splits if window got resized
|
-- resize splits if window got resized
|
||||||
vim.api.nvim_create_augroup("_lazy_vim_resize_splits", {})
|
vim.api.nvim_create_augroup("_lazy_vim_resize_splits", { clear = true })
|
||||||
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd("tabdo wincmd =")
|
vim.cmd("tabdo wincmd =")
|
||||||
|
|
@ -22,7 +21,6 @@ vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- go to last loc when opening a buffer
|
-- go to last loc when opening a buffer
|
||||||
vim.api.nvim_create_augroup("_lazy_vim_go_to_last_loc_when_opening_a_buffer", {})
|
|
||||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
callback = function()
|
callback = function()
|
||||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||||
|
|
@ -31,11 +29,10 @@ vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
group = "_lazy_vim_go_to_last_loc_when_opening_a_buffer",
|
group = vim.api.nvim_create_augroup("_lazy_vim_go_to_last_loc_when_opening_a_buffer", { clear = true }),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- close some filetypes with <q>
|
-- close some filetypes with <q>
|
||||||
vim.api.nvim_create_augroup("_lazy_vim_close_some_filetypes_with_q", {})
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = {
|
pattern = {
|
||||||
"qf",
|
"qf",
|
||||||
|
|
@ -52,15 +49,15 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||||
vim.bo[event.buf].buflisted = false
|
vim.bo[event.buf].buflisted = false
|
||||||
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
||||||
end,
|
end,
|
||||||
group = "_lazy_vim_close_some_filetypes_with_q",
|
group = vim.api.nvim_create_augroup("_lazy_vim_close_some_filetypes_with_q", { clear = true }),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- wrap and check for spell in text filetypes
|
-- wrap and check for spell in text filetypes
|
||||||
vim.api.nvim_create_augroup("_lazy_vim_wrap_and_spell_check_text_filetypes", {})
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = { "gitcommit", "markdown" },
|
pattern = { "gitcommit", "markdown" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.opt_local.wrap = true
|
vim.opt_local.wrap = true
|
||||||
vim.opt_local.spell = true
|
vim.opt_local.spell = true
|
||||||
end,
|
end,
|
||||||
|
group = vim.api.nvim_create_augroup("_lazy_vim_wrap_and_spell_check_text_filetypes", { clear = true }),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,8 @@ end
|
||||||
---@param name "autocmds" | "options" | "keymaps"
|
---@param name "autocmds" | "options" | "keymaps"
|
||||||
function M.load(name)
|
function M.load(name)
|
||||||
local Util = require("lazy.core.util")
|
local Util = require("lazy.core.util")
|
||||||
local try_load = function(mod)
|
-- always load lazyvim, then user file
|
||||||
|
for _, mod in ipairs({ "lazyvim.config." .. name, "config." .. name }) do
|
||||||
Util.try(function()
|
Util.try(function()
|
||||||
require(mod)
|
require(mod)
|
||||||
end, {
|
end, {
|
||||||
|
|
@ -132,9 +133,6 @@ function M.load(name)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
-- always load lazyvim, then user file
|
|
||||||
try_load("lazyvim.config." .. name)
|
|
||||||
try_load("config." .. name)
|
|
||||||
if vim.bo.filetype == "lazy" then
|
if vim.bo.filetype == "lazy" then
|
||||||
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
||||||
vim.cmd([[do VimResized]])
|
vim.cmd([[do VimResized]])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue