refactor(autocmds): simplified autocmd to jump to last location of file
This commit is contained in:
1 file changed
+2
-11
+2
-11
@@ -9,18 +9,9 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- go to last loc when opening a buffer
|
-- go to last loc when opening a buffer
|
||||||
vim.api.nvim_create_autocmd("BufReadPre", {
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
pattern = "*",
|
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.cmd([[silent! normal! g`"]])
|
||||||
pattern = "<buffer>",
|
|
||||||
once = true,
|
|
||||||
callback = function()
|
|
||||||
vim.cmd(
|
|
||||||
[[if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif]]
|
|
||||||
)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user