Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Smarter integration with easytags.vim

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...
commit be98f4328bb631cd4c67d8951ff7c413b7cb6355 1 parent 459b829
@xolox authored
Showing with 15 additions and 2 deletions.
  1. +9 −0 autoload.vim
  2. +6 −2 publish.vim
View
9 autoload.vim
@@ -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
View
8 publish.vim
@@ -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
@@ -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)
@@ -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

0 comments on commit be98f43

Please sign in to comment.
Something went wrong with that request. Please try again.