refactor(autocmds): simplified autocmd to jump to last location of file

This commit is contained in:
Folke Lemaitre 2022-12-31 14:30:12 +01:00
parent 1467c900ac
commit 43a97bc7ce
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -9,18 +9,9 @@ vim.api.nvim_create_autocmd("TextYankPost", {
})
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPre", {
pattern = "*",
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = "<buffer>",
once = true,
callback = function()
vim.cmd(
[[if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif]]
)
end,
})
vim.cmd([[silent! normal! g`"]])
end,
})