glimpse/plugin/glimpse.vim
branchvim-stuff
changeset 10 a8f9271a7cab
parent 4 4ffc0380b228
equal deleted inserted replaced
9:0d8306685c5c 10:a8f9271a7cab
     6 " http://vim.wikia.com/wiki/Use_glimpse_from_within_Vim
     6 " http://vim.wikia.com/wiki/Use_glimpse_from_within_Vim
     7 "
     7 "
     8 " Mahlon E. Smith <mahlon@martini.nu>
     8 " Mahlon E. Smith <mahlon@martini.nu>
     9 " $Id$
     9 " $Id$
    10 "
    10 "
    11 " Here's a tcsh alias that's nice too!
    11 " Here's a bash function that's nice too!
       
    12 " function g() { command glimpse -winO -F `pwd` $1 | sed 's|^`pwd`/||'; }
       
    13 "
       
    14 " And a tcsh alias, while we're at it!
    12 " alias g 'glimpse -winO -F `pwd` \!:1 | sed -e "s|^`pwd`/||"'
    15 " alias g 'glimpse -winO -F `pwd` \!:1 | sed -e "s|^`pwd`/||"'
    13 "
    16 "
    14 
    17 
    15 " Loaded check {{{
    18 " Loaded check {{{
    16 if exists( 'g:glimpse_loaded' )
    19 if exists( 'g:glimpse_loaded' )
   136 " Results of the index are placed into the location list. (:lopen to view.)
   139 " Results of the index are placed into the location list. (:lopen to view.)
   137 "
   140 "
   138 function! <SID>GlimpseIndex()
   141 function! <SID>GlimpseIndex()
   139 	let l:cmd = 'glimpseindex ' . g:glimpseindexFlags . ' -f .'
   142 	let l:cmd = 'glimpseindex ' . g:glimpseindexFlags . ' -f .'
   140 	let l:cwd = getcwd()
   143 	let l:cwd = getcwd()
   141 	silent! lgetexpr( system(l:cmd) )
   144 	let $LC_ALL = 'C'
       
   145 	let l:index_output = system(l:cmd)
       
   146 	let l:index_exit = v:shell_error
   142 	call s:err( "Updated indexes for '" . l:cwd . "'" )
   147 	call s:err( "Updated indexes for '" . l:cwd . "'" )
       
   148 	if l:index_exit != 0
       
   149 		call s:err( "Uh oh, " . l:cmd . " exited with " . l:index_exit. "!  Output follows:" )
       
   150 		call s:err( l:index_output )
       
   151 	endif
   143 endfunction
   152 endfunction
   144 
   153 
   145 
   154 
   146 " }}}
   155 " }}}
   147 " s:err( msg ) {{{
   156 " s:err( msg ) {{{