2021-09-28 05:43:50 -04:00
|
|
|
local definitions = {
|
|
|
|
-- ':h hex-editing'
|
2021-10-09 11:56:39 -04:00
|
|
|
-- binary = {
|
|
|
|
-- {'BufReadPre' , '*.bin,*.exe', 'let &bin=1'},
|
|
|
|
-- {'BufReadPost' , '*.bin,*.exe', 'if &bin | %!xxd'},
|
|
|
|
-- {'BufReadPost' , '*.bin,*.exe', 'set ft=xxd | endif'},
|
|
|
|
-- {'BufWritePre' , '*.bin,*.exe', 'if &bin | %!xxd -r'},
|
|
|
|
-- {'BufWritePre' , '*.bin,*.exe', 'endif'},
|
|
|
|
-- {'BufWritePost', '*.bin,*.exe', 'if &bin | %!xxd'},
|
|
|
|
-- {'BufWritePost', '*.bin,*.exe', 'set nomod | endif'}
|
|
|
|
-- },
|
2021-09-28 05:43:50 -04:00
|
|
|
|
|
|
|
-- Auto-hide UI elements in specific buffers
|
2021-10-09 11:56:39 -04:00
|
|
|
-- buf = {
|
|
|
|
-- {'BufEnter', 'term://*', 'setlocal norelativenumber nonumber'},
|
|
|
|
-- {'BufEnter,BufWinEnter,WinEnter,CmdwinEnter', '*', [[if bufname('%') == 'NvimTree' | set laststatus=0 | else | set laststatus=2 | endif]]}
|
|
|
|
-- },
|
2021-09-28 05:43:50 -04:00
|
|
|
|
|
|
|
wins = {
|
|
|
|
-- Equalize window dimensions when resizing vim window
|
|
|
|
{'VimResized', '*', 'tabdo wincmd ='},
|
|
|
|
-- Force writing shada on leaving nvim
|
|
|
|
{'VimLeave', '*', [[if has('nvim') | wshada! | else | wviminfo! | endif]]},
|
|
|
|
-- Check if file changed when its window is focus, more eager than 'autoread'
|
2021-10-09 11:56:39 -04:00
|
|
|
-- {'FocusGained', '* checktime'}
|
2021-09-28 05:43:50 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
yank = {
|
|
|
|
{'TextYankPost', [[* silent! lua vim.highlight.on_yank({higroup='IncSearch', timeout=300})]]}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for group_name, definition in pairs(definitions) do
|
|
|
|
vim.api.nvim_command('augroup ' .. group_name)
|
|
|
|
vim.api.nvim_command('autocmd!')
|
|
|
|
for _, def in ipairs(definition) do
|
|
|
|
local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ')
|
|
|
|
vim.api.nvim_command(command)
|
|
|
|
end
|
|
|
|
vim.api.nvim_command('augroup END')
|
|
|
|
end
|