delimitMate icon indicating copy to clipboard operation
delimitMate copied to clipboard

Configuring keys as additional quotess

Open leeren opened this issue 10 years ago • 3 comments

I put the following line in my .vimrc to use autocompleting dollar signs when writing in LaTeX:

au FileType tex let b:delimitMate_quotes = "\" ' $"

This works great, but now within coupled dollar signs for some reason the autocompleting parentheses no longer works! It works perfectly outside of paired dollar signs but not within them. Any ideas?

leeren avatar Feb 01 '15 00:02 leeren

I'm having the same problem, but it only happens with the cursor right at the ending quote. So, typing ( with the cursor (specified by |) as $|$ inserts $(|$ and doing the same with $| $ inserts $(|) $

Is this the correct behavior? Is there some setting which will allow automatic insertion of delimiters even when the cursor is just before the end of the quote?

samhaney avatar Jul 07 '15 17:07 samhaney

I think this is the correct behaviour, you can read in :help delimitMate this:

                                              *'delimitMate_smart_matchpairs'*
                                            *'b:delimitMate_smart_matchpairs'*
Values: Regexp                                                               ~
Default: '^\%(\w\|\!\|[£$]\|[^[:space:][:punct:]]\)'                                ~

This regex is matched against the text to the right of cursor, if it's not
empty and there is a match delimitMate will not autoclose the pair. At the
moment to match the text, an escaped bang (\!) in the regex will be replaced
by the character being inserted, while an escaped number symbol (\#) will be
replaced by the closing pair.
e.g.: >
        let delimitMate_smart_matchpairs = ''
        au FileType tcl let b:delimitMate_smart_matchpairs = '^\%(\w\|\$\)'

jfab20 avatar Sep 04 '21 15:09 jfab20

You can add this to get allow expansion before $: (I just deleted the $ character in the default regex)

au FileType tex let b:delimitMate_smart_matchpairs='^\%(\w\|\!\|[£]\|[^[:space:][:punct:]]\)' 

jfab20 avatar Sep 04 '21 15:09 jfab20