On Fri, 4 Oct 2013 07:07:54 -0700 (PDT)
Josef <joe...@gmx.net> wrote:

> Just my 2 cents worth:
> 
> I wish I could right-click on any @url (or such) or @path thing in Leo and 
> would have an option to open up the enclosing directory of the target in 
> the file manager of my choice.
> This would make it easier to mix it with other tools.

I use this @button script

import subprocess
import os

aList = g.get_directives_dict_list(p)
path = c.scanAtPathDirectives(aList)
if p.h.startswith('@'):  # see if it's a @<file> node of some sort
    nodepath = p.h.split(None, 1)[-1]
    nodepath = g.os_path_join(path, nodepath)
    if not g.os_path_isdir(nodepath):  # remove filename
        nodepath = g.os_path_dirname(nodepath)
    if g.os_path_isdir(nodepath):  # append if it's a directory
        path = nodepath

subprocess.Popen(['screen', '-X', 'stuff', 
  'cd '+path+'\n']).communicate()

to make the shell window I'm using change to the local directory of the
current Leo node.  If you're running screen, but anyone using a unix
shell should be ;-)

Heh, just made another version changing just the last line to

subprocess.Popen(['xdg-open', path]).communicate()

And that does open the current directory for the current node in the
system file manager (don't know what the windows equivalent of xdg-open
is, it just means "do something sensible with the URI").

So that might cover the @path case, doesn't flow all the way down to a
@url in body text, although maybe it could check if the cursors in an
url and act on that if it was.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to