Vim Tips Wiki
Register
(→‎Comments: broken)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ScriptComments|2368|CCTree: show call tree of C code}}
+
{{ScriptComments|CCTree: show call tree of C code}}
   
 
==Comments==
 
==Comments==
 
This is useful:
 
This is useful:
 
'''IT DOESN'T WORK THOUGH, SOMEHOW CCTREE KEEPS THINKING IT'S A RELATIVE PATH EVEN IF IT'S AN ABSOLUTE ONE'''
 
   
 
<pre>
 
<pre>
Line 27: 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]
+
echomsg 'Loading' fnameescape(csc_db_list[0])
  +
exec 'CCTreeLoadDB' fnameescape(csc_db_list[0])
 
endif
 
endif
   
Line 33: Line 32:
 
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
+
echomsg 'Loading' fnameescape(csc_db)
  +
exec 'CCTreeAppendDB' fnameescape(csc_db)
 
endfor
 
endfor
 
endif
 
endif
Line 43: Line 43:
 
Perhaps something similar could be built in, in a future release?
 
Perhaps something similar could be built in, in a future release?
   
--[[User:Fritzophrenic|Fritzophrenic]] 16:36, April 4, 2011 (UTC)
+
--[[User:Fritzophrenic|Fritzophrenic]] 15:36, June 23, 2011 (UTC)
  +
  +
  +
Win32 bug, CCTreeLoadDb cannot parse windows filenames with colon,
  +
e.g. @C:/src/hello.c ... CCTree load error on windows.
  +
@ src/hello.c ... CCTree works fine on windows.
  +
will error out, workaround is to use only relative paths on windows.

Latest revision as of 07:08, 10 July 2013

Use this page to discuss script 2368 CCTree: show call tree of C code

  • 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
    echomsg 'Loading' fnameescape(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:]
      echomsg 'Loading' fnameescape(csc_db)
      exec 'CCTreeAppendDB' fnameescape(csc_db)
    endfor
  endif

  let &more = save_more
endfun

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

--Fritzophrenic 15:36, June 23, 2011 (UTC)


Win32 bug, CCTreeLoadDb cannot parse windows filenames with colon,

  e.g.  @C:/src/hello.c     ... CCTree load error on windows.
        @   src/hello.c     ... CCTree works fine on windows.

will error out, workaround is to use only relative paths on windows.