sublime setting - achishis2/achishis2.github.io GitHub Wiki

  1. ubuntu에 ctag, cscope 설치(vim_ctags_cscope.pdf) >> vi 로만 작업하실 분들은 해당파일 까지만 보시면 됩니다.

  2. sublime text 3 설치 > http://www.sublimetext.com/3

2.1 package controll 설치 > https://packagecontrol.io/installation

2.2 sublime > preference > package control or Ctrl+shift+p package control: install package 클릭

2.3 ctags plugin 검색 & 설치

2.4 cscope plugin 검색 & 설치

  1. ctag indexing 방법

3.1 m40 소스폴더 제일 상위로 이동하여 아래 커맨드 (본인이 원하는 취향에 따라 exclude 추가 가능)

ctags --languages=c++ --exclude=.git --exclude=build --exclude=out -R -f .tags
  1. cscope

4.1 위와 동일한 위치에서 아래커맨드 통해 cscope 파일 생성

find . -type f -and \( -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name '*.cpp' -o -name '*.s' -o -name 'S' -o -name 'mm' \) -print > cscope.files

4.2 db 파일 생성

cscope -i cscope.files
  1. sublime text 프로젝트 생성

5.1 sublime text 실행시킨 상태에서 위에서 얘기한 최상위 폴더를 drag & drop

5.2 project > save project as 하여 원하는 위치에 프로젝트 파일 저장 (예 : test.sublme-project)

5.3 close project

5.4 File > open file 하여 5.2에서 만든 프로젝트 파일(test.sublme-project) 열어서 아래와 같이 수정

{
	"folders":
	[
		{
			"follow_symlinks": true,
			"path": "src", // m40 beta의 최상위 폴더로 지정 
			"file_exclude_patterns": [
				"*.vcproj",
				"*.vcxproj",
				"*.sln",
				"*.gitignore",
				"*.gitmodules",
				"*.vcxproj.*"
			],
			"folder_exclude_patterns": [
				"build",
				"out",
				".git",
				"Debug",
				"Release"
			]
		}
	],
	"settings": {
		"ctags_extra_tag_files": [
			"/home/tk/workspace/ct/beta/m42_2311_t/src/.tags" // 3.1 에서 indexing한 ctag 파일 경로로 설정
		]
	}
}

5.5 파일 저장후 프로그램 종료

5.6 Project > Open project 통해 프로젝트 오픈

한번 셋업해놓으면 프로젝트 관련해서는 수정할 것이 없고 혹시 소스코드가 추가됬거나 base가 바뀌었을 경우, 3번 & 4번만 command 를 통해 sync 맞춰 주시면 됩니다.

  1. 사용법

6.1 preferences > Package Setting > CTags > Key binding - user, Mouse binding - user 를 통해 단축키 확인 및 수정 가능

6.2 소스 인사이트와 동일하게 ctrl+마우스 click 으로 function 정의부분 이동하게 하려면

mouse binding > modifier : ["ctrl", "shift"] 를 modifier : ["ctrl"]로 변경

6.1 cscope 실행 >> ctrl + \

  • look up symbol : 심볼 검색
  • search for text string : 문자열 검색

6.2 file open >> ctrl + r

6.3 기타 등등 사용법은 메뉴얼 참조