1

Update generated neovim config

This commit is contained in:
2024-09-22 20:41:25 +02:00
parent 1743764e48
commit aa1271c42c
1247 changed files with 26512 additions and 15067 deletions

View File

@ -56,11 +56,13 @@ M.setup = function(opt)
M.force_attach()
local group = api.nvim_create_augroup('autopairs_buf', { clear = true })
api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
group = group, pattern = '*',
group = group,
pattern = '*',
callback = function() M.on_attach() end
})
api.nvim_create_autocmd('BufDelete', {
group = group, pattern = '*',
group = group,
pattern = '*',
callback = function(data)
local cur = api.nvim_get_current_buf()
local bufnr = tonumber(data.buf) or 0
@ -70,7 +72,8 @@ M.setup = function(opt)
end,
})
api.nvim_create_autocmd('FileType', {
group = group, pattern = '*',
group = group,
pattern = '*',
callback = function() M.force_attach() end
})
end
@ -140,6 +143,10 @@ M.enable = function()
M.state.disabled = false
end
M.toggle = function()
M.state.disabled = not M.state.disabled
end
--- force remap key to buffer
M.force_attach = function(bufnr)
utils.set_attach(bufnr, 0)
@ -205,6 +212,7 @@ M.set_buf_rule = function(rules, bufnr)
M.state.rules[bufnr] = rules
end
M.on_attach = function(bufnr)
-- log.debug('on_attach' .. vim.bo.filetype)
if is_disable() then
@ -643,7 +651,7 @@ M.check_break_line_char = function()
return M.autopairs_cr()
end
M.completion_confirm =function ()
M.completion_confirm = function()
if vim.fn.pumvisible() ~= 0 then
return M.esc("<cr>")
else
@ -656,7 +664,7 @@ M.map_cr = function()
'i',
'<CR>',
"v:lua.require'nvim-autopairs'.completion_confirm()",
{ expr = true, noremap = true }
{ expr = true, noremap = true }
)
end

View File

@ -51,7 +51,8 @@ M.filetypes = {
purescript = false,
sh = false,
bash = false,
nix = false
nix = false,
helm = false
}
M.on_confirm_done = function(opts)

View File

@ -189,6 +189,10 @@ M.highlight_wrap = function(tbl_pos, row, col, end_col, whitespace_line)
if config.use_virt_lines then
local virt_lines = {}
local start = 0
local left_col = vim.fn.winsaveview().leftcol
if left_col > 0 then
vim.fn.winrestview({ leftcol = 0 })
end
for _, pos in ipairs(tbl_pos) do
virt_lines[#virt_lines + 1] = { whitespace_line:sub(start + 1, pos.pos - 1), 'Normal' }
virt_lines[#virt_lines + 1] = { pos.key, config.highlight }

View File

@ -13,7 +13,6 @@ local Cond = require('nvim-autopairs.conds')
--- @field is_multibyte boolean
--- @field is_endwise boolean only use on end_wise
--- @field is_undo boolean add break undo sequence
local Rule = setmetatable({}, {
__call = function(self, ...)
return self.new(...)
@ -172,7 +171,11 @@ end
---@return Rule
function Rule:with_pair(cond, pos)
if self.pair_cond == nil then self.pair_cond = {} end
self.pair_cond[pos or (#self.pair_cond + 1)] = cond
if pos then
table.insert(self.pair_cond, pos, cond)
else
table.insert(self.pair_cond, cond)
end
return self
end

View File

@ -5,6 +5,7 @@ local utils = require('nvim-autopairs.utils')
local function quote_creator(opt)
local quote = function(...)
local move_func = opt.enable_moveright and cond.move_right or cond.none
---@type Rule
local rule = Rule(...)
:with_move(move_func())
:with_pair(cond.not_add_quote_inside_quote())