2016-05-25
서브라임 텍스트는 기본적인 기능도 굉장히 훌륭하지만, 기본적인 기능을 좀 더 보완 해줄 패키지들을 설치해 주어야 진정한 위력(?)을 알 수 있다.

아래는 내가 주로 쓰는 패키지들의 이름과 설정들을 적어 놓아 보았다.
(해당 글은 Sublime Text 3를 기준으로 쓰여진 글이다.)

우선 여러가지 패키지를 손쉽게 설치하고 지우기 위해서는 Install Package를 설치해야 한다.

링크 https://packagecontrol.io/installation
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

위 링크에 들어가서 해당 문구를 복사한 뒤에 서브라임 텍스트에서 ctrl + ` 를 눌러서 콘솔창을 띄운뒤에 해당 문구를 입력한다.

제대로 설치가 됐으면, ctrl + shift + p 를 눌렀을때 뜨는 창에 "install package"라고 쳤을때 "Package Control:Install Package"가 검색이 될 것이다.

엔터를 누르면 새로운 검색창이 뜨고, 해당 창에서 각종 패키지를 검색 및 설치가 가능하다.
(삭제는 ctrl + shift + p 를 눌러 "remove package"를 검색하면 된다)


기본 설정
Preferences > Settings - User
{
	"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
	"font_face": "consolas",
	"font_size": 12,
	"ignored_packages":
	[
		"Vintage"
	],
	"show_encoding": true,
	"show_line_endings": true,
	"tab_size": 4,
	"theme": "Soda Light.sublime-theme",
    "update_check": false,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "draw_white_space": "all",
}


패키지들

Theme - Soda : 서브라임의 내부적인 레이아웃을 조금 둥글둥글하게 보이게 해주는 테마
setting 위치 : Preferences > Settings - User
{
	"theme": "Soda Light.sublime-theme",
}

AutoBackups : 파일의 저장이 일어날때마다 자동으로 특정 폴더에 저장 되기 전 문서를 백업 해주는 기능
setting 위치 : Preferences > Package Settings > AutoBackups > Settings - Default
{
	"backup_dir": "D:/Sublime_backup",
}

SublimeCodeIntel : 폴더 열기로 파일을 열고 선언된 class나 function에 F12키 누르면 해당 class나 fucntion의 선언 위치로 갈 수 있다. 하지만 선언된 변수들은 찾아주지 못한다. CodeIntel은 변수의 위치도 전부 찾아준다. 단, 설치한뒤 재시작을 해야 제대로 동작 한다.
setting 위치 : Preferences > Package Settings > SublimeCodeIntel > Key Bindings - User
[
//	{ "keys": ["shift+ctrl+space"], "command": "code_intel_auto_complete" },
//	{ "keys": ["super+alt+ctrl+up"], "command": "goto_python_definition"},
	{ "keys": ["ctrl+shift+c"], "command": "goto_python_definition"},
//	{ "keys": ["super+alt+ctrl+left"], "command": "back_to_python_definition"},
	{ "keys": ["ctrl+shift+x"], "command": "reveal_in_side_bar" },
	{ "keys": ["ctrl+shift+;"], "command": "clone_file" },
]

SFTP : sftp를 쓸 수 있게 해준다.
설정방법
  1. 새로운 폴더 test_sftp를 만든다.
  2. 서브라임 텍스트에서 test_sftp를 폴더 열기로 연다.
  3. 좌측의 폴더 트리에서 test_sftp를 마우스 오른쪽 버튼으로 클릭하고 SFTP/FTP > Map to Remote... 를 클릭한다.
  4. sftp-config.json 파일이 자동으로 생기면서 해당 셋팅 페이지(아래 참조)가 열릴것이다.
  5. 각종 접속 정보를 입력하고 upload_on_save 옵션을 true로 하고 저장한다.
  6. 좌측의 폴더 트리에서 test_sftp를 마우스 오른쪽 버튼으로 클릭하고 SFTP/FTP 를 가져다 대면, 이번엔 여러 메뉴가 생겼을 것이다. Sync Remote -> Local.. 을 클릭한다.
  7. 콘솔창에서 접속한 폴더의 파일을 받아와 test_sftp에 저장을 시작 할 것이다.
  8. 저장이 끝났다면 수정할 파일을 열고 수정 뒤 저자을 해보자. upload_on_save 옵션이 활성화 되어 있기 때문에 저장 즉시 서버에 파일을 upload 해줄 것이다.
{
    // The tab key will cycle through the settings when first created
    // Visit http://wbond.net/sublime_packages/sftp/settings for help
    
    // sftp, ftp or ftps
    "type": "sftp",

    "save_before_upload": true,
    "upload_on_save": true,
    "sync_down_on_open": false,
    "sync_skip_deletes": false,
    "sync_same_age": true,
    "confirm_downloads": false,
    "confirm_sync": true,
    "confirm_overwrite_newer": false,
    
    "host": "호스트 주소",
    "user": "아이디",
    "password": "비밀번호",
    "port": "포트",
    
    "remote_path": "접속할 폴더 위치",
    "ignore_regexes": [
        "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
        "sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
        "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
    ],
    //"file_permissions": "664",
    //"dir_permissions": "775",
    
    //"extra_list_connections": 0,

    "connect_timeout": 30,
    //"keepalive": 120,
    //"ftp_passive_mode": true,
    //"ftp_obey_passive_host": false,
    //"ssh_key_file": "~/.ssh/id_rsa",
    //"sftp_flags": ["-F", "/path/to/ssh_config"],
    
    //"preserve_modification_times": false,
    //"remote_time_offset_in_hours": 0,
    //"remote_encoding": "utf-8",
    //"remote_locale": "C",
    //"allow_config_upload": false,
}




//------------------- 2017.02.04 추가

서브라임에서는 한글을 쓸때 바로바로 써지지 않아서 불편한데, IMESupport패키지를 설치하면 조금 덜 불편하게 사용 가능하다.


//------------------- 2017.03.06 추가

html 태그 정렬을 자동으로 해주거나, space와 tab을 자동으로 일괄 치환 해줄때 사용.

ctrl + shift + p 를 누르고,

Indentation: Reindent Lines - 태그 자동 들여쓰기
Indentation: Convert to Spaces - 공백을 space로 변경
Indentation: Convert to Tab - 공백을 tab으로 변경