aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bobov <anton@bobov.name>2026-01-20 23:33:25 +0500
committerAnton Bobov <anton@bobov.name>2026-01-20 23:33:25 +0500
commita988d0f9bccbb8a3abe4b968c838f155b5e1b570 (patch)
treeae31a4b264f23e3a7a9a6511e6c5dcc8a8c7490e
parenta01fec95d9b227f7803c49eee103fd9f5dcb681b (diff)
vim: add Python snippets and fix sh argc evalHEADmaster
-rw-r--r--files/.vim/UltiSnips/python.snippets39
-rw-r--r--files/.vim/UltiSnips/sh.snippets2
2 files changed, 40 insertions, 1 deletions
diff --git a/files/.vim/UltiSnips/python.snippets b/files/.vim/UltiSnips/python.snippets
new file mode 100644
index 0000000..0f1c366
--- /dev/null
+++ b/files/.vim/UltiSnips/python.snippets
@@ -0,0 +1,39 @@
+# https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata
+# https://peps.python.org/pep-0723/
+snippet inline-script "Inline script metadata" b
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+# "requests",
+# ]
+# ///
+endsnippet
+
+snippet #! "Run script with python3" b
+#!/usr/bin/env python3
+
+endsnippet
+
+snippet #!pipx "Run script with pipx" b
+#!/usr/bin/env -S pipx run --path
+
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+# "requests",
+# ]
+# ///
+
+endsnippet
+
+snippet #!uv "Run script with uv" b
+#!/usr/bin/env -S uv run --script
+
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+# "requests",
+# ]
+# ///
+
+endsnippet
diff --git a/files/.vim/UltiSnips/sh.snippets b/files/.vim/UltiSnips/sh.snippets
index d9087eb..4bc2ff3 100644
--- a/files/.vim/UltiSnips/sh.snippets
+++ b/files/.vim/UltiSnips/sh.snippets
@@ -87,5 +87,5 @@ main() {
$0
}
-eval "$(argc --argc-eval "$0" "$@")"
+eval "$(argc --argc-eval "\$0" "$@")"
endsnippet