Skip to content

Commit a53bdb5

Browse files
committed
Strip symbols when testing for clojure_special_indent_words
Noticed this when trying to indent an alias-qualified defrecord.
1 parent 7704561 commit a53bdb5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

indent/clojure.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ if exists("*searchpairpos")
148148
return val
149149
endfunction
150150

151+
function! s:StripNamespaceAndMacroChars(word)
152+
return substitute(a:word, "\\v%(.*/|[#'`~@^,]*)(.*)", '\1', '')
153+
endfunction
154+
151155
function! s:ClojureIsMethodSpecialCaseWorker(position)
152156
" Find the next enclosing form.
153157
call search('\S', 'Wb')
@@ -167,7 +171,8 @@ if exists("*searchpairpos")
167171
call cursor(nextParen)
168172

169173
call search('\S', 'W')
170-
if g:clojure_special_indent_words =~ '\<' . s:CurrentWord() . '\>'
174+
let w = s:StripNamespaceAndMacroChars(s:CurrentWord())
175+
if g:clojure_special_indent_words =~ '\<' . w . '\>'
171176
return 1
172177
endif
173178

@@ -273,7 +278,7 @@ if exists("*searchpairpos")
273278
" metacharacters.
274279
"
275280
" e.g. clojure.core/defn and #'defn should both indent like defn.
276-
let ww = substitute(w, "\\v%(.*/|[#'`~@^,]*)(.*)", '\1', '')
281+
let ww = s:StripNamespaceAndMacroChars(w)
277282

278283
if &lispwords =~ '\V\<' . ww . '\>'
279284
return paren[1] + &shiftwidth - 1

0 commit comments

Comments
 (0)