Skip to content

Commit

Permalink
Moved script-local function s:unique() to autoload script
Browse files Browse the repository at this point in the history
On the one hand I don't want to force people to download half my Vim profile
before they can try one of the plug-ins I've written, but on the other hand I
don't want to keep copy/pasting miscellaneous functions all over the place...
  • Loading branch information
xolox committed Jun 6, 2010
1 parent 58ccaa0 commit 8d13bd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
7 changes: 4 additions & 3 deletions Makefile
@@ -1,5 +1,6 @@
DEPENDS=$(HOME)/.vim/autoload/xolox/escape.vim \
$(HOME)/.vim/autoload/xolox/timer.vim
DEPENDS=autoload/xolox.vim \
autoload/xolox/escape.vim \
autoload/xolox/timer.vim
VIMDOC=doc/easytags.txt
HTMLDOC=doc/readme.html
ZIPDIR := $(shell mktemp -d)
Expand All @@ -14,7 +15,7 @@ archive: Makefile easytags.vim autoload.vim $(VIMDOC) $(HTMLDOC)
@mkdir -p $(ZIPDIR)/plugin $(ZIPDIR)/autoload/xolox $(ZIPDIR)/doc
@cp easytags.vim $(ZIPDIR)/plugin
@cp autoload.vim $(ZIPDIR)/autoload/easytags.vim
@cp $(DEPENDS) $(ZIPDIR)/autoload/xolox
@for SCRIPT in $(DEPENDS); do cp $$HOME/.vim/$$SCRIPT $(ZIPDIR)/$$SCRIPT; done
@cp $(VIMDOC) $(ZIPDIR)/doc/easytags.txt
@cp $(HTMLDOC) $(ZIPDIR)/doc/easytags.html
@cd $(ZIPDIR) && zip -r $(ZIPFILE) . >/dev/null
Expand Down
17 changes: 1 addition & 16 deletions autoload.vim
Expand Up @@ -95,7 +95,7 @@ function! easytags#highlight_cmd() " {{{1
endif
let matches = filter(copy(taglist), tagkind.filter)
call map(matches, 'xolox#escape#pattern(get(v:val, "name"))')
let pattern = tagkind.pattern_prefix . '\%(' . join(s:unique(matches), '\|') . '\)' . tagkind.pattern_suffix
let pattern = tagkind.pattern_prefix . '\%(' . join(xolox#unique(matches), '\|') . '\)' . tagkind.pattern_suffix
let command = 'syntax match %s /%s/ containedin=ALLBUT,.*String.*,.*Comment.*'
execute printf(command, hlgroup_tagged, escape(pattern, '/'))
endfor
Expand All @@ -104,21 +104,6 @@ function! easytags#highlight_cmd() " {{{1
endif
endfunction

function! s:unique(list)
let index = 0
while index < len(a:list)
let value = a:list[index]
let match = index(a:list, value, index+1)
if match >= 0
call remove(a:list, match)
else
let index += 1
endif
unlet value
endwhile
return a:list
endfunction

function! easytags#get_tagsfile() " {{{1
let tagsfile = expand(g:easytags_file)
if filereadable(tagsfile) && filewritable(tagsfile) != 1
Expand Down

0 comments on commit 8d13bd2

Please sign in to comment.