본문 바로가기
Linux/vim

[vim] 임의 위치의 tags & cscope 추가

by 暻煥 2024. 9. 21.

 

다른 경로에 위치하고 있는 tags 및 cscope 파일을 참조 할 수 있도록 명령어를 추가한다,

 

vimrc 파일에 아래 내용을 추가한다,

function! Add_tags_cscope(path)
	echo "Add cscsope and ctags from " a:path

	let l:tmpstr = a:path . "tags"
	exe 'set tags+=' . tmpstr

	let l:tmpstr = a:path . "cscope.out"
	exe 'cscope add '. tmpstr . ' ' . a:path

	return
endfunction

" How to Use => :TagsAdd /x/y/z/
command -nargs=1 -complete=file TagsAdd :call Add_tags_cscope("<args>")

 

이제, vim의 command bar에서 아래 명령어로 사용 가능하다.

:TagsAdd /path/to/source/

 


※ 참고 및 출처

https://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.2

 

Vim documentation: usr_40

 

vimdoc.sourceforge.net

https://learnvim.irian.to/vimscript/vimscript_functions

 

Vimscript Functions | Learn Vim

Vimscript Functions

learnvim.irian.to

 

.

'Linux > vim' 카테고리의 다른 글

[vim] vim-ollama (private AI assistant)  (1) 2025.05.27
[vim] YouCompleteMe  (0) 2025.02.19
[vim][c] syntax highlight  (0) 2024.02.03
[vim] C언어 #ifdef  (0) 2024.02.03
[vim] mark 설치 (형광펜 기능)  (0) 2024.02.03