- add code action previews - change indent blankline style - more luasnip snippets - change default mason stuff - customize neorg more - change notify style - change startpage completely - add line info to statusline - change telescope style - change how todo comments look - make indentation work via treesitter
38 lines
992 B
Lua
38 lines
992 B
Lua
local function auto(event, opts)
|
|
a.nvim_create_autocmd(event, opts)
|
|
end
|
|
|
|
a.nvim_create_augroup('bufcheck', { clear = true })
|
|
|
|
auto('TextYankPost', { -- highlight yanks
|
|
group = 'bufcheck',
|
|
pattern = '*',
|
|
desc = 'Highlight on yank.',
|
|
callback = function()
|
|
vim.highlight.on_yank{ timeout = 250 }
|
|
end
|
|
})
|
|
|
|
auto('FileType', { -- start git messages in insert mode
|
|
group = 'bufcheck',
|
|
pattern = { 'gitcommit', 'gitrebase', },
|
|
desc = 'Start git messages in insert mode.',
|
|
command = 'startinsert | 1'
|
|
})
|
|
|
|
auto('BufRead', { -- return to last place
|
|
pattern = '*',
|
|
command = [[call setpos(".", getpos("'\""))]],
|
|
desc = 'Return to the last place the buffer was closed in.',
|
|
})
|
|
|
|
auto('BufWritePre', { -- make dirs when they don't exist
|
|
pattern = '*',
|
|
group = vim.api.nvim_create_augroup('auto_create_dir', { clear = true }),
|
|
desc = 'Basically mkdir -p.',
|
|
callback = function(ctx)
|
|
local dir = vim.fn.fnamemodify(ctx.file, ':p:h')
|
|
vim.fn.mkdir(dir, 'p')
|
|
end
|
|
})
|