add some autocmds

This commit is contained in:
2023-02-11 23:06:19 +08:00
parent 2e8338395a
commit b7b98a0985
3 changed files with 25 additions and 3 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
require 'configs.options'
require 'configs.keymaps'
require 'configs.lazy'
require("configs.options")
require("configs.keymaps")
require("configs.autocmds")
require("configs.lazy")
+19
View File
@@ -0,0 +1,19 @@
-- close some filetypes with <q>
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("close_with_q", { clear = true }),
pattern = {
"qf", -- quickfix window
"help",
"man",
"notify",
"lspinfo",
"spectre_panel",
"startuptime",
"tsplayground",
"PlenaryTestPopup",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<Cmd>close<CR>", { buffer = event.buf, silent = true, desc = "Close Buffer" })
end,
})
+2
View File
@@ -2,6 +2,8 @@ vim.opt.clipboard = 'unnamedplus'
vim.opt.confirm = true -- Confirm to save changes before exiting modified buffer
vim.opt.cursorline = true -- Enable highlighting of the current line
vim.opt.fileencoding = 'utf-8'
-- vim.opt.foldmethod = "expr"
-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.list = true
vim.opt.mouse = 'a' -- Enable mouse mode
vim.opt.number = true