xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.43k stars 180 forks source link

"nb edit --editor EDITOR" is not working for me #303

Closed alusiani closed 4 months ago

alusiani commented 4 months ago

Hi,

I am using nb v7.10.3. I have not been able to select an editor using

nb edit --editor EDITOR 1

using EDITOR = code, hx and

According to the help the options -e or --editor should allow using the specified editor.

Cheers,

xwmx commented 4 months ago

@alusiani Thanks for the report!

nb expects an $EDITOR value representing one command that opens the editor, so the value should be either code or hx, but not both. You can also set $NB_EDITOR independently, which will override the value of $EDITOR in order to use a specific editor only for nb.

The --editor option takes a string as the editor value, e.g., nb editor --editor vim 1. To reference the value of the $EDITOR variable, include the dollar sign ($) and, preferably, quote the variable reference, e.g., nb editor --editor "$EDITOR" 1.

Finally, there was also a bug in the code that prevented edit --editor from overriding the value of $EDITOR. That has been fixed in the latest version in the repository and should be in the next release version.

alusiani commented 4 months ago

@xwmx thanks for the reply, I have now taken the nb version of today and indeed it works as documented.

@alusiani Thanks for the report!

nb expects an $EDITOR value representing one command that opens the editor, so the value should be either code or hx, but not both. You can also set $NB_EDITOR independently, which will override the value of $EDITOR in order to use a specific editor only for nb.

The --editor option takes a string as the editor value, e.g., nb editor --editor vim 1. To reference the value of the $EDITOR variable, include the dollar sign ($) and, preferably, quote the variable reference, e.g., nb editor --editor "$EDITOR" 1.

Finally, there was also a bug in the code that prevented edit --editor from overriding the value of $EDITOR. That has been fixed in the latest version in the repository and should be in the next release version.

xwmx commented 4 months ago

@alusiani Awesome. The bug fix is now available in the release version as of version 7.11.0. Thanks again!