问题就是我们使用TextMate不支持GB2312等编码,用着及其不方便,下面是解决方案:
打开Bundle Editor
选则Show all
选则文件夹TextMate(或者随便你选则什么)
增加一个新的template‘openEncodedFile’(或者随便你自己命名)
在Template data中如下设定
Extension:中 留空
Command(s):
# open CocoaDialog's file select menu
file=$(CocoaDialog fileselect \
--title "Open an encoded file" \
--with-directory $HOME/ \
)
# check for valid file
if [ -n "$file" ]; then
# open CocoaDialog's dropdown menu
# for more encodings add them to '--items'
# to list all possibile encodings use the Terminal with 'iconv -l'
res=$(CocoaDialog dropdown \
--title "Open an encoded file" \
--text "Choose the encoding:" \
??exit?onchange \
--button1 "Open" \
--button2 "Cancel" \
--items "BIG5" "EUC-TW" "GB2312" "SJIS" "EUC-JP" "KOI8-R" \
)
# if user canceled exit
[[ $( (tail -r <<<"$res") | tail -n1) == "2" ]] && \
exit_discard
res=$(tail -n1 <<<"$res")
# add more 'elif' according to '--items' if needed
if [ "$res" == 0 ]; then
ENC="BIG5"
elif [ "$res" == 1 ]; then
ENC="EUC-TW"
elif [ "$res" == 2 ]; then
ENC="GB2312"
elif [ "$res" == 3 ]; then
ENC="SJIS"
elif [ "$res" == 4 ]; then
ENC="EUC-JP"
elif [ "$res" == 5 ]; then
ENC="KOI8-R"
fi
# start conversion to UTF-8 and send the result as a new file back to TM
iconv -f "$ENC" -t utf-8 "$file" > "$TM_NEW_FILE"
fi
Output: Insert as Text
- Activation: Key Equivalent shift+option+o (我的建议)
- Scope: 留空
分享到:
相关推荐
TextMate
使用TextMate的简单方法添加多个插入点,一次即可...TextMate使用捆绑软件进行自定义,并支持无数种不同的语言,标记系统,工作流等。 可以使用宏消除重复的工作。保存它们以便重复使用,或者记录便笺宏以立即重播。
Textmate 图标美化文件 textmate.icns覆盖/Applications/TextMate.app/Contents/Resources中同名文件
textmate, TextMate是 OS X 10.9 +的图形化文本编辑器 TextMate下载你可以从这里下载TextMate下载。反馈你可以使用的TextMate邮件列表或者 #textmate IRC频道在 freenode.net 中,用于问题。评论和 Bug 报告。你也...
可以媲美TextMate的编辑器,很强大的说
如何在不注册的情况下持久使用TextMate
自己编译的TextMate源代码。能用,网络权限问题,没有支持很多语言。
Mac下赫赫有名的TextMate编辑器,2.0beta版,官方下载通道貌似是通过亚马逊云分发,国内网络环境你懂得,所以不太方便下载,特上传给大家分享。
Mac 下非常不错的文本编辑器 1.5.11 稳定版 已破解
alpha 版的 textmate. 很强大的哦。Mac 用户的福音。
被成为mac上最牛的编辑器,textmate的教程,好多的快捷键和使用介绍,一定很有用的
Notepad++使用TextMate的主题
textmate2 开元后编译的版本,可以跟着升级。。别的就不说了
MACOSX下知名文本编辑器的源码,textmate
SublimeERB, sublime text的TextMate风格ERB块 textmate支持 sublime text 2的端口安装 Sublime 封装控制我建议使用 Sublime 包控制系统。 安装 Sublime 包控件后,可以在几个简单步骤中安装"sublimeerb"。按向 CTRL...
textmate.jar
eclipse也可以和textmate一样美
TextMate 风格语法高亮类库(基于 Swift 2.0).zip,TextMate-style syntax highlighting
javascript.tmbundle, TextMate的支持 安装你可以通过打开首选项并转到 bundles tab来在TextMate中安装这个包。 安装后,它会自动更新为你。常规在你做出更改之前,请先使用包 Styleguide在发送请求请求之前,请提交...