rubyのキーボードマップ(Ctrl+m)あたりに関連づけて使ってください。 emeditorの設定ではrubyの字下げはどうにもならんのでマクロで実装してみました。
TAB = " ";
Redraw = false;
document.selection.selectLine();
text = document.selection.Text;
document.selection.collapse();
document.selection.NewLine();
words = text.match(/^(.*?)(def|class|end|if|while|for|each)/);
if(!words)
quit();
word = words[0].replace(/\s/g,"");
indent = words[0].replace(/[\w\r\n]/g,"");
switch(word)
{
case "end":
up_and_unindent();
break;
default:
document.write(TAB);
break;
}
function up_and_unindent()
{
//end用の字下げ関数
document.selection.LineUp(false,1);
document.selection.selectLine();
var text = document.selection.Text;
document.selection.Text = text.replace(eval("/"+ TAB+ "/"),"");
document.selection.LineDown(false,1);
document.selection.selectLine();
document.selection.Text = document.selection.Text.replace(eval("/"+ TAB+ "/"),"");
}
