24 lines
677 B
Lua
24 lines
677 B
Lua
|
|
-- Highlight yanked text
|
|
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
|
callback = function()
|
|
vim.highlight.on_yank()
|
|
end,
|
|
group = highlight_group,
|
|
pattern = "*",
|
|
})
|
|
|
|
-- Go to last cursor position when opening a file
|
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
|
callback = function()
|
|
local ft = vim.bo.filetype
|
|
if ft ~= "commit" and ft ~= "rebase" then
|
|
local last_pos = vim.fn.line("'\"")
|
|
if last_pos > 1 and last_pos <= vim.fn.line("$") then
|
|
vim.cmd('normal! g`"')
|
|
end
|
|
end
|
|
end,
|
|
})
|