본문 바로가기

Dev Tool/Sublime Text 2

코드 정렬 - Aligment

1. Preferences -> Package Control (Ctrl + Shift + p) : install

2. alignment 설치

3. Preferences - Package Settings - Alignment - Settings - Default 의 내용을 복사해서

   Preferences - Package Settings - Alignment - Settings - User 로 붙혀넣기한다.

   차후 패키지 업그레이드 되어도 사용자 설정을 그대로 남기기 위해 User 설정을 수정한다.

3-1. 현재 적용한 설정

{
	// If the indent level of a multi-line selection should be aligned
	"align_indent": true,

	// If indentation is done via tabs, set this to true to also align
	// mid-line characters via tabs. This may cause alignment issues when
	// viewing the file in an editor with different tab width settings. This
	// will also cause multi-character operators to be left-aligned to the
	// first character in the operator instead of the character from the
	// "alignment_chars" setting.
	"mid_line_tabs": false,

	// The mid-line characters to align in a multi-line selection, changing
	// this to an empty array will disable mid-line alignment
	"alignment_chars": ["=", ":"],

	// If the following character is matched for alignment, insert a space
	// before it in the final alignment
	"alignment_space_chars": ["="],

	// The characters to align along with "alignment_chars"
	// For instance if the = is to be aligned, there are a number of
	// symbols that can be combined with the = to make an operator, and all
	// of those must be kept next to the = for the operator to be parsed
	"alignment_prefix_chars": [
		"+", "-", "&", "|", "<", ">", "!", "~", "%", "/", "*", "."
	]
}


4. 적용할 코드를 블럭으로 지정한 후 "Ctrl + Alt + a"

4-1. 적용전 소스코드

        $title = COMPANY_NAME;
        $message = $returnStr[1]['title'];
        $contentAvailable = 1;
        $badge = 1;
        $sound = ''

4-2. 적용후 소스코드

        $title            = COMPANY_NAME;
        $message          = $returnStr[1]['title'];
        $contentAvailable = 1;
        $badge            = 1;
        $sound            = ''


'Dev Tool > Sublime Text 2' 카테고리의 다른 글

Package Controll Install  (0) 2015.05.19
DocBlock - 주석 플러그인  (0) 2015.05.18
Sublime Text 에서 Vi 모드 사용하기  (0) 2015.05.14
탭 설정 - 스페이스로 대체하기  (0) 2015.05.14
FTP/SFTP 설정하기  (0) 2015.05.12