mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2025-01-06 05:24:00 -05:00
61b5cb5b70
- packer: load vim-eft, nvim-spectre, nvim-dap, persistence.nvim on key press instead of on Vim event - keybindings: redefine multiple, move keybindings for plugins loaded on key press to their configs - plugins: add winshift.nvim, better-escape.nvim, window-picker.nvim, neogen, spellsitter.nvim, nvim-lightbulb, close-buffers.nvim - init.lua: move autocmds back inside async loop (filetype events already got handled by filetype.nvim) - zen-mode.nvim + twilight.nvim: move from 'tools' to 'editor' group - lsp: change signs characters for unification - dap: initial config, keybindings - feline.nvim: reorder elements, add nvim-lightbulb signs - chore: unify the way setup() is called, and format stuff
38 lines
1.5 KiB
Lua
38 lines
1.5 KiB
Lua
local definitions = {
|
|
bufs = {
|
|
-- Reload vim config automatically
|
|
{'BufWritePost', [[$VIM_PATH/{*.vim,*.yaml,vimrc} nested source $MYVIMRC | redraw]]},
|
|
-- Reload Vim script automatically if setlocal autoread
|
|
{'BufWritePost,FileWritePost', '*.vim', [[nested if &l:autoread > 0 | source <afile> | echo 'source ' . bufname('%') | endif]]},
|
|
-- No undo for temporary files
|
|
{'BufWritePre', '/tmp/*', 'setlocal noundofile'},
|
|
{'BufWritePre', 'COMMIT_EDITMSG', 'setlocal noundofile'},
|
|
{'BufWritePre', 'MERGE_MSG', 'setlocal noundofile'},
|
|
{'BufWritePre', '*.tmp', 'setlocal noundofile'},
|
|
{'BufWritePre', '*.bak', 'setlocal noundofile'}
|
|
},
|
|
|
|
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'
|
|
{'FocusGained', '* checktime'}
|
|
},
|
|
|
|
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
|