Sunday, July 10, 2011

Hello World!출력을 TextCommand를 사용하지 않고 insert api사용해 출력하기

처음 시작했던 Hello World!를 찍는 TextCommand 클래스를 작성했던 것을 기억하시나요?
단순히 Hello World!를 찍어야 하는 것을 단축키로 해야한다면, TextCommand 클래스를 작성하지 않고, 제공되는 WindowCommand의 insert api를 호출하는 것을 단축키로 설정하는 것이 가능하더군요. 이렇게요.

[
{ "keys": ["ctrl+."], "command": "insert", "args": {"characters": "<%= %>"} }
]

출력과 동시에 커서를 저 가운데로 옮기고 싶다면 $0 기호를 사용합니다. 이렇게요.


[
{ "keys": ["ctrl+shift+."], "command": "insert_snippet", "args": {"contents": "<%=$0 %>"} }
]

#이 내용은 http://stackoverflow.com/questions/6635417/sublime-text-2-keybindings 를 참조했습니다.
#아직 작성중인 듯 합니다만, api 문서의 url은 이쪽입니다. http://www.sublimetext.com/docs/2/api_reference.html

No comments:

Post a Comment