Ultimate-autopair plugin aims to have all possible features that an auto-pairing plugin needs.
Requires neovim 0.7
Ultimate-autopair is a neovim autopair plugin that is easy to extend, by the fact that it supports extensions. (Note that the extra mappings (<CR>
,<BS>
,...) currently use a different system of extensions) The builtin extensions includes among other things: command line support, multicharacter pairs, non one-line, fastwarp and much more...
Packer:
use{
'altermo/ultimate-autopair.nvim',
event={'InsertEnter','CmdlineEnter'},
config=function ()
require('ultimate-autopair').setup({
--Config goes here
})
end,
}
mapopt={noremap=true},
cmap=true,
bs={
enable=true,
overjump=true,
space=true,
multichar=true,
fallback=nil,
extensions=require('ultimate-autopair.maps.bs').default_extensions,
},
cr={
enable=true,
autoclose=false,
multichar={
enable=true,
markdown={{'```','```',pair=true,noalpha=true,next=true}},
},
addsemi={'c','cpp','rust'},
fallback=nil,
extensions=require('ultimate-autopair.maps.cr').default_extensions,
},
space={
enable=true,
fallback=nil,
},
fastwarp={
enable=true,
hopout=false,
map='<A-e>',
rmap='<A-E>',
Wmap='<A-C-e>',
cmap='<A-e>',
rcmap='<A-E>',
Wcmap='<A-C-e>',
multiline=true,
fallback=nil,
extensions=require('ultimate-autopair.maps.fastwarp').default_extensions,
endextensions=require('ultimate-autopair.maps.fastwarp').default_endextensions,
rextensions=require('ultimate-autopair.maps.rfastwarp').default_extensions,
rendextensions=require('ultimate-autopair.maps.rfastwarp').default_endextensions,
},
fastend={
enable=true,
map='<A-$>',
cmap='<A-$>',
smart=false,
fallback=nil,
},
_default_beg_filter=M.default_beg_filter,
_default_end_filter=M.default_end_filter,
extensions={
{'cmdtype',{'/','?','@'}},
'multichar',
'string',
{'treenode',{inside={'comment'}}},
{'escape',{filter=true}},
'rules',
'filetype',
{'alpha',{before={"'"}}},
{'suround',{'"',"'"}},
{'fly',{')','}',']',' ',match=nil,nofilter=false}},
},
internal_pairs={
{'(',')'},
{"'","'",rules={{'when',{'option','lisp'},{'instring'}}}},
{"'","'",rules={{'not',{'filetype','tex'}}}},
rules={ --only runs if the extension rules is loaded
{[[\']],[[\']],rules={{'and',{'not',{'or',{'next',"'"},{'previous','\\',2}}},{'instring'}}}},
{[[\"]],[[\"]],rules={{'and',{'not',{'or',{'next','"'},{'previous','\\',2}}},{'instring'}}}},
},
ft={
markdown={
{'```','```'},
{'<!--','-->'},
},
TelescopePrompt={disable=true},
---more...
},
---more...
},
----Place own pairs here...
--{'$$','$$'},
Extension | What it does |
---|---|
cmdtype | disables for specific command types |
string | makes it so that inside and outside of strings don't interact with each other (treesitter support) |
multichar | allows for pairs which consist of multiple characters |
escape | don't add if it will be escaped |
rules | a system which allows one to add rules |
filetype | only allow some file types |
alpha | no pair before or after alpha character |
surround | auto surround the pair |"foo" >( >("foo"|) |
fly | fly over ending parentheses ([{|}]) > ) > ([{}])| |
treenode | filter inside or outside treesitter nodes |
These are some other plugins which are related to pairing which have features that ultimate-autopair does not.
end
in lua, ruby, etc...Use npairs-integrate-upair with require('npairs-int-upair').setup({map='u'})
If you want to donate then you need to find the correct link (50₁₀):