4 ms·
> Currently, Vim is the only supported text editor. Are you familiar with the $EDITOR and/or $VISUAL environment variables? Text-based (i.e., CLI) application
by jlgaddis 6y ago
> Currently, Vim is the only supported text editor.
Are you familiar with the $EDITOR and/or $VISUAL environment variables?
Text-based (i.e., CLI) applications which spawn a text editor should respect/support them as much as possible.
- kesor 6y agonot if they use the editor specific features like jumping to a specific line in the text
- dankco 6y agoThanks 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]
- hibbelig 6y agoYou 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.
- dankco 6y agoI have released v1.1.0 with support for $EDITOR. While textnote will work with any editor, the ability to open on a specific line is currently supported for vi/vim, emacs, neovim, and nano. Thanks again for your feedback, which lead to this improvement!