1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 12:48:01 +00:00

[neovim] Add autocomand to resize splits when window size got resized

This commit is contained in:
Daniel Carrillo 2023-11-05 19:30:29 +01:00
parent 66a3e25a2b
commit 8a7b28f1cb
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16

View File

@ -5,6 +5,15 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
end,
})
-- resize splits if window got resized
vim.api.nvim_create_autocmd({ "VimResized" }, {
callback = function()
local current_tab = vim.fn.tabpagenr()
vim.cmd("tabdo wincmd =")
vim.cmd("tabnext " .. current_tab)
end,
})
-- Set expandtab=true in several file types
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "go", "makefile", "lua" },
@ -15,12 +24,18 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
-- Use 'q' to quit from common plugins
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "qf", "help", "man", "lspinfo" },
callback = function()
vim.cmd([[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]])
pattern = {
"help",
"lspinfo",
"man",
"notify",
"qf",
"query",
"checkhealth",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})