Tamas Kovacs  committed ebdf456

Paredit: skip matches for \(, \[, and \{

  • Participants
  • Parent commits e58286a
  • Branches default

Comments (0)

Files changed (1)

File plugin/paredit.vim

 " paredit.vim:
 "               Paredit mode for Slimv
 " Version:      0.9.9
-" Last Change:  23 Oct 2012
+" Last Change:  01 Nov 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
 "  Other variable definitions
 " =====================================================================
-" Skip matches inside string or comment
-let s:skip_c  = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "[Cc]omment"'
-let s:skip_sc = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "[Ss]tring\\|[Cc]omment\\|[Ss]pecial"'
+" Skip matches inside string or comment or after '\'
+let s:skip_sc = '(synIDattr(synID(line("."), col("."), 0), "name") =~ "[Ss]tring\\|[Cc]omment\\|[Ss]pecial" || getline(line("."))[col(".")-2] == "\\")'
  1. Steve Losh

    This works, but couldn't you have just added [Cc]haracter to the first regex instead of adding the second custom part? \{ in Clojure is a character literal, which is what was making it choke...

    1. Tamas Kovacs author

      Good point, but for me it's a lispSymbol instead of Character, so this is not that simple. In that case we should have identified all possible syntax ID-s, which I depends on what other plugins the user has (e.g. vimclojure). I found checking for the preceding '\' safer.

      1. Steve Losh

        Ah, that's true, it would be syntax plugin dependent.

        I guess there's no reason you'd ever have a backslash before a real opening char anyway.

 " Valid macro prefix characters
 let s:any_macro_prefix   = "'" . '\|`\|#\|@\|\~\|,'