|
1 | 1 | " Vim script |
2 | 2 | " Author: Peter Odding <peter@peterodding.com> |
3 | | -" Last Change: June 27, 2011 |
| 3 | +" Last Change: July 9, 2011 |
4 | 4 | " URL: http://peterodding.com/code/vim/easytags/ |
5 | 5 |
|
6 | 6 | " Public interface through (automatic) commands. {{{1 |
@@ -34,19 +34,23 @@ endfunction |
34 | 34 |
|
35 | 35 | function! xolox#easytags#autoload() " {{{2 |
36 | 36 | try |
37 | | - " Update entries for current file in tags file? |
38 | | - if xolox#misc#option#get('easytags_auto_update', 1) |
39 | | - let pathname = s:resolve(expand('%:p')) |
40 | | - if pathname != '' |
41 | | - let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile()) |
42 | | - if tags_outdated || !xolox#easytags#file_has_tags(pathname) |
43 | | - call xolox#easytags#update(1, 0, []) |
| 37 | + let do_update = xolox#misc#option#get('easytags_auto_update', 1) |
| 38 | + let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\<syntax\>' |
| 39 | + " Don't execute this function for unsupported file types (doesn't load |
| 40 | + " the list of file types if updates and highlighting are both disabled). |
| 41 | + if (do_update || do_highlight) && index(xolox#easytags#supported_filetypes(), &ft) >= 0 |
| 42 | + " Update entries for current file in tags file? |
| 43 | + if do_update |
| 44 | + let pathname = s:resolve(expand('%:p')) |
| 45 | + if pathname != '' |
| 46 | + let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile()) |
| 47 | + if tags_outdated || !xolox#easytags#file_has_tags(pathname) |
| 48 | + call xolox#easytags#update(1, 0, []) |
| 49 | + endif |
44 | 50 | endif |
45 | 51 | endif |
46 | | - endif |
47 | | - " Apply highlighting of tags to current buffer? |
48 | | - if xolox#misc#option#get('easytags_auto_highlight', 1) |
49 | | - if &eventignore !~? '\<syntax\>' |
| 52 | + " Apply highlighting of tags to current buffer? |
| 53 | + if do_highlight |
50 | 54 | if !exists('b:easytags_last_highlighted') |
51 | 55 | call xolox#easytags#highlight() |
52 | 56 | else |
|
0 commit comments