Skip to content
Discussion options

You must be logged in to vote

Glad the approach fits! Could you paste the exact error (and hx --version)? My guess is the shell part: on Helix older than 25.01, the old argument parser drops the quotes around '#!/usr/bin/env python', so sh sees # as the start of a comment and things break.

Here's a version that avoids the shell entirely. It's a macro keybinding (Helix 25.01+), which replays plain keys:

[keys.normal]
"C-S-p" = "@<C-s>ggO#!/usr/bin/env<space>python<esc><C-o>"

Step by step: <C-s> saves the selection to the jumplist, gg goes to the file start, O opens a line above, the shebang is typed in, <esc> returns to normal mode, and <C-o> jumps back to where you were.

(Macro bindings can't be mixed into a [...] com…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@wf5w
Comment options

@weuderr
Comment options

Answer selected by wf5w
@wf5w
Comment options

@weuderr
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants