Skip to content

Commit

Permalink
Smarter integration with easytags.vim
Browse files Browse the repository at this point in the history
Replaced the all-in-one `PublishPre' automatic command with more fine
grained integration with easytags.vim:

 * The tags for all files to publish are now created/updated at once.
   This makes :UpdateTags faster and also makes sure that tags for all
   files to publish are available before the first file is published.

 * I didn't bother finding out why but sometimes :HighlightTags wouldn't
   trigger in response to `PublishPre', now it's always executed.
  • Loading branch information
xolox committed Sep 5, 2010
1 parent 459b829 commit be98f43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions autoload.vim
Expand Up @@ -16,6 +16,15 @@ function! publish#resolve_files(directory, pathnames) " {{{1
return resolved_files
endfunction

function! publish#update_tags(pathnames) " {{{1
" Integration with easytags.vim to automatically create/update tags for all
" files before they're published, see http://peterodding.com/code/vim/easytags/
if exists('g:loaded_easytags')
call map(a:pathnames, 'fnameescape(v:val)')
execute 'UpdateTags' join(a:pathnames)
endif
endfunction

function! publish#find_tags(files_to_publish) " {{{1
" Given a dictionary like the one created above, this function will filter
" the results of taglist() to remove irrelevant entries. In the process tag
Expand Down
8 changes: 6 additions & 2 deletions publish.vim
Expand Up @@ -3,7 +3,7 @@
" Last Change: September 5, 2010
" URL: http://peterodding.com/code/vim/publish/
" License: MIT
" Version: 1.6
" Version: 1.7

" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 2252 1 :AutoInstall: publish.zip
Expand All @@ -25,6 +25,7 @@ function! Publish(source, target, files) abort
let start = xolox#timer#start()
call xolox#message("Preparing to publish file%s ..", len(a:files) == 1 ? '' : 's')
let s:files_to_publish = publish#resolve_files(a:source, a:files)
call publish#update_tags(values(s:files_to_publish))
let s:tags_to_publish = publish#find_tags(s:files_to_publish)
if s:tags_to_publish != {}
let tags_to_links_command = publish#create_subst_cmd(s:tags_to_publish)
Expand Down Expand Up @@ -52,7 +53,10 @@ function! Publish(source, target, files) abort
let plaintext_path = xolox#path#merge(target_dir, pathname . '.txt')
silent execute 'write!' fnameescape(plaintext_path)
endif
silent execute 'doautocmd User PublishPre'
" Highlight tags in current buffer using easytags.vim?
if exists('g:loaded_easytags')
HighlightTags
endif
let highlight_start = xolox#timer#start()
call publish#munge_syntax_items()
runtime syntax/2html.vim
Expand Down

0 comments on commit be98f43

Please sign in to comment.