我为<加载了一个宏copying selective display>宏名称是copy_shown()。我可以通过绑定到某个键来运行该命令。但是如何在不绑定密钥的情况下运行它呢?我试图使用的宏是由Mathew - 见< Slickedit forum thread>。
////////////////////////////////////////////////////////////////////////////////////////////
#include "slick.sh"
/*
Copy the lines currently shown in the current buffer to the clipboard. This
should ignore lines that are hidden because of selective display settings.
*/
_command void copy_shown()
{
int lines_copied = 0;
// Create a new buffer to hold the displayed lines.
int tempWID;
int prevWID = _create_temp_view(tempWID);
// Switch back to the previous buffer to find the lines to copy.
p_window_id = prevWID;
// Place cursor on line 0 before first line of the buffer.
top(); up();
// Iterate across the lines in the buffer, copying those that are not hidden.
for (j=1; j<=p_Noflines; j++) {
// Go down and get the next line.
if (down()) break;
get_line(line);
// If this line is not hidden, copy it to the new buffer.
if (!(_lineflags() & HIDDEN_LF)) {
// Copy the line.
lines_copied++;
tempWID.insert_line(line);
}
}
if (lines_copied == 0) {
message('No displayed lines found!');
}
else {
// Activate the temp view to copy the lines
p_window_id = tempWID;
select_all();
copy_to_clipboard();
// Switch back to original view
p_window_id = prevWID;
s = lines_copied==1 ? '' : 's';
message(lines_copied ' line's ' copied to this buffer.');
}
// Clean up the temp view
_delete_temp_view(tempWID);
}
////////////////////////////////////////////////////////////////////////////////////////////
答案 0 :(得分:1)
[更新] 您可以从命令提示符
按名称运行它esc
esc
+ x
然后输入您的命令copy_shown
,甚至copy-shown
。
(其他仿真可能有其他序列进入&#34;命令行&#34;)
您还可以使用菜单:
Macros
- &gt; List Macros
然后选择您的宏并点击run
这也是检查它是否真正加载的好方法
的修改
按如下方式添加name_info
,以便在Macros
- &gt;中列出您的宏List Macros
_command void copy_shown() name_info(',' VSARG2_MACRO )