Quantitative Life Happy learning everyday.

Back to Textmate2

如果提到Shell,只联想到大海生蚝,请按 CTRL+W

使用Python编写的Sublime Text是一款很棒的编辑器,它把Textmate的bundle带到了windows的平台上,并且独创了Package Management System,使bundle的开发、分发和安装更加容易。而Atom更是如日中天的后起之秀,相信在github的影响力和Node.js的强大社区的推动下,它也一定能发展的很好。但我最终还是选择回到Textmate,因为它可以使用Shell,再通过shebang,可以在textmate中执行自己擅长的脚本语言,例如我熟悉的Ruby:#!/usr/bin/env ruby

比如,在编辑器中获取属性目录:

tree -d /Users/Kidy/Developer/kidylee.com ⌃ + R 就会生成目录结构:

/Users/Kidy/Developer/kidylee.com
├── _includes
├── _layouts
├── _posts
├── _sass
├── _templates
└── css

6 directories

当然切换编辑器还是有一些额外的学习成本,这里是我的一些设置和总结。

###在File Browser中显示隐藏文件 平时我会在github上维护自己的dotfile,主要是为了方便调教新机或新系统: 用鼠标选中任意文件,按⌥ + ⌘ + I。 手不离键盘版本:⌥ + ⌘ + ⇥⌥ + ⌘ + I⌥ + ⌘ + ⇤

其中:: tab键,: shift+tab

###在Finder中用TextMate打开文件或文件夹 打开Automator -> service -> run applescript,贴入一下脚本,保存为Open in Textmate。

shortcut
on run {input, parameters}

    try
        tell application "Finder"
        open (get selection) using path to application "TextMate"
        end tell
    end try

    return input
end

在finder中,对文件或文件夹使用右键,就可以看到Open in Textmate了。 还可以设置快捷键,System Preferences -> keyboard -> Shortcuts tab -> service 找到Open in Textmate,设置快捷键:⇧ + ⌘ + m

###Textmate dotfile Textmate的配置文件,也能够用dotfile的形式保存,方便下次设置,路径为 ~/.tm_Properties 其中,theme的UUID是Solarized

theme    = '38E819D9-AE02-452F-9231-ECC3B204AFD7'
fontName = 'Menlo-Regular'
fontSize = 16
encoding = "UTF-8"
softTabs = true
tabSize  = 2
projectDirectory     = "$CWD"

exclude  = "{*.{o,pyc},Icon\r,CVS,_darcs,_MTN,\{arch\},blib,*\~.nib}"
include  = "{*,.tm_properties,.htaccess}"
binary   = "{*.{ai,bz2,flv,gif,gz,icns,ico,jpg,jpeg,m4v,nib,o,pdf,png,psd,pyc,rtf,scssc,swf,tar,tbz,tgz,tif,tiff,xib,zip},Icon\r}"

windowTitleSCM     = '${TM_SCM_BRANCH:+ ($TM_SCM_NAME: $TM_SCM_BRANCH)}'
windowTitleProject = '${projectDirectory:+ — ${projectDirectory/^.*\///}}'
windowTitle        = '$TM_DISPLAYNAME$windowTitleProject$windowTitleSCM'

LANG                 = "en_US.UTF-8"
LC_CTYPE             = "en_US.UTF-8"
TM_APP_PATH          = "${CWD/\/Contents\/Resources$//}"
TM_MATE              = "$CWD/mate"
MATEFLAGS            = "--no-recent"
TM_QUERY             = "$CWD/tm_query"
TM_SCM_COMMIT_WINDOW = "$CWD/commit"
TM_RUBY              = "$HOME/.rvm/bin/rvm-auto-ruby"

[ attr.untitled ]
fileType         = text.plain

[ "/usr/include/{**/,}*" ]
tabSize          = 8

[ text ]
softWrap         = true

[ text.git-commit ]
spellChecking    = true
spellingLanguage = 'en'

[ "/System/Library/Frameworks/**/Headers/**/*" ]
encoding         = "MACROMAN"


[ "{BUILD,README,INSTALL,LICENSE,COPYING,TODO}" ]
fileType         = "text.plain"