mirror of
https://github.com/tomru/nvim.git
synced 2026-03-04 15:07:16 +01:00
35 lines
819 B
Lua
35 lines
819 B
Lua
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
desc = 'Highlight when yanking (copying) text',
|
|
group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
|
|
callback = function()
|
|
vim.highlight.on_yank()
|
|
end,
|
|
})
|
|
|
|
-- return to last cursor position when reopening a file
|
|
vim.api.nvim_create_autocmd('BufReadPost', {
|
|
callback = function()
|
|
local last_pos = vim.fn.line '\'"'
|
|
if last_pos > 1 and last_pos <= vim.fn.line '$' then
|
|
vim.cmd 'normal! g`"'
|
|
end
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
pattern = {
|
|
'checkhealth',
|
|
'fugitive*',
|
|
'git',
|
|
'help',
|
|
'lspinfo',
|
|
'netrw',
|
|
'notify',
|
|
'qf',
|
|
'query',
|
|
},
|
|
callback = function()
|
|
vim.keymap.set('n', 'q', vim.cmd.close, { desc = 'Close the current buffer', buffer = true })
|
|
end,
|
|
})
|