選択行コメントアウト
- ページ: Macro/投稿
- 作者: maru
- カテゴリー: js
- 投稿日: 2005-07-21 (木) 00:03:54
メッセージ
よくある選択範囲コメントマクロです。
- コメントアウト化
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| | var aExt = new Array();
aExt["c"] = "//"; aExt["cpp"] = "//"; aExt["h"] = "//";
aExt["js"] = "//";
aExt["vbs"] = "'"; aExt["bas"] = "'"; aExt["frm"] = "'"; aExt["cls"] = "'";
aExt["mac"] = "//";
aExt["pl"] = "#"; aExt["pm"] = "#"; aExt["cgi"] = "#";
aExt["tex"] = "%";
aExt["php"] = "//";
aExt["asm"] = ";";
aExt["uws"] = "//";
aExt["conf"] = ";"; aExt["cnf"] = ";"; aExt["ini"] = ";"; aExt["inf"] = ";";
aExt["ppa"] = "//";
aExt["cmd"] = "rem"; aExt["bat"] = "rem";
GoLineTop(13);
sSelect = GetSelectedString(0);
if (sSelect.length == 0) GoLineEnd_Sel();
sExt = ExpandParameter("$f");
sExt = sExt.substring( sExt.lastIndexOf(".") + 1);
sExt = sExt.toLowerCase()
if (aExt[sExt] == "rem"){
ReplaceAll ("^.", "rem\t$&", 148);
}
else {
ReplaceAll ("^.", aExt[sExt] + "$&", 148);
}
CancelMode();
SearchClearMark();
ReDraw(0);
|
- コメントアウト解除
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| | var aExt = new Array();
aExt["c"] = "//"; aExt["cpp"] = "//"; aExt["h"] = "//";
aExt["js"] = "//";
aExt["vbs"] = "'"; aExt["bas"] = "'"; aExt["frm"] = "'"; aExt["cls"] = "'";
aExt["mac"] = "//";
aExt["pl"] = "#"; aExt["pm"] = "#"; aExt["cgi"] = "#";
aExt["tex"] = "%";
aExt["php"] = "//";
aExt["asm"] = ";";
aExt["uws"] = "//";
aExt["conf"] = ";"; aExt["cnf"] = ";"; aExt["ini"] = ";"; aExt["inf"] = ";";
aExt["ppa"] = "//";
aExt["cmd"] = "rem"; aExt["bat"] = "rem";
GoLineTop(13);
sSelect = GetSelectedString(0);
if (sSelect.length == 0) GoLineEnd_Sel();
sExt = ExpandParameter("$f");
sExt = sExt.substring( sExt.lastIndexOf(".") + 1);
sExt = sExt.toLowerCase()
if (aExt[sExt] == "rem"){
ReplaceAll ("^([\t\s]*)rem[\t\s]", "$1", 148); }
else {
ReplaceAll ("^([\t\s]*)" + aExt[sExt], "$1", 148); }
CancelMode();
SearchClearMark();
ReDraw(0);
|
- 新規編集の時undefinedを避ける定義 その1aExt["(無題)"] = "> "; その2aExt["nonext"] = "> "; として切り出しのところを置き換える if ( sExt.lastIndexOf(".") == -1) {sExt = "nonext";} else {sExt = sExt.substring( sExt.lastIndexOf(".") + 1); sExt = sExt.toLowerCase();} jscript未学習です。学習する気はありません。お粗末ですが、工夫しまてみました。 -- お粗末ですが?
|