mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-02 03:47:54 +00:00
feat(nvim): cleanup, fixes and helpers
This commit is contained in:
@@ -7,24 +7,48 @@ local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
|
||||
|
||||
-- ── Highlight on yank ───────────────────────────────────────────────
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = augroup('YankHighlight', { clear = true })
|
||||
autocmd('TextYankPost', {
|
||||
callback = function() vim.highlight.on_yank() end,
|
||||
group = highlight_group,
|
||||
group = augroup('YankHighlight', { clear = true }),
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- ── Windows to close with "q" ───────────────────────────────────────
|
||||
autocmd('FileType', {
|
||||
callback = function() vim.keymap.set('n', '<esc>', ':bd<CR>', { buffer = true, silent = true }) end,
|
||||
group = augroup('close_with_q', { clear = true }),
|
||||
pattern = {
|
||||
'PlenaryTestPopup',
|
||||
'checkhealth',
|
||||
'dbout',
|
||||
'gitsigns.blame',
|
||||
'grug-far',
|
||||
'help',
|
||||
'startuptime',
|
||||
'qf',
|
||||
'lspinfo',
|
||||
'man',
|
||||
'checkhealth',
|
||||
'neotest-output',
|
||||
'neotest-output-panel',
|
||||
'neotest-summary',
|
||||
'notify',
|
||||
'qf',
|
||||
'spectre_panel',
|
||||
'startuptime',
|
||||
'tsplayground',
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
vim.keymap.set('n', 'q', '<cmd>close<cr>', {
|
||||
buffer = event.buf,
|
||||
silent = true,
|
||||
desc = 'Quit buffer',
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- ── make it easier to close man-files when opened inline ────────────
|
||||
autocmd('FileType', {
|
||||
group = augroup('man_unlisted', { clear = true }),
|
||||
pattern = { 'man' },
|
||||
callback = function(event) vim.bo[event.buf].buflisted = false end,
|
||||
})
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
Reference in New Issue
Block a user