136
Sublime Text 3 에서 파이썬과 장고 사용하기

Sublime Text 3 for python and django

  • Upload
    -

  • View
    1.514

  • Download
    23

Embed Size (px)

DESCRIPTION

Sublime Text 3 for python and django 서브라임 텍스트 3에서 파이썬과 장고 사용하기

Citation preview

Page 1: Sublime Text 3 for python and django

Sublime Text 3에서����������� ������������������  파이썬과����������� ������������������  장고����������� ������������������  사용하기

Page 2: Sublime Text 3 for python and django

2 vs. 3

윈도리눅스

OS X (스노 레퍼드부터)

윈도리눅스

OS X (라이언부터)

v2.0.2 (2013.07.08)v3059 (2013.12.17)

v3062 (2014.05.05)

$70beta

(ST2 구입시 업그레이드 지원)

Page 3: Sublime Text 3 for python and django

특징

무료 (20분 동안 20~40번 저장시 구매 요청 팝업)

가벼움

다양한 플러그인

키보드 only 가능 (거의)

설정 파일이 파이썬 코드;;;

!

Page 4: Sublime Text 3 for python and django

오늘 알아볼 건파이썬 지원

Page 5: Sublime Text 3 for python and django

일단 기본 기능부터back to the basic

Page 6: Sublime Text 3 for python and django

스니펫(snippets)코드 조각 자동 완성

Page 7: Sublime Text 3 for python and django

이 상태에서 ⏎

Page 8: Sublime Text 3 for python and django

이 상태에서`My` 입력

Page 9: Sublime Text 3 for python and django
Page 10: Sublime Text 3 for python and django

이 상태에서 ⏎

Page 11: Sublime Text 3 for python and django
Page 12: Sublime Text 3 for python and django

이런 식으로간단한 코드 조각을

만들어 줌

Page 13: Sublime Text 3 for python and django
Page 14: Sublime Text 3 for python and django
Page 15: Sublime Text 3 for python and django
Page 16: Sublime Text 3 for python and django
Page 17: Sublime Text 3 for python and django

자동 완성(Code Completion)

⌃ + space

Page 18: Sublime Text 3 for python and django

⌃ + space

입력

Page 19: Sublime Text 3 for python and django
Page 20: Sublime Text 3 for python and django

단축키(Key Binding)

OS X : ⌘ = 윈도 : ⌃

Page 21: Sublime Text 3 for python and django

Go To Anything⌘ + p

Page 22: Sublime Text 3 for python and django
Page 23: Sublime Text 3 for python and django
Page 24: Sublime Text 3 for python and django
Page 25: Sublime Text 3 for python and django
Page 26: Sublime Text 3 for python and django
Page 27: Sublime Text 3 for python and django
Page 28: Sublime Text 3 for python and django

Command Pallete모든 메뉴에 접근 가능 + α

Page 29: Sublime Text 3 for python and django
Page 30: Sublime Text 3 for python and django

붙여넣기⌘⇧ + v

Page 31: Sublime Text 3 for python and django

여기에

Page 32: Sublime Text 3 for python and django

이걸 복사해서

Page 33: Sublime Text 3 for python and django

그냥 붙여넣으면들여쓰기 엉망

Page 34: Sublime Text 3 for python and django

하지만

⌘⇧ + v 는

Page 35: Sublime Text 3 for python and django

검색현재 파일(⌘ + f), 여러 파일(⌘⇧ + f)

Page 36: Sublime Text 3 for python and django

현재 파일, 찾기

⌘ + f

Page 37: Sublime Text 3 for python and django

현재 파일, 바꾸기

⌘⌥ + f

Page 38: Sublime Text 3 for python and django

여러 파일, 바꾸기

⌘⇧ + f

Page 39: Sublime Text 3 for python and django

내용이 여러 줄일 땐

⌃ + enter

Page 40: Sublime Text 3 for python and django

플러그인https://sublime.wbond.net/installation

Page 41: Sublime Text 3 for python and django

이 부분을 복사

Page 42: Sublime Text 3 for python and django

콘솔 띄우고(⌃ + `)

붙여넣고엔터

Page 43: Sublime Text 3 for python and django

설치 완료

Page 44: Sublime Text 3 for python and django

이제 ⌘⇧ + p를

입력하고Install Package 선택

Page 45: Sublime Text 3 for python and django

Spacegray 테마를 설치해보자

Page 46: Sublime Text 3 for python and django

설치되었음

Page 47: Sublime Text 3 for python and django

다른 패키지도이런 식으로 설치

Page 48: Sublime Text 3 for python and django

자동 포맷PEP8 규칙에 맞춰 소스코드를 고쳐줌

Page 49: Sublime Text 3 for python and django

설치 횟수

업데이트 활성 정도

Page 50: Sublime Text 3 for python and django

패키지의 설정을 바꾸고 싶을 땐default 설정 복사 → user 설정에 붙여 넣기

Page 51: Sublime Text 3 for python and django
Page 52: Sublime Text 3 for python and django

Default 내용을복사해서

Page 53: Sublime Text 3 for python and django
Page 54: Sublime Text 3 for python and django

User Settings에 붙여 넣고 수정

Page 55: Sublime Text 3 for python and django
Page 56: Sublime Text 3 for python and django
Page 57: Sublime Text 3 for python and django

ST2용자동 포맷 패키지

Page 58: Sublime Text 3 for python and django

LinterPEP 규칙 등에 어긋나는 부분을 표시

Page 59: Sublime Text 3 for python and django

이건 기본으로설치한 후

Page 60: Sublime Text 3 for python and django

이런 걸 설치pylint, pep8 ...

Page 61: Sublime Text 3 for python and django

설치 후 나타나는 화면에 유의

Page 62: Sublime Text 3 for python and django

자세한 설정법은홈페이지 참조

Page 63: Sublime Text 3 for python and django

일단 pylint부터설치하고

Page 64: Sublime Text 3 for python and django

여기랑

Page 65: Sublime Text 3 for python and django

여기만 설정하면

Page 66: Sublime Text 3 for python and django

linting!

Page 67: Sublime Text 3 for python and django

코드 자동 완성Auto Completion

Page 68: Sublime Text 3 for python and django
Page 69: Sublime Text 3 for python and django

ST 기본 자동 완성 =

문서 내 키워드

Page 70: Sublime Text 3 for python and django

Python Auto-Complete 패키지 설치 이후

파이썬 키워드가 위에 나타남

Page 71: Sublime Text 3 for python and django
Page 72: Sublime Text 3 for python and django

Jedi 패키지설치 이후

Page 73: Sublime Text 3 for python and django

좀더 다양한키워드 제공

Page 74: Sublime Text 3 for python and django

All in One이 모든 기능을 한 패키지에 담았습니다

Page 75: Sublime Text 3 for python and django
Page 76: Sublime Text 3 for python and django

Auto import는잘 안 되는 듯

Page 77: Sublime Text 3 for python and django

정의 부분바로 가기는 잘 됨

(Goto Definition)

Page 78: Sublime Text 3 for python and django

선택된 내용이어디서 사용되는지

(Find Usage)

Page 79: Sublime Text 3 for python and django

REPL콘솔을 Sublime Text 창으로

Page 80: Sublime Text 3 for python and django
Page 81: Sublime Text 3 for python and django

선택 부분을바로 실행해 볼 수

있음

Page 82: Sublime Text 3 for python and django

IPython도 지원하고

Page 83: Sublime Text 3 for python and django

이런 식으로 나타남

Page 84: Sublime Text 3 for python and django

장고 지원

Page 85: Sublime Text 3 for python and django

Django 용다양한 스니펫 제공

Page 86: Sublime Text 3 for python and django
Page 87: Sublime Text 3 for python and django
Page 88: Sublime Text 3 for python and django
Page 89: Sublime Text 3 for python and django
Page 90: Sublime Text 3 for python and django
Page 91: Sublime Text 3 for python and django
Page 92: Sublime Text 3 for python and django
Page 93: Sublime Text 3 for python and django
Page 94: Sublime Text 3 for python and django
Page 95: Sublime Text 3 for python and django
Page 96: Sublime Text 3 for python and django
Page 97: Sublime Text 3 for python and django
Page 98: Sublime Text 3 for python and django

템플릿에서다른 템플릿 바로 가기

Page 99: Sublime Text 3 for python and django

extends나 include 태그의 파일 명에서

⌃ + click하면

Page 100: Sublime Text 3 for python and django

해당 파일이 바로 열림

Page 101: Sublime Text 3 for python and django

부록 A Git 지원

git 명령은 외우기 어려우니까…

Page 102: Sublime Text 3 for python and django
Page 103: Sublime Text 3 for python and django

쓸 때 마다 헷갈리는Amend Commit도

Page 104: Sublime Text 3 for python and django

StatusM - 수정

?? - add하지 않음

Page 105: Sublime Text 3 for python and django

.gitignore를환경에 맞춰 만들어 줌

Page 106: Sublime Text 3 for python and django
Page 107: Sublime Text 3 for python and django
Page 108: Sublime Text 3 for python and django
Page 109: Sublime Text 3 for python and django

수정된 부분을이전 버전과 비교해 줌

Page 110: Sublime Text 3 for python and django

행 삭제

행 추가

수정

Page 111: Sublime Text 3 for python and django

staging, commit 등을단축키로 손쉽게 실행

Page 112: Sublime Text 3 for python and django
Page 113: Sublime Text 3 for python and django

부록 B 기타 플러그인

파이썬, 장고와 관련은 없지만…

Page 114: Sublime Text 3 for python and django

사이드바의 문맥 메뉴에다양한 기능 추가

Page 115: Sublime Text 3 for python and django

(빈약한)ST 기본 문맥 메뉴

Page 116: Sublime Text 3 for python and django

패키지 설치 후

Page 117: Sublime Text 3 for python and django

HTML이나 CSS를작성해야 한다면

Page 118: Sublime Text 3 for python and django

설명하자면 내용이 너무 많으니

http://emmet.io

Page 119: Sublime Text 3 for python and django

etc. 기타 설정

Page 120: Sublime Text 3 for python and django

셸에서 실행하기subl `filename`

Page 121: Sublime Text 3 for python and django

$ alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"

$ export EDITOR="subl"

Page 122: Sublime Text 3 for python and django

iterm과 연결⌘ + click

Page 123: Sublime Text 3 for python and django

이 글을 읽고 배움

Page 124: Sublime Text 3 for python and django

iTerm의 Preference → Profile → Advanced

Page 125: Sublime Text 3 for python and django

⌘ + click하면

Page 126: Sublime Text 3 for python and django

파일이 Sublime에서 열림

Page 127: Sublime Text 3 for python and django

이 외에도 다양한 Sublime Text의 팁 & 트릭 !

http://blog.outsider.ne.kr/1059 !

thanks to outsider

Page 128: Sublime Text 3 for python and django

서드파티 패키지virtuanenvwrapper의 도움으로

Page 129: Sublime Text 3 for python and django

내가 만든 파이썬 패키지를 내 서비스에서 사용하는데…

패키지 수정할 때마다 pip uninstall / pip install 귀찮

Page 130: Sublime Text 3 for python and django

현재 설치된 패키지 목록

Page 131: Sublime Text 3 for python and django

virtualenvwrapper에서 제공하는add2virtualenv 명령을 사용하면

path를 쉽게 추가할 수 있음

Page 132: Sublime Text 3 for python and django

이렇게 추가된 내용을 확인하려면lssitepackages 명령 사용

Page 133: Sublime Text 3 for python and django

더 보기검색의 생활화

Page 134: Sublime Text 3 for python and django

•생활코딩 Sublime Text 강의http://opentutorials.org/course/671/3595

•패키지 찾기 https://sublime.wbond.net

• Perfect Workflow in Sublime Text 2 http://courses.tutsplus.com/courses/perfect-workflow-in-sublime-text-2

• https://twitter.com/SublimeTxtTips

• google - sublime text 'python'

Page 135: Sublime Text 3 for python and django

Q & A