請問vim與cscope.out位置的問題 - Linux

By Ida
at 2009-12-16T20:56
at 2009-12-16T20:56
Table of Contents
請教大家
我在 linux/ 目錄下建立cscope.out
但我不一定每次編輯檔案都從 linux 目錄下開始
例如 我有可能位於 linux/drivers/mmc/card 下 vim block.c
此時 vim 並不會找到位於 linux 目錄下的cscope.out
於是 我必須手動下:cs add ../../../cscope.out ../../../
cscope資料庫才建立起來
為了解決這個問題,
我在 cscope_maps.vim 修改了
讓一開始會一直往上一層目錄找 cscope.out 檔案
摘錄如下
if has("cscope")
略
let PATH_DB_CSCOPE = findfile("cscope.out", ".;")
let DIR_DB_CSCOPE = finddir("linux", ".;")
" add any cscope database in current directory
if filereadable("cscope.out")
cs add cscope.out
" Searches from the directory of the current file upwards
elseif !(empty(PATH_DB_CSCOPE))
execute "cs add " . PATH_DB_CSCOPE . " " . DIR_DB_CSCOPE
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
請問 我有辦法把 PATH_DB_CSCOPE 變數 濾掉檔案名cscope.out
存入 DIR_DB_CSCOPE 嗎? 查了一下 vim 好像沒有這樣功能的function
如果用shell 下的 dirname,又不知如何在vim script下呼叫
請問有什麼比較好的解法呢?
感謝看完這篇冗長文章的人
--
Tags:
Linux
All Comments

By Lauren
at 2009-12-20T22:41
at 2009-12-20T22:41

By Lucy
at 2009-12-22T07:26
at 2009-12-22T07:26
Related Posts
KDE的"桌面資料夾"如何恢復?

By Harry
at 2009-12-16T14:17
at 2009-12-16T14:17
請教關於程式的安裝

By Ida
at 2009-12-16T13:22
at 2009-12-16T13:22
VMWare網路問題一問..

By Regina
at 2009-12-16T00:30
at 2009-12-16T00:30
安裝linux版的pidgin-2.6.4

By Xanthe
at 2009-12-15T22:24
at 2009-12-15T22:24
[譯作] 透過建立一個XML檔案,來製作Gnome2.28的動態桌布

By Damian
at 2009-12-15T21:08
at 2009-12-15T21:08