feat: add some nice autocmds
This commit is contained in:
parent
65f3cf2928
commit
c9ef53245f
1 changed files with 14 additions and 0 deletions
|
@ -1,7 +1,21 @@
|
||||||
|
local function augroup(name)
|
||||||
|
return vim.api.nvim_create_augroup("wf_" .. name, { clear = true })
|
||||||
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
group = augroup("spellcheck"),
|
||||||
pattern = { "gitcommit", "markdown", "md", "mdx" },
|
pattern = { "gitcommit", "markdown", "md", "mdx" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.opt_local.spell = true
|
vim.opt_local.spell = true
|
||||||
vim.opt_local.wrap = true
|
vim.opt_local.wrap = true
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
group = augroup("close_with_q"),
|
||||||
|
pattern = { "fugitive", "git", "gitcommit" },
|
||||||
|
callback = function(event)
|
||||||
|
vim.bo[event.buf].buflisted = false
|
||||||
|
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue