feat: initial release
This commit is contained in:
17 files changed
+251
No files matched your search
@@ -0,0 +1,23 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(opts)
|
||||
opts = opts or {}
|
||||
local exclude = opts.exclude or { "gitcommit" }
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
group = vim.api.nvim_create_augroup("tiny-lastplace", { clear = true }),
|
||||
callback = function(event)
|
||||
local buf = event.buf
|
||||
if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].tiny_lastplace then
|
||||
return
|
||||
end
|
||||
vim.b[buf].tiny_lastplace = 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
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in new issue
Block a user