jiangmiao / auto-pairs

Vim plugin, insert or delete brackets, parens, quotes in pair
http://www.vim.org/scripts/script.php?script_id=3599
4.11k stars 374 forks source link

Add Support for auto closing angular brackets("<") #332

Closed saurabhmehta1601 closed 3 years ago

saurabhmehta1601 commented 3 years ago

Since the repo does't seem too active now , instead of sending pull request I am requesting this minor addition by comment only. Support for auto closing angular brackets can be added just by adding "<": ">" to object AutoPairs in file /plugin/auto-pairs.vim It is very helpful in html and other markdown languages , if you are not already using some plugin providing emmits.

Screenshot from 2021-08-15 19-06-11

LunarWatcher commented 3 years ago

... Or just use AutoPairsDefine in an autocmd to make sure plugins have been loaded. Angle brackets have been discussed before, and they haven't been added because there's languages where these types of completions don't make sense. This includes C++ (std::cout << for an instance, though there are cases where it's fine. Regex-bypassable edge-case) and shell. This has been discussed before, and I can't be bothered to dig the issues and PRs up on my phone. Feel free to add it to your config, but a PR for it wouldn't be well received even if the repo was active. I've also refrained from adding it to all languages in my fork for these reasons, but I believe I hooked it up to HTML. Universal <> pair insert isn't viable or language-portable.

saurabhmehta1601 commented 3 years ago

Yeah , totally correct . I was so focused on markdown I did'nt think about any other language . I am closing this issue now .

saurabhmehta1601 commented 3 years ago

My problem is solved by adding \ 'html' : {"<" : ">" } to variable allPairs defined at line 9 in above image in same file :+1: .

zyf0330 commented 2 years ago

@saurabhmehta1601 you can add au FileType html let b:AutoPairs = AutoPairsDefine({'<' : '>'}) to .vimrc