summaryrefslogtreecommitdiff
path: root/lua/lvim/core
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-12-04 13:58:45 +0100
committerGitHub <[email protected]>2021-12-04 13:58:45 +0100
commit7b753ea627db4b1c205dc3f123fbfc23cb619fdd (patch)
tree1620cd55919872ec89b108f2f5cbd240c5b12714 /lua/lvim/core
parente292d665f161ee58477a5c1011313ef10a7fef8e (diff)
fix(autopairs): add missing configuration entries (#2030)
Diffstat (limited to 'lua/lvim/core')
-rw-r--r--lua/lvim/core/autopairs.lua43
1 files changed, 38 insertions, 5 deletions
diff --git a/lua/lvim/core/autopairs.lua b/lua/lvim/core/autopairs.lua
index a4585e08..365d00d5 100644
--- a/lua/lvim/core/autopairs.lua
+++ b/lua/lvim/core/autopairs.lua
@@ -4,19 +4,45 @@ function M.config()
lvim.builtin.autopairs = {
active = true,
on_config_done = nil,
- ---@usage -- modifies the function or method delimiter by filetypes
+ ---@usage modifies the function or method delimiter by filetypes
map_char = {
all = "(",
tex = "{",
},
+ ---@usage check bracket in same line
enable_check_bracket_line = false,
---@usage check treesitter
check_ts = true,
ts_config = {
- lua = { "string" },
- javascript = { "template_string" },
+ lua = { "string", "source" },
+ javascript = { "string", "template_string" },
java = false,
},
+ disable_filetype = { "TelescopePrompt", "spectre_panel" },
+ ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]], "%s+", ""),
+ enable_moveright = true,
+ ---@usage disable when recording or executing a macro
+ disable_in_macro = false,
+ ---@usage add bracket pairs after quote
+ enable_afterquote = true,
+ ---@usage map the <BS> key
+ map_bs = true,
+ ---@usage map <c-w> to delete a pair if possible
+ map_c_w = false,
+ ---@usage disable when insert after visual block mode
+ disable_in_visualblock = false,
+ ---@usage change default fast_wrap
+ fast_wrap = {
+ map = "<M-e>",
+ chars = { "{", "[", "(", '"', "'" },
+ pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
+ offset = 0, -- Offset from pattern match
+ end_key = "$",
+ keys = "qwertyuiopzxcvbnmasdfghjkl",
+ check_comma = true,
+ highlight = "Search",
+ highlight_grey = "Comment",
+ },
}
end
@@ -29,10 +55,17 @@ M.setup = function()
check_ts = lvim.builtin.autopairs.check_ts,
enable_check_bracket_line = lvim.builtin.autopairs.enable_check_bracket_line,
ts_config = lvim.builtin.autopairs.ts_config,
+ disable_filetype = lvim.builtin.autopairs.disable_filetype,
+ disable_in_macro = lvim.builtin.autopairs.disable_in_macro,
+ ignored_next_char = lvim.builtin.autopairs.ignored_next_char,
+ enable_moveright = lvim.builtin.autopairs.enable_moveright,
+ enable_afterquote = lvim.builtin.autopairs.enable_afterquote,
+ map_c_w = lvim.builtin.autopairs.map_c_w,
+ map_bs = lvim.builtin.autopairs.map_bs,
+ disable_in_visualblock = lvim.builtin.autopairs.disable_in_visualblock,
+ fast_wrap = lvim.builtin.autopairs.fast_wrap,
}
- -- vim.g.completion_confirm_key = ""
-
autopairs.add_rule(Rule("$$", "$$", "tex"))
autopairs.add_rules {
Rule("$", "$", { "tex", "latex" }) -- don't add a pair if the next character is %