jschlatow / taskopen

Tool for taking notes and open urls with taskwarrior
GNU General Public License v2.0
364 stars 31 forks source link

taskopen does not honour $EDITOR any longer #102

Closed gour closed 7 years ago

gour commented 8 years ago

Hello,

few days ago I pulled latest taskopen and noticed that it does not honour my old setup and when I e.g. issue:

open someid

taskopen launches gedit editor instead of vim.

Here is my taskopenrc file:

#!/bin/bash

BROWSER='firefox'
EDITOR='vim'
TASKBIN='task'
# If you sync tasks FOLDER should be a location that syncs and is available to
# other computers, i.e. /users/dropbox/tasknotes
# FOLDER to store notes in, must already exist!
FOLDER="/home/gour/task/notes"

# Preferred extension for tasknotes
EXT=".txt"

# Message that gets annotated to the task to indicate that notes exist
NOTEMSG="Notes"

# Command that opens notes. UUID will be replaced with the actual uuid of 
# the task.
# Default is: $EDITOR ${FOLDER}UUID$EXT
NOTES_CMD="$EDITOR ${FOLDER}UUID$EXT"

For now solution was to revert with:

git co v1.0.2

Any hint?

Let me add that my (fish) shell also sets:

set -g -x EDITOR "vim"

which is confirmed with:

$ echo $EDITOR
vim
jschlatow commented 8 years ago

@gour, I'm sorry for the inconvenience. This was actually an intentional change that resulted from the discussion in #96. Now, xdg-open (or open on OSX) is used for all files.

You can query the current default as follows: xdg-mime query default text/plain

It will probably show something like gedit.desktop in your case. Execute xdg-mime default vim.desktop text/plain and try again.

gour commented 8 years ago

Now, xdg-open (or open on OSX) is used for all files.

Hmm...does it mean that there is no way to force taskopen to honour $EDITOR any longer?

It will probably show something like gedit.desktop in your case.

That's true.

Execute xdg-mime default vim.desktop text/plain and try again.

Well, I'm happy to have gedit as default text viewer when e.g. using Nautilus file manager, but for cli app like taskwarrior running under tasksh I'd like to have ability to use my $EDITOR which is used e.g. for git/fossil commit messages and other cli-related stuff.

So, if the new(er) taskopen cannot use $EDITOR, then I'll stay with the old version...

jschlatow commented 8 years ago

@gour. That's a good point. I haven't anticipated this use case. Nevertheless, there is an easy way to solve this with a simple wrapper script for xdg-open. You can find an example on the devel branch: https://github.com/ValiValpas/taskopen/blob/devel/scripts/xdg-open-cli

gour commented 8 years ago

Nevertheless, there is an easy way to solve this with a simple wrapper script for xdg-open.

From where should I call it?

Directly in taskopen with something like:

my $XDG = "xdg-open-cli";
jschlatow commented 8 years ago

You just need to modify the FILE_CMD in your ~/.taskopenrc, e.g.:

FILE_CMD='xdg-open-cli $FILE'
gour commented 8 years ago

You just need to modify the FILE_CMD

Ahh, I missed that one...thank you, it works now. ;)

scottkosty commented 7 years ago

Let me know (ideally through email since I don't follow every issue on Github) if there's any changes that should be made because of my commits. I'm willing to spend time to fix any bugs or design flaws because of changes I was involved with.