Skip to content

Commit

Permalink
Skip comment and string pair matches
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed May 13, 2019
1 parent 9840c45 commit 9a3f021
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/conjure/nvim.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@
;; backwards and forwards.
forwards (str (when root? "r") "nzW")
backwards (str "b" forwards)

;; Ignore matches inside comments or strings.
;; https://github.com/Olical/conjure/issues/34
skip "join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, \"name\")')) =~? 'comment\\|string' ? 1 : 0"

get-pair (fn [s e]
[(api/call-function :searchpairpos s "" e backwards)
(api/call-function :searchpairpos s "" e forwards)])
[(api/call-function :searchpairpos s "" e backwards skip)
(api/call-function :searchpairpos s "" e forwards skip)])

;; Fetch the buffer, window and all matching pairs for () [] and {}.
;; We'll then select the smallest region from those three
Expand Down

0 comments on commit 9a3f021

Please sign in to comment.