Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.99k stars 116 forks source link

add support for python f-strings #300

Closed gmnr closed 1 year ago

gmnr commented 3 years ago

I am failing at configuring delimitMate to work with f-strings in python.

The desired behavior is that, in python, prepending f to the pair of single (') or double (") quotes still triggers the autocompletion, without repeating the f.

Thank you in advance for your help!

BTrey commented 2 years ago

+1 for this. Came here looking for a solution to exactly this problem.

0xKira commented 2 years ago

I also encountered this problem and finally solved it.

Add this line to your vimrc.

au FileType python let b:delimitMate_smart_quotes = '\%(_\|[^[:punct:][:space:]bfu]\|\%(\\\\\)*\\\)\%#\|\%#\%(\w\|[^[:space:][:punct:]]\)'

This acts like the default behavior except you type a quote after b/f/u(possible python string prefixes)