We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31d4246 commit a36c494Copy full SHA for a36c494
lua/configs.lua
@@ -123,12 +123,15 @@ vim.api.nvim_create_autocmd(
123
}
124
)
125
126
--- jump to the last position when reopening a file
127
-vim.cmd([[
128
- if has("autocmd")
129
- au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
130
- endif
131
-]])
+vim.api.nvim_create_autocmd(
+ "BufEnter",
+ {
+ desc = "jump to the last position when reopening a file",
+ pattern = "*",
+ group = group,
132
+ command = [[ if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif ]]
133
+ }
134
+)
135
136
vim.api.nvim_create_autocmd(
137
"BufWritePre",
0 commit comments