-
Notifications
You must be signed in to change notification settings - Fork 39
SnippetLibrary
Pedro A. Aranda Gutiérrez edited this page Jun 1, 2024
·
2 revisions
This is a place to post snippets that are clever and/or useful.
This generates a banner comment that spans the distance between the current column and the edge column (which I have set at 80).
banner = [[/%<string.rep("*", buffer.edge_column - buffer.column[buffer.current_pos] - 1)>
* %0
%<string.rep("*", buffer.edge_column - buffer.column[buffer.current_pos] - 2)>/]],
Generates an inclusion Guard for C/C++ header files. Defaults to the file's name without its extension and capitalized.
incguard = [[#ifndef %1(%<(buffer.filename or ''):match('[^/]*$'):upper():match('^[^%.]+')>)_H
#define %1_H
%0
#endif
]]
With the syntax introduced in TextAdept 12, converting hyphens in a field to underscores looks like this:
hypopt = [[
cmdopt='--{1:long-opt}, var='${1/-/_/g}'
]]