Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Peter Odding authored September 05, 2010

Showing 2 changed files with 15 additions and 2 deletions. Show diff stats Hide diff stats

  1. 9  autoload.vim
  2. 8  publish.vim
9  autoload.vim
@@ -16,6 +16,15 @@ function! publish#resolve_files(directory, pathnames) " {{{1
16 16
   return resolved_files
17 17
 endfunction
18 18
 
  19
+function! publish#update_tags(pathnames) " {{{1
  20
+  " Integration with easytags.vim to automatically create/update tags for all
  21
+  " files before they're published, see http://peterodding.com/code/vim/easytags/
  22
+  if exists('g:loaded_easytags')
  23
+    call map(a:pathnames, 'fnameescape(v:val)')
  24
+    execute 'UpdateTags' join(a:pathnames)
  25
+  endif
  26
+endfunction
  27
+
19 28
 function! publish#find_tags(files_to_publish) " {{{1
20 29
   " Given a dictionary like the one created above, this function will filter
21 30
   " the results of taglist() to remove irrelevant entries. In the process tag
8  publish.vim
@@ -3,7 +3,7 @@
3 3
 " Last Change: September 5, 2010
4 4
 " URL: http://peterodding.com/code/vim/publish/
5 5
 " License: MIT
6  
-" Version: 1.6
  6
+" Version: 1.7
7 7
 
8 8
 " Support for automatic update using the GLVS plug-in.
9 9
 " GetLatestVimScripts: 2252 1 :AutoInstall: publish.zip
@@ -25,6 +25,7 @@ function! Publish(source, target, files) abort
25 25
   let start = xolox#timer#start()
26 26
   call xolox#message("Preparing to publish file%s ..", len(a:files) == 1 ? '' : 's')
27 27
   let s:files_to_publish = publish#resolve_files(a:source, a:files)
  28
+  call publish#update_tags(values(s:files_to_publish))
28 29
   let s:tags_to_publish = publish#find_tags(s:files_to_publish)
29 30
   if s:tags_to_publish != {}
30 31
     let tags_to_links_command = publish#create_subst_cmd(s:tags_to_publish)
@@ -52,7 +53,10 @@ function! Publish(source, target, files) abort
52 53
       let plaintext_path = xolox#path#merge(target_dir, pathname . '.txt')
53 54
       silent execute 'write!' fnameescape(plaintext_path)
54 55
     endif
55  
-    silent execute 'doautocmd User PublishPre'
  56
+    " Highlight tags in current buffer using easytags.vim?
  57
+    if exists('g:loaded_easytags')
  58
+      HighlightTags
  59
+    endif
56 60
     let highlight_start = xolox#timer#start()
57 61
     call publish#munge_syntax_items()
58 62
     runtime syntax/2html.vim

0 notes on commit be98f43

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