Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aab8f82

Browse files
idbriilpil
authored andcommitted
Add optional suffix to temp file
Sometimes it is useful to add a suffix to make a temp file get detected by ftdetect.
1 parent 63964df commit aab8f82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

UltiSnips/sh.snippets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ IFS=$'\n\t'
4141
endsnippet
4242

4343
snippet temp "Tempfile"
44-
${1:TMPFILE}="$(mktemp -t ${2:`!p
44+
${1:TMPFILE}="$(mktemp -t ${3:--suffix=${4:.SUFFIX}} ${2:`!p
4545
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
4646
`}.XXXXXX)"
47-
${3:${4/(.+)/trap "/}${4:rm -f '$${1/.*\s//}'}${4/(.+)/" 0 # EXIT\n/}${5/(.+)/trap "/}${5:rm -f '$${1/.*\s//}'; exit 1}${5/(.+)/" 2 # INT\n/}${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'; exit 1}${6/(.+)/" 1 15 # HUP TERM\n/}}
47+
${5:${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'}${6/(.+)/" 0 # EXIT\n/}${7/(.+)/trap "/}${7:rm -f '$${1/.*\s//}'; exit 1}${7/(.+)/" 2 # INT\n/}${8/(.+)/trap "/}${8:rm -f '$${1/.*\s//}'; exit 1}${8/(.+)/" 1 15 # HUP TERM\n/}}
4848

4949
endsnippet
5050

0 commit comments

Comments
 (0)