hewes / unite-gtags

Unite source for GNU GLOBAL
Other
60 stars 10 forks source link

add gtags/path source #11

Closed thawk closed 8 years ago

thawk commented 8 years ago

Unite gtags/path lists all paths in GTAGS. It executes global -P and show results.

You can specify as an argument :Unite gtags/path:. When exeucte Unite with no arguments :Unite gtags/path, all paths is shown.

hewes commented 8 years ago

As I described in Pull #8

I think the results of -P should be handled as 'file' kind.

Please fix your code like below.

diff --git a/autoload/unite/sources/gtags.vim b/autoload/unite/sources/gtags.vim
index a932698..032c5ce 100644
--- a/autoload/unite/sources/gtags.vim
+++ b/autoload/unite/sources/gtags.vim
@@ -175,12 +175,12 @@ endfunction
 let s:path = {
       \ 'name' : 'path',
       \ 'description' : 'global with -P option',
-      \ 'enable_tree_matcher' : 1,
+      \ 'enable_tree_matcher' : 0,
       \ 'hooks'  : {
          \'on_syntax' : function("unite#libs#gtags#on_syntax"),
          \'on_init'   : function("unite#libs#gtags#on_init_common"),
          \ },
-      \ 'syntax' : "uniteSource__Gtags",
+      \ 'default_kind' : "file",
       \ 'result' : function('unite#libs#gtags#result_as_filepath'),
       \}
 function! s:path.option(args, context)
@@ -190,6 +190,7 @@ function! s:path.option(args, context)
     let l:pattern = a:args[0]
   endif
   return {
+        \ 'disable_result_option': 1,
         \ 'short': unite#libs#gtags#get_global_config("path_option"),
         \ 'long': '',
         \ 'pattern' : l:pattern ,
thawk commented 8 years ago

Sorry, I didn't fully understand what 'file' kind means. I've fixed the pull request, please check again.

hewes commented 8 years ago

LGTM. Thanks for contribution.