Repository navigation
Expand file tree
/
Copy pathautocmds.lua
More file actions
60 lines (53 loc) · 1.77 KB
/
Copy pathautocmds.lua
File metadata and controls
60 lines (53 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- 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
vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
local function augroup(name)
return vim.api.nvim_create_augroup("lazyvim_custom_" .. name, { clear = true })
end
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap"),
pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
group = augroup("sidekick_edgy_disable"),
pattern = "sidekick_terminal",
callback = function(ev)
vim.b[ev.buf].edgy_disable = true
vim.w[vim.api.nvim_get_current_win()].edgy_disable = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
group = augroup("spell"),
pattern = { "text", "plaintex", "typst", "gitcommit" },
callback = function()
vim.opt_local.spell = true
end,
})
vim.api.nvim_create_autocmd({ "TermOpen", "TermEnter", "BufEnter" }, {
group = augroup("lazygit_cursor"),
pattern = "term://*lazygit*",
callback = function()
vim.opt.guicursor =
"n-v-c-sm:block-blinkon0,i-ci-ve:ver25-blinkon0,r-cr-o:hor20-blinkon0,t:block-blinkon0-TermCursor"
vim.defer_fn(function()
io.write("\27[2 q")
io.flush()
end, 50)
end,
})
-- Herdr scrollback dumps (prefix+e): start at the bottom, read-only-ish scratch
vim.api.nvim_create_autocmd("BufReadPost", {
group = augroup("herdr_scrollback"),
pattern = "*herdr-scrollback-*",
callback = function(ev)
vim.bo[ev.buf].filetype = "log"
vim.schedule(function()
pcall(vim.cmd, "normal! G")
end)
end,
})