+ (vim.hl or vim.highlight).on_yank()
+ end,
+})
+
+-- resize splits if window got resized
+vim.api.nvim_create_autocmd({ "VimResized" }, {
+ group = augroup("resize_splits"),
+ callback = function()
+ local current_tab = vim.fn.tabpagenr()
+ vim.cmd("tabdo wincmd =")
+ vim.cmd("tabnext " .. current_tab)
+ end,
+})
+
+-- go to last loc when opening a buffer
+vim.api.nvim_create_autocmd("BufReadPost", {
+ group = augroup("last_loc"),
+ callback = function(event)
+ local exclude = { "gitcommit" }
+ local buf = event.buf
+ if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].rmz_last_loc then
+ return
+ end
+ vim.b[buf].rmz_last_loc = true
+ local mark = vim.api.nvim_buf_get_mark(buf, '"')
+ local lcount = vim.api.nvim_buf_line_count(buf)
+ if mark[1] > 0 and mark[1] <= lcount then
+ pcall(vim.api.nvim_win_set_cursor, 0, mark)
+ end