|
|
TipForEscape
You can use \ to escape a character in snippet
Introduction
You might be in troble with $, for example, you use perl. So you want to escape your $ in snippet.
Details
for example, you want a snippet to expand to
foreach my $key (keys %HASH) {
$value = $HASH{$key};
# do something
}This won't work
(require 'cperl-mode)
(smart-snippet-with-abbrev-tables
(cperl-mode-abbrev-table)
("fh" "foreach my $key (keys %$${HASH}) {
$>$value = $$${HASH}{$key};
$>$. # do something
}$>"
'bol?))You need to escape the first $ :
(cperl-mode-abbrev-table)
("fh" "foreach my $key (keys %$${HASH}) {
$>$value = \\$$${HASH}{$key};
$>$. # do something
}$>"
'bol?))Refer to here for more information about this.
Sign in to add a comment
