`

TextMate install (转)

    博客分类:
  • mac
阅读更多

一、安装TextMate

首先去网上下载一个TextMate_1.5.9.dmg镜像安装包,双击后执行文件夹中的TextMate。

然后再下载一个TextMate.ttf中文字体包,双击进行安装。

二、破解TextMate

1、去除原来的注册码,打开终端,执行如下命令:defaults delete com.macromates.textmate

2、去下载一个名为0xED的mac软件,这是一个十六进制的编辑器

3、到应用程序中找到刚刚安装好的TextMate,右击图标,选择显示包内容,然后进入Contents->MacOS目录,你会看到一个TextMate文件

4、右击该TextMate文件,打开方式选择0xED

5、找到文件里所有的年份日期并修改,然后保存。(我使用的是TextMate1.5.9,所以将文件里所有的2009改为2099即可)

6、打开TextMate程序,输入如下注册信息:

user:handholder crakced you

code: DKFTCCXCMWOX35TZKPRN5YNR2NYUTJJAY52VHWKX2H5URTUB72KW- RCRTQJCC2ZZV5BTHSKCNQXTAOSGSLN46V3E7NIJKDBLRDY37NRVD- IXQWZ5SVPHBN67JZDZTTAQ6MS4ROVXRCGDZGKGE2VGOGHEYMPRGY- O5Y243GTBKPZLPP55QSBIHR6MDEUBMVQT4Q3SESPWETRG6PJM

 

7、打开TextMate->Registration,可以看到已经成功注册。

TextMate快捷键:

ctrl+e 一行的行首/行尾切换
option+ <-   -> 光标往左 右移动一个单词
ctrl+k  剪切掉光标后的内容
ctrl+y  在光标后面复制内容
ctrl+w 选择一个单词
shift+command+L 选择一行
ctrl+G 单个字符大小写转换
ctrl+u 整个单词大写
shift+ctrl+u 整个单词小写
ctrl+T 光标左右两个字符位置调换
ctrl+option+u 整行所有的单词首字符大写
shift+ctrl+u     整行单词小写
ctrl+command+<-  -> 所选中的左移 右移 可结合ctrl+w来使用
当用shift+光标来选中了一个区域后,按option来选择两光标垂直区域,也叫column select
command+[  ] 左移 右移所选中的内容


solve registration request:
$ defaults delete com.macromates.textmate


TextMate’s magic: bundles, customized commands, snippets and macros recording
[Bundles]
bundle应该是TextMate里名气最大的了,如果你熟悉eclipse的话,bundle其实和eclipse的plugin很像,虽然 textmate也有plugin但bundle的应用显然要更为广泛,之于历史,特性,比较之类的请交给google,这不是我们这儿的focus。
一般TextMate一个release都会built-in一堆广泛使用并口碑较好的bundle,好的bundle很多以至于我本人从来是都是觉得 bundle太多太眼花了,其实真正经常用到的bundle就这么几个,于是bundle的更新倒是成了更大的问题,好在TextMate继承了*nix 的传统,会优先读取user home下的bundle,问题的解决于是变的异常之trivial。
以TextMate的ruby on rails bundle为例,安装只要几行命令:

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/drnic/ruby-on-rails-tmbundle.git "Ruby on Rails.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'


下次更新只要git pull一下然后tell textmate to reload bundles就万事大吉了。

[Commands & Snippets]
Command和Snippet是Bundle里面真正工作的unit,按照我个人的理解,snippet是textmate自己internal的解释 执行,而command则是借助外部命令,因此command也比snippet相对更为强大,因为我们可以用 ruby,python,perl,bash甚至php来进行文本处理,最后一点让command比snippet强大成为必然,那便是command最 后执行的结果不但可以作为literal的text insert到editor中去,甚至也可以作为snippet而insert,想象一下… so powerful!
这里只举一个简单的例子,比如我最近写php code老是对每一行最后的“;”诟病不少,不是忘了就是觉得老是要移到行末然后append那个分号很stupid,于是一个模仿以前eclipse对 java code的分号处理的command应运而生,本质上就是我在这一行随便哪个位置敲一个”;”,如果行末没有分号的话就直接append到行末,如果已经 存在就把光标移到最后方便我敲回车换行…
Command本身的code用ruby实现,并bind到”;”这个key,scope的话只针对source.php:

#!/usr/bin/env ruby
line = STDIN.read.rstrip.gsub('$', '\$')

if(line =~ /;$/)
  print line
else
  print "#{line};"
end


How to start textmate in command line

Even though is question is more suited for Super User, I'll bite:

Creating a symbolic link can either be done by selecting Help → Terminal Usage… from the menu, or from the shell by running something like the following:

ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate
This assumes that you have ~/bin created and in your path and that TextMate is installed in /Applications.

Therefore, I'd recommend looking inside of the Textmate.app bundle :)


q:~ qmb$ pwd
/Users/qmb
q:~ qmb$ mate /Users/qmb/.rvm/gems/ruby-1.8.7-p302@rails3/gems/actionpack-3.0.0/lib/action_view/base.rb


http://projects.serenity.de/textmate/tutorials/basics/

shortcuts:
<cmd + t>  open files
<cmd + f>  find a str in curr file
<opt + cmd + l>  show line number
< cmd + l>  go to line



Shortcut    Command    How useful(?)
Navigation
Optn+Cmd+ left arrow    Previous file tab     +       –
Optn+Cmd+Right arrow    Next file tab     +       –
Cmd+T    Go to file     +       –
Cmd+L    Go to line     +       –
Cmd+F2    Add bookmark     +       –
F2    Next bookmark     +       –
Shft+F2    Previous bookmark     +       –
 
View
Optn+Cmd+L    Show line numbers     +       –
Optn+Cmd+B    Show bookmarks     +       –
Optn+Cmd+I    Show invisibles     +       –
F1    Fold current block     +       –
Ctrl+Optn+Cmd+D    Show project drawer     +       –
Ctrl+Optn+Cmd+P    Show web preview     +       –
 
Edit
Cmd+Z    Undo     +       –
Shft+Cmd+Z    Redo     +       –
Ctrl+Optn+Cmd+V    Clipboard history     +       –
Ctrl+Cmd+V    Paste without indentation     +       –
Optn+Cmd+E    Freehand editing mode     +       –
Optn+Cmd+O    Overwrite mode     +       –


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics