mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-24 12:44:49 +02:00
refactor(autocmds): simplified autocmd to jump to last location of file
This commit is contained in:
parent
1467c900ac
commit
43a97bc7ce
1 changed files with 2 additions and 11 deletions
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue