<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>《为vi/vim自动更新tag文件和cscope数据库》的评论</title>
	<atom:link href="http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/feed/" rel="self" type="application/rss+xml" />
	<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/</link>
	<description>关注Linux, Scala, Android, Java, 开源软件和嵌入式系统</description>
	<lastBuildDate>Mon, 14 May 2012 09:51:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>作者：Alan</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-15456</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Mon, 26 Mar 2012 06:48:06 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-15456</guid>
		<description>我觉得这个问题是vim唯一比别的商业软件逊色的地方，如果大家有什么好的解决方法，记得通知我，谢谢
lanquan.yang@163.com</description>
		<content:encoded><![CDATA[<p>我觉得这个问题是vim唯一比别的商业软件逊色的地方，如果大家有什么好的解决方法，记得通知我，谢谢<br />
<a href="mailto:lanquan.yang@163.com">lanquan.yang@163.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Easwy</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-13519</link>
		<dc:creator>Easwy</dc:creator>
		<pubDate>Tue, 17 Jan 2012 05:56:58 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-13519</guid>
		<description>&lt;a href=&quot;#comment-13472&quot; rel=&quot;nofollow&quot;&gt;@widon &lt;/a&gt; 
我看了一下GNU Global的介绍，感觉很强大，等有时间了好好研究一下...</description>
		<content:encoded><![CDATA[<p><a href="#comment-13472" rel="nofollow">@widon </a><br />
我看了一下GNU Global的介绍，感觉很强大，等有时间了好好研究一下&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：widon</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-13472</link>
		<dc:creator>widon</dc:creator>
		<pubDate>Sun, 15 Jan 2012 02:13:54 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-13472</guid>
		<description>使用gnu global，自动更新就非常好实现了，因为支持增量更新
每次修改一个文件就更新一下数据库
在内核里面，这个操作也只要2s的时间
把gtags.vim gtags-cscope.vim移动进plugin

生成数据库的脚本
widon@widon-laptop:~$ cat /usr/local/bin/gt.sh 
find . -name &quot;*.[ch]&quot; &gt; gtags.files
gtags

.vimrc里面添加
function! UpdateGtags(f)
     let dir = fnamemodify(a:f, &#039;:p:h&#039;)
&quot;    exe &#039;silent !cd &#039; . dir . &#039; &amp;&amp; global -u &amp;&gt; /dev/null &amp;&#039;
     exec &#039;cd &#039; . dir
     exec &#039;silent !global -u &amp;&#039;
     exec &#039;cd -&#039;
endfunction

autocmd BufWritePost *.[ch] call UpdateGtags(expand(&#039;&#039;))

let g:GtagsCscope_Auto_Load = 1
let g:GtagsCscope_Auto_Map = 1
let g:GtagsCscope_Absolute_Path = 1

这样就可以完全替代cscope了。。</description>
		<content:encoded><![CDATA[<p>使用gnu global，自动更新就非常好实现了，因为支持增量更新<br />
每次修改一个文件就更新一下数据库<br />
在内核里面，这个操作也只要2s的时间<br />
把gtags.vim gtags-cscope.vim移动进plugin</p>
<p>生成数据库的脚本<br />
widon@widon-laptop:~$ cat /usr/local/bin/gt.sh<br />
find . -name “*.[ch]” &gt; gtags.files<br />
gtags</p>
<p>.vimrc里面添加<br />
function! UpdateGtags(f)<br />
     let dir = fnamemodify(a:f, &#8216;:p:h&#8217;)<br />
”    exe &#8216;silent !cd &#8216; . dir . &#8216; &amp;&amp; global -u &amp;&gt; /dev/null &amp;&#8217;<br />
     exec &#8216;cd &#8216; . dir<br />
     exec &#8216;silent !global -u &amp;&#8217;<br />
     exec &#8216;cd -&#8217;<br />
endfunction</p>
<p>autocmd BufWritePost *.[ch] call UpdateGtags(expand(”))</p>
<p>let g:GtagsCscope_Auto_Load = 1<br />
let g:GtagsCscope_Auto_Map = 1<br />
let g:GtagsCscope_Absolute_Path = 1</p>
<p>这样就可以完全替代cscope了。。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：oldbee</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-10782</link>
		<dc:creator>oldbee</dc:creator>
		<pubDate>Tue, 27 Sep 2011 06:51:29 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-10782</guid>
		<description>&lt;a href=&quot;#comment-281&quot; rel=&quot;nofollow&quot;&gt;@karl &lt;/a&gt; 
我现在的办法，在project顶层放置项目文件如：workspace.vim
在~/.vimrc中
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot; load project related configuration
&quot; workspace file base name
let s:WorkspaceFileName = &quot;workspace.vim&quot;

function! GetWorkspaceFileName()
  let s:current_dir=getcwd()
  let s:root_dir=&#039;/&#039;
  let l:workspace_file_full_path=&quot;/&quot;
  while s:current_dir != s:root_dir
      let s:tmp_string=s:current_dir . &quot;/&quot; . s:WorkspaceFileName
      if filereadable(s:tmp_string)
          let l:workspace_file_full_path=s:tmp_string
          break
      endif
      let s:index=strridx(s:current_dir, &quot;/&quot;)
      &quot; if s:current_dir==&quot;/home&quot;, s:index will == 0, but strpart() needs
      &quot; length == at least 1 to get &#039;/&#039;
      if s:index == 0
          let s:index=1
      endif
      &quot; cut string, remove the characters after last &#039;/&#039;
      let s:current_dir=strpart(s:current_dir, 0, s:index)
  endwhile
  &quot;return the full path of workspace file if succeeds, otherwise &#039;/&#039;
  return l:workspace_file_full_path
endfunction

&quot; get full path of workspace file
let s:workspace_file_full_path=GetWorkspaceFileName()

if filereadable(s:workspace_file_full_path)
  exec &#039;source&#039; . s:workspace_file_full_path
endif
这样，每次执行vim的时候，会自动寻找并加载项目顶层的workspace.vim</description>
		<content:encoded><![CDATA[<p><a href="#comment-281" rel="nofollow">@karl </a><br />
我现在的办法，在project顶层放置项目文件如：workspace.vim<br />
在~/.vimrc中<br />
“”"”"”"”"”"”"”"”" load project related configuration<br />
” workspace file base name<br />
let s:WorkspaceFileName = “workspace.vim”</p>
<p>function! GetWorkspaceFileName()<br />
  let s:current_dir=getcwd()<br />
  let s:root_dir=&#8217;/&#8217;<br />
  let l:workspace_file_full_path=”/”<br />
  while s:current_dir != s:root_dir<br />
      let s:tmp_string=s:current_dir . “/” . s:WorkspaceFileName<br />
      if filereadable(s:tmp_string)<br />
          let l:workspace_file_full_path=s:tmp_string<br />
          break<br />
      endif<br />
      let s:index=strridx(s:current_dir, “/”)<br />
      ” if s:current_dir==”/home”, s:index will == 0, but strpart() needs<br />
      ” length == at least 1 to get &#8216;/&#8217;<br />
      if s:index == 0<br />
          let s:index=1<br />
      endif<br />
      ” cut string, remove the characters after last &#8216;/&#8217;<br />
      let s:current_dir=strpart(s:current_dir, 0, s:index)<br />
  endwhile<br />
  “return the full path of workspace file if succeeds, otherwise &#8216;/&#8217;<br />
  return l:workspace_file_full_path<br />
endfunction</p>
<p>” get full path of workspace file<br />
let s:workspace_file_full_path=GetWorkspaceFileName()</p>
<p>if filereadable(s:workspace_file_full_path)<br />
  exec &#8216;source&#8217; . s:workspace_file_full_path<br />
endif<br />
这样，每次执行vim的时候，会自动寻找并加载项目顶层的workspace.vim</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：荒野无灯</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-10377</link>
		<dc:creator>荒野无灯</dc:creator>
		<pubDate>Mon, 05 Sep 2011 07:06:41 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-10377</guid>
		<description>好东西呀，谢谢分享出来~~~</description>
		<content:encoded><![CDATA[<p>好东西呀，谢谢分享出来~~~</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Easwy</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-7200</link>
		<dc:creator>Easwy</dc:creator>
		<pubDate>Thu, 17 Mar 2011 14:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-7200</guid>
		<description>&lt;a href=&quot;#comment-7197&quot; rel=&quot;nofollow&quot;&gt;@fanhe &lt;/a&gt; 
ctags文件其实也可以包含时间戳，因为tag文件中每个tag都是可以包含注释的。
发现现在对tag自动更新要求不太高，通常每天更新一次tag就可以满足我的需求了，呵呵</description>
		<content:encoded><![CDATA[<p><a href="#comment-7197" rel="nofollow">@fanhe </a><br />
ctags文件其实也可以包含时间戳，因为tag文件中每个tag都是可以包含注释的。<br />
发现现在对tag自动更新要求不太高，通常每天更新一次tag就可以满足我的需求了，呵呵</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：fanhe</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-7197</link>
		<dc:creator>fanhe</dc:creator>
		<pubDate>Thu, 17 Mar 2011 09:15:07 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-7197</guid>
		<description>ctags的自动更新是一个很悲剧的问题，就一个tags来说，可以对以文件为单位，检查文件时间戳，如果更改了，就更新那些文件的tags，文本模式的查找替换理论上可以实现，但是貌似tags文件不保存文件时间戳。所以，CodeLite直接放弃文本的tags，采用sqlite3来保存tags信息，也把文件时间戳保存了，所以每次有文件保存的时候，只更新数据库中当前文件的tags，我觉得是很好的一个方案，不过和vim的集成肯定不是太好，这个工作我在做。反正，codelite的tags处理是相当之成功的了。</description>
		<content:encoded><![CDATA[<p>ctags的自动更新是一个很悲剧的问题，就一个tags来说，可以对以文件为单位，检查文件时间戳，如果更改了，就更新那些文件的tags，文本模式的查找替换理论上可以实现，但是貌似tags文件不保存文件时间戳。所以，CodeLite直接放弃文本的tags，采用sqlite3来保存tags信息，也把文件时间戳保存了，所以每次有文件保存的时候，只更新数据库中当前文件的tags，我觉得是很好的一个方案，不过和vim的集成肯定不是太好，这个工作我在做。反正，codelite的tags处理是相当之成功的了。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：eplinux</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-4535</link>
		<dc:creator>eplinux</dc:creator>
		<pubDate>Sat, 11 Sep 2010 19:33:49 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-4535</guid>
		<description>cscope update：
 cscope.out ，好像不支援 append 的功能，如要更新，要全部重做一次。Automatically create and update cscope database提供了一組 Hot-Key，來幫忙不用退出vim，&quot;一指&quot;完成。
Hot-Key如下：
nmap  :!find . -iname &#039;*.c&#039; -o -iname &#039;*.cpp&#039; -o -iname &#039;*.h&#039; -o -iname &#039;*.hpp&#039; &gt; cscope.files
\ :!cscope -b -i cscope.files -f cscope.out
\ :cs reset</description>
		<content:encoded><![CDATA[<p>cscope update：<br />
 cscope.out ，好像不支援 append 的功能，如要更新，要全部重做一次。Automatically create and update cscope database提供了一組 Hot-Key，來幫忙不用退出vim，”一指”完成。<br />
Hot-Key如下：<br />
nmap  :!find . -iname &#8216;*.c&#8217; -o -iname &#8216;*.cpp&#8217; -o -iname &#8216;*.h&#8217; -o -iname &#8216;*.hpp&#8217; &gt; cscope.files<br />
\ :!cscope -b -i cscope.files -f cscope.out<br />
\ :cs reset</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：eplinux</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-4534</link>
		<dc:creator>eplinux</dc:creator>
		<pubDate>Sat, 11 Sep 2010 19:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-4534</guid>
		<description>TagsParser : Automatic tagfile updating and tag viewer 
http://www.vim.org/scripts/script.php?script_id=1535 
看了博主系列文章，写得很详细，很有感触。关于ctags的自动更新，可以看下官方的TagsParser。下面这些可供参考
http://vim.wikia.com/wiki/Autocmd_to_update_ctags_file
http://www.vim.org/scripts/script.php?script_id=100
http://www.vim.org/scripts/script.php?script_id=1343 
http://stackoverflow.com/questions/155449/vim-auto-generate-ctags
说实在的，我也不知道哪个会更好点</description>
		<content:encoded><![CDATA[<p>TagsParser : Automatic tagfile updating and tag viewer<br />
<a href="http://www.vim.org/scripts/script.php?script_id=1535" rel="nofollow">http://www.vim.org/scripts/script.php?script_id=1535</a><br />
看了博主系列文章，写得很详细，很有感触。关于ctags的自动更新，可以看下官方的TagsParser。下面这些可供参考<br />
<a href="http://vim.wikia.com/wiki/Autocmd_to_update_ctags_file" rel="nofollow">http://vim.wikia.com/wiki/Autocmd_to_update_ctags_file</a><br />
<a href="http://www.vim.org/scripts/script.php?script_id=100" rel="nofollow">http://www.vim.org/scripts/script.php?script_id=100</a><br />
<a href="http://www.vim.org/scripts/script.php?script_id=1343" rel="nofollow">http://www.vim.org/scripts/script.php?script_id=1343</a><br />
<a href="http://stackoverflow.com/questions/155449/vim-auto-generate-ctags" rel="nofollow">http://stackoverflow.com/questions/155449/vim-auto-generate-ctags</a><br />
说实在的，我也不知道哪个会更好点</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Easwy</title>
		<link>http://easwy.com/blog/archives/automatically_update_ctags_tag_cscope_database/#comment-2429</link>
		<dc:creator>Easwy</dc:creator>
		<pubDate>Tue, 06 Apr 2010 02:15:41 +0000</pubDate>
		<guid isPermaLink="false">http://easwy.com/blog/?p=721#comment-2429</guid>
		<description>&lt;a href=&quot;#comment-2417&quot; rel=&quot;nofollow&quot;&gt;@佳音 &lt;/a&gt; 
我看过这个tips，它每次保存都会更新一下tags，对我这种习惯随手保存的人来说不适用，因为保存时文件可能还不完整。</description>
		<content:encoded><![CDATA[<p><a href="#comment-2417" rel="nofollow">@佳音 </a><br />
我看过这个tips，它每次保存都会更新一下tags，对我这种习惯随手保存的人来说不适用，因为保存时文件可能还不完整。</p>
]]></content:encoded>
	</item>
</channel>
</rss>

