mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
refactor: move init_default_autocmds to lua
The original motivation for this change came from developping https://github.com/neovim/neovim/pull/22159, which will require adding more autocommand creation to Neovim's startup sequence. This change requires lightly editing a test that expected no autocommand to have been created from lua.
This commit is contained in:
@@ -894,6 +894,26 @@ function vim._init_default_mappings()
|
||||
]])
|
||||
end
|
||||
|
||||
function vim._init_default_autocmds()
|
||||
local nvim_terminal_augroup = vim.api.nvim_create_augroup('nvim_terminal', {})
|
||||
vim.api.nvim_create_autocmd({ 'bufreadcmd' }, {
|
||||
pattern = 'term://*',
|
||||
group = nvim_terminal_augroup,
|
||||
nested = true,
|
||||
command = "if !exists('b:term_title')|call termopen(matchstr(expand(\"<amatch>\"), '\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), {'cwd': expand(get(matchlist(expand(\"<amatch>\"), '\\c\\mterm://\\(.\\{-}\\)//'), 1, ''))})",
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'cmdwinenter' }, {
|
||||
pattern = '[:>]',
|
||||
group = vim.api.nvim_create_augroup('nvim_cmdwin', {}),
|
||||
command = 'syntax sync minlines=1 maxlines=1',
|
||||
})
|
||||
end
|
||||
|
||||
function vim._init_defaults()
|
||||
vim._init_default_mappings()
|
||||
vim._init_default_autocmds()
|
||||
end
|
||||
|
||||
require('vim._meta')
|
||||
|
||||
return vim
|
||||
|
Reference in New Issue
Block a user