Vim Tips Wiki
Register
(→‎Comments: can't find in appended DBs)
(→‎Comments: update to use fnameescape, and working now with latest release)
Line 25: Line 25:
 
" load the first DB if there are any
 
" load the first DB if there are any
 
if len(csc_db_list) > 0
 
if len(csc_db_list) > 0
exec 'CCTreeLoadDB' csc_db_list[0]
+
exec 'CCTreeLoadDB' fnameescape(csc_db_list[0])
 
endif
 
endif
   
Line 31: Line 31:
 
if len(csc_db_list) > 1
 
if len(csc_db_list) > 1
 
for csc_db in csc_db_list[1:]
 
for csc_db in csc_db_list[1:]
exec 'CCTreeAppendDB' csc_db
+
exec 'CCTreeAppendDB' fnameescape(csc_db)
 
endfor
 
endfor
 
endif
 
endif
Line 44: Line 44:
   
 
:Note, the above is broken for me, because the CCTree version I'm using (0.90) seems to have a problem with finding stuff in appended DBs. --[[User:Fritzophrenic|Fritzophrenic]] 17:32, April 4, 2011 (UTC)
 
:Note, the above is broken for me, because the CCTree version I'm using (0.90) seems to have a problem with finding stuff in appended DBs. --[[User:Fritzophrenic|Fritzophrenic]] 17:32, April 4, 2011 (UTC)
  +
  +
::Fixed with latest version (1.26 plus a patch to make it work with 'ignorecase' set). --[[User:Fritzophrenic|Fritzophrenic]] 17:52, April 4, 2011 (UTC)

Revision as of 17:52, 4 April 2011

Use this page to discuss script 2368 2368

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Comments

This is useful:

" CCTree auto-add of all Cscope databases
command! -bar CCTreeLoadCurrentDBs call MyCCTreeLoadDBs()

function! MyCCTreeLoadDBs()
  let save_more = &more

  set nomore
  redir => csc_dbs
  cscope show
  redir END

  let csc_db_list = split(csc_dbs, "\n")
  let csc_db_list = csc_db_list[2:] " remove header line and spacing line

  " get just the DB file path, assumes no spaces in file path, probably this can
  " be tweaked to allow spaces if needed.
  call map(csc_db_list, 'split(v:val)[2]')

  " load the first DB if there are any
  if len(csc_db_list) > 0
    exec 'CCTreeLoadDB' fnameescape(csc_db_list[0])
  endif

  " append all the others if there are any more
  if len(csc_db_list) > 1
    for csc_db in csc_db_list[1:]
      exec 'CCTreeAppendDB' fnameescape(csc_db)
    endfor
  endif

  let &more = save_more
endfun

Perhaps something similar could be built in, in a future release?

--Fritzophrenic 16:36, April 4, 2011 (UTC)

Note, the above is broken for me, because the CCTree version I'm using (0.90) seems to have a problem with finding stuff in appended DBs. --Fritzophrenic 17:32, April 4, 2011 (UTC)
Fixed with latest version (1.26 plus a patch to make it work with 'ignorecase' set). --Fritzophrenic 17:52, April 4, 2011 (UTC)