Answers:
手册中没有提及任何内容(仅交换字符和交换词)。
如果TextWrangler支持Cocoa Text System(我怀疑它不支持,但仍然可以),则可以创建文件~/Library/Keybindings/DefaultKeyBinding.dict
并输入以下内容:
{
"~\UF701" = (
"moveToBeginningOfLine:",
"deleteToEndOfLine:",
"deleteForward:",
"moveDown:",
"yank:",
"insertNewline:",
"moveUp:"
);
}
这将为Opt-DownArrow
支持Cocoa文本系统的每个应用程序添加换行命令的快捷方式(下面的行)。
我不认为TextWrangler具有内置功能。
不过,您可以在TextWrangler中运行applescript,因此可以完成这项工作。我什至找到了一些可以完成此操作的applescripts。
您将需要用applescripts中的TextWrangler替换BBEdit。将脚本放在“〜/ Library / Application Support / TextWrangler / Scripts /”中,它们将显示在TextWrangler的脚本菜单中。单击窗口->调色板->脚本以查看脚本调色板,您可以在其中设置自定义键盘快捷键。
nathangs解决方案效果很好。但是提供的链接不再起作用。所以这是纯文本格式的脚本。只需将它们粘贴到“ AppleScript编辑器”中,然后将其保存到〜/ Library / Application Support / TextWrangler / Scripts /
在Mountain Lion和TextWrangler 4上运行良好。
MoveLineDown.scpt:
tell application "TextWrangler"
set x to startLine of selection
tell text 1 of window 1
if x = (count of lines) then return
set myline to contents of line x
delete line x
if length of line x = 0 then
make line at line x with data "
"
make line at line (x + 1) with data myline
else
make line at line x with data myline
end if
select insertion point before line (x + 1)
end tell
end tell
MoveLineUp.scpt:
tell application "TextWrangler"
set x to startLine of selection
if x = 1 then
beep
return
end if
tell text 1 of window 1
set oldCount to count of lines
set myline to contents of line x
delete line x
if x = 2 then
if length of line 1 = 0 then
make line at beginning with data "
"
end if
make line at beginning with data myline
else
if length of line (x - 2) = 0 then
make line at line (x - 2) with data "
"
make line at line (x - 1) with data myline
else
make line at line (x - 2) with data myline
end if
end if
select insertion point before line (x - 1)
end tell
end tell