[완료] cscope + vim 사용시 디렉토리 문제.

russell의 이미지

ctags 만으로는 좀 부족한 감이 있어서, cscope 를 같이 사용하려고 노력 하고 있습니다. 흐. 근데, 잘 안되네요.

문제는 cscope.out 파일을 만들고 나서 작업 할 때...ctags 에 비해서 뭔가 좀 불편하다는 느낌이 듭니다. 그 이유는...(이것을 좀 해결하고 싶어서 이렇게...질문을 드립니다!):

/work/project/ 라는 디렉토리에서 cscope.out 파일을 생성 한 후에 실제 코드가 있는 /work/project/program1 혹은 /work/project/program2 등 에서 vi 등으로 소스코드를 열면 자동으로 cscope.out 파일을 로드시키지 못 하네요. 이유는 아무래도 .vimrc 파일에서 자동으로 로드시키지 못 해서 그런거 같네요. 그래서, 항상 vi 에서 따로 로드를 시킵니다. 물론, cscope.out 파일을 생성 시킨 /work/project 에서 vi program1/pro.c 이렇게 열면 되지만요.

다른 분들은 어떻게 cscope 를 사용하시는지요? 실제 코드가 있는 서브디렉토리로 이동 후에 vi 를 열고 다시 vi 에서 cscope.out 파일을 로드 시키는지요?

그럼, 좋은 밤 되세요!

planetarium의 이미지

전 vimrc에

" cscope 를 위한 설정
if filereadable("./cscope.out")
	cs add ./cscope.out
elseif filereadable("../cscope.out")
	cs add ../cscope.out
elseif filereadable("../../cscope.out")
	cs add ../../cscope.out
elseif filereadable("/usr/src/linux/cscope.out")
	cs add /usr/src/linux/cscope.out
endif

이렇게 해두고 씁니다... 이 아래 댓글에 뭔가 더 좋은 방법이 나오겠죠...?
bluewolf의 이미지


silent cs add ./cscope.out

소프트웨어 엔지니어
- MHP 미들웨어 개발
- WAS 개발
- Backend 서버 소프트웨어 개발

gloomyr의 이미지

인식못하는 이유가 말이죠
cscope.out 파일을 만들대 레퍼런스 파일경로가 상대경로라는거에요
지금 cscope -R 한 위치 에서부터 검색해 내려간다이거죠
그래서 한 DEPTH 더 들어간곳에서 CS FIND 하면 파일을 찾을수 없다고 나오는거에요

결론으로
cscope.files 을 만들어서
cscope -i 로 참조하게 하세요.

cscope.files를 만들대
find 'pwd' "~~~ .c , .cpp ~~~ 등등 " > cscope.files
이렇게 만들면 경로가 ./XXX 로 내려가는게아니라
/XX/XXX 요렇게 절대경로로 생깁니다.

이렇게 해서

CSCOPE_DB 심볼에
export CSCOPE_DB='참조할경로'
이렇게 하시면 어디서건 파일을 찾지 못하는 경우는 없을듯 합니다.~

sohn9086의 이미지

이전에 관련된 글타래가 있었던 것 같아 링크를 남깁니다.

http://kldp.org/node/115739

--------------
save the earth

생산적인 댓글을 달자

russell의 이미지

아. 다른 분들도 저와 비슷한 고민을 했었군요! 제시해 주신 방법을 저도 그대로 적용해서 사용하니, 한결 편해 진거 같네요! 감사합니다!!!

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.