下面是一個寫在AutoHotkey的:
#NoEnv
SetWorkingDir %A_ScriptDir%
SendMode Input
#InstallKeybdHook
#UseHook On
(::
if GetKeyState("ScrollLock","T")
{
sel := GetSelection(1)
if sel
PasteText("(" sel ")")
else
Send (
sel := ""
}
else
Send (
Return
"::
if GetKeyState("ScrollLock","T")
{
sel := GetSelection(1)
if sel
PasteText("""" sel """")
else
Send "
sel := ""
}
else
Send "
Return
'::
if GetKeyState("ScrollLock","T")
{
sel := GetSelection(1)
if sel
PasteText("'" sel "'")
else
Send '
sel := ""
}
else
Send '
Return
{::
if GetKeyState("ScrollLock","T")
{
sel := GetSelection(1)
if sel
PasteText("{" sel "}")
else
Send {{}}
sel := ""
}
else
SendRaw {
Return
[::
if GetKeyState("ScrollLock","T")
{
sel := GetSelection(1)
if sel
PasteText("[" sel "]")
else
Send [
sel := ""
}
else
Send [
Return
<::
if GetKeyState("ScrollLock","T")
{
sel := GetSelection(1)
if sel
PasteText("<" sel ">")
else
Send <
sel := ""
}
else
Send <
Return
GetSelection(wait = "")
{
ClipBack := ClipboardAll
Clipboard := ""
Send ^c
if wait
ClipWait 0.05
Selection := Clipboard
Clipboard := ClipBack
Return Selection
}
AutoHotkey的安裝後,這段代碼保存到一個文本文件,重命名擴展.ahk並運行它。它需要打開Scroll Lock才能使代碼正常工作。
該代碼從http://www.autohotkey.net/~Vifon/修改爲:
- 包含 '和<
- 寫入',」 <,{[(而不是 '', 「」,<>,{} ,當沒有文本被選中時,[],()
這確實不錯。 – 2009-11-14 14:06:58
這在日食中是不可能的。但是Eclipse支持自動報價關閉。 – Secko 2009-11-18 00:46:45