auto-pairs icon indicating copy to clipboard operation
auto-pairs copied to clipboard

Doesn't work with Python f-strings

Open sloria opened this issue 6 years ago • 5 comments

Python f-strings have the following syntax:

user = 'jiangmiao'
repo = 'auto-pairs'
full_repo = f'{user}/{repo}'

When typing f', I would expect the closing ' character to be auto-paired, but it currently does not.

sloria avatar Apr 16 '18 23:04 sloria

Same here, but it does work with double quotes.

geewrd avatar Mar 07 '19 00:03 geewrd

au FileType python let b:AutoPairs = AutoPairsDefine({"f'" : "'", "r'" : "'", "b'" : "'"})

eyemyth avatar Dec 12 '19 10:12 eyemyth

This almost works perfectly, except for if your string ends in an f, and you try to close the string it will add another apostrophe to close that one.

brianjp93 avatar Jan 19 '20 18:01 brianjp93

Same here, but it does work with double quotes.

Weird. Does anybody have any idea why it works for double but not single quotes? Maybe this could be used to fix the issue.

pianocomposer321 avatar May 22 '20 00:05 pianocomposer321

I think this is intended behavior. https://github.com/jiangmiao/auto-pairs/blob/master/doc/AutoPairs.txt#L57-L60

Skip ' when inside a word: >

        input: foo| (press ' at |)
        output: foo'

One of the features of this plugin is to NOT complete apostrophes while inside a word. Hence, double quotes are not affected

rolzy avatar Nov 29 '20 06:11 rolzy