Handle single keyword metadata on namespace name

I.e. (ns ^:integration my-namespace)
This commit is contained in:
Jacek Lach 2013-04-09 12:07:21 +01:00 committed by Tim Pope
parent 21d5c81eab
commit 5aa33b2cca

View File

@ -1007,10 +1007,12 @@ function! fireplace#ns() abort
while lnum < line('$') && getline(lnum) =~# '^\s*\%(;.*\)\=$' while lnum < line('$') && getline(lnum) =~# '^\s*\%(;.*\)\=$'
let lnum += 1 let lnum += 1
endwhile endwhile
let keyword_group = '[A-Za-z0-9_?*!+/=<>.-]'
let lines = join(getline(lnum, lnum+50), ' ') let lines = join(getline(lnum, lnum+50), ' ')
let lines = substitute(lines, '"\%(\\.\|[^"]\)*"\|\\.', '', 'g') let lines = substitute(lines, '"\%(\\.\|[^"]\)*"\|\\.', '', 'g')
let lines = substitute(lines, '\^\={[^{}]*}', '', '') let lines = substitute(lines, '\^\={[^{}]*}', '', '')
let ns = matchstr(lines, '\C^(\s*\%(in-ns\s*''\|ns\s\+\)\zs[A-Za-z0-9_?*!+/=<>.-]\+\ze') let lines = substitute(lines, '\^:'.keyword_group.'\+', '', 'g')
let ns = matchstr(lines, '\C^(\s*\%(in-ns\s*''\|ns\s\+\)\zs'.keyword_group.'\+\ze')
if ns !=# '' if ns !=# ''
return ns return ns
endif endif