Skip to content
This repository
Browse code

Search the whole $PATH for Exuberant Ctags (issue #18)

  • Loading branch information...
commit fe3f565ebdd565f81ea7dd52cd8bdbf843f971fe 1 parent 7cc2ab0
Peter Odding authored September 26, 2011
2  autoload/xolox/easytags.vim
@@ -3,7 +3,7 @@
3 3
 " Last Change: September 26, 2011
4 4
 " URL: http://peterodding.com/code/vim/easytags/
5 5
 
6  
-let g:xolox#easytags#version = '2.5.9'
  6
+let g:xolox#easytags#version = '2.6'
7 7
 
8 8
 " Public interface through (automatic) commands. {{{1
9 9
 
40  plugin/easytags.vim
... ...
@@ -1,6 +1,6 @@
1 1
 " Vim plug-in
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: September 4, 2011
  3
+" Last Change: September 26, 2011
4 4
 " URL: http://peterodding.com/code/vim/easytags/
5 5
 " Requires: Exuberant Ctags (http://ctags.sf.net)
6 6
 
@@ -50,15 +50,39 @@ function! s:InitEasyTags(version)
50 50
   if exists('g:easytags_cmd') && s:CheckCtags(g:easytags_cmd, a:version)
51 51
     return 1
52 52
   endif
53  
-  " On Ubuntu Linux, Exuberant Ctags is installed as `ctags'. On Debian Linux,
54  
-  " Exuberant Ctags is installed as `exuberant-ctags'. On Free-BSD, Exuberant
55  
-  " Ctags is installed as `exctags'.
56  
-  for name in ['ctags', 'exuberant-ctags', 'exctags']
57  
-    if s:CheckCtags(name, a:version)
58  
-      let g:easytags_cmd = name
  53
+  if xolox#misc#os#is_win()
  54
+    " FIXME The code below that searches the $PATH is not used on Windows at
  55
+    " the moment because xolox#misc#path#which() generally produces absolute
  56
+    " paths and on Windows these absolute paths tend to contain spaces which
  57
+    " makes xolox#shell#execute() fail. I've tried quoting the program name
  58
+    " with double quotes but it fails just the same (it works with system()
  59
+    " though). Anyway the problem of having multiple conflicting versions of
  60
+    " Exuberant Ctags installed is not that relevant to Windows since it
  61
+    " doesn't have a package management system. I still want to fix
  62
+    " xolox#shell#execute() though.
  63
+    if s:CheckCtags('ctags', a:version)
  64
+      let g:easytags_cmd = 'ctags'
59 65
       return 1
60 66
     endif
61  
-  endfor
  67
+  else
  68
+    " Exuberant Ctags can be installed under multiple names:
  69
+    "  - On Ubuntu Linux, Exuberant Ctags is installed as `ctags'.
  70
+    "  - On Debian Linux, Exuberant Ctags is installed as `exuberant-ctags'.
  71
+    "  - On Free-BSD, Exuberant Ctags is installed as `exctags'.
  72
+    " IIUC on Mac OS X the program /usr/bin/ctags is installed by default but
  73
+    " unusable and when the user installs Exuberant Ctags in an alternative
  74
+    " location, it doesn't come before /usr/bin/ctags in the search path. To
  75
+    " solve this problem in a general way and to save every Mac user out there
  76
+    " some frustration the plug-in will search the path and consider every
  77
+    " possible location, meaning that as long as Exuberant Ctags is installed
  78
+    " in the $PATH the plug-in should find it automatically.
  79
+    for program in xolox#misc#path#which('ctags', 'exuberant-ctags', 'exctags')
  80
+      if s:CheckCtags(program, a:version)
  81
+        let g:easytags_cmd = program
  82
+        return 1
  83
+      endif
  84
+    endfor
  85
+  endif
62 86
 endfunction
63 87
 
64 88
 function! s:CheckCtags(name, version)

0 notes on commit fe3f565

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