Hacker News new | ask | show | jobs
by dankco 1952 days ago
Thanks for the feedback! I agree with you in general and considered supporting $EDITOR. The problem is that I wanted to support always opening on a specific line, because it quickly became annoying starting at the top of the file and always scrolling/jumping.

The options that I see for using $EDITOR are: (1) simply ignore the line option for non-vim editors, (2) add implementation for specific editors, each with their own "jump to line" argument if it exists, or (3) add an additional command line argument that passes args/flags on to the editor. Option (3) seems best to me but I do worry about the number of supported flags - it is quite a lot already! More seriously, this option could be a vector for malicious code execution.

Thanks again, really appreciate the feedback! I'd love to hear your thoughts.

[EDIT: add comment on malicious code execution]

1 comments

You could support a variable $TEXTNOTE_EDITOR and it contains a string with placeholders for line number and file name.

Or you always invoke the editor as "$EDITOR +$LINE $FILE" and if someone wants to use an editor that uses different command line arguments, they have to write a wrapper shell script to rewrite it.

vim, nano, and emacs support this syntax. micro uses "micro ${FILE}:${LINE}", and subl (Mac command line tool for Sublime Text) uses it as well.