Loading ...
Sorry, an error occurred while loading the content.

Re: WANTED: browsedir()

Expand Messages
  • Bram Moolenaar
    ... Didn t see a response on this. I wonder why you need to select a directory in Vim. The low-level function gui_mch_browse() doesn t support it at the
    Message 1 of 5 , Oct 2, 2004
    • 0 Attachment
      Steve Hall wrote:

      > WANTED: browsedir() function that selects and returns a path/directory
      > (rather than the path/filename browse() returns).
      >
      > I'll pay $50 US via mail or PayPal for a patch against the current Vim
      > source that adds the capability to both GTK2 and Windows platforms.
      > (Perhaps just WinNT/2K/XP as I believe browse() already does this on
      > Win95/98/ME--to be verified.) Half payment offered for patch
      > addressing one of the two platforms. If interested, please contact me
      > off list.

      Didn't see a response on this. I wonder why you need to select a
      directory in Vim.

      The low-level function gui_mch_browse() doesn't support it at the
      moment. This means it has to be implemented separately for each
      platform.

      --
      hundred-and-one symptoms of being an internet addict:
      47. You are so familiar with the WWW that you find the search engines useless.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
    • Steve Hall
      ... To select a location for placing files. I wrote a script for non-computer saavy users to process reams of data files and they need to select locations for
      Message 2 of 5 , Oct 2, 2004
      • 0 Attachment
        On Sat, 2004-10-02 at 15:04, Bram Moolenaar wrote:
        > Steve Hall wrote:
        > >
        > > WANTED: browsedir() function that selects and returns a
        > > path/directory (rather than the path/filename browse() returns).
        > >
        > > I'll pay $50 US via mail or PayPal for a patch against the current
        > > Vim source that adds the capability to both GTK2 and Windows
        > > platforms. (Perhaps just WinNT/2K/XP as I believe browse() already
        > > does this on Win95/98/ME--to be verified.) Half payment offered
        > > for patch addressing one of the two platforms. If interested,
        > > please contact me off list.
        >
        > Didn't see a response on this. I wonder why you need to select a
        > directory in Vim.

        To select a location for placing files. I wrote a script for
        non-computer saavy users to process reams of data files and they need
        to select locations for dumping files, not selecting one.

        > The low-level function gui_mch_browse() doesn't support it at the
        > moment. This means it has to be implemented separately for each
        > platform.

        I read through that code and started to jump into writing a patch.
        Even found the correct Windows call, but I know only a rudimentary bit
        of C, nothing of GTK/2 and figured someone else could do it better and
        faster.

        I'm sure if I could find another "0" to tack onto my offer it would be
        more attractive, but alas, I can not. :(


        --
        Steve Hall [ digitect mindspring com ]
      • Moshe Kaminsky
        ... Are you willing to use the embedded perl interpreter? If so, the following will do it for gtk2: function! BrowseDir() perl
        Message 3 of 5 , Oct 2, 2004
        • 0 Attachment
          * Steve Hall <digitect@...> [03/10/04 06:18]:
          > On Sat, 2004-10-02 at 15:04, Bram Moolenaar wrote:
          > > Steve Hall wrote:
          > > >
          > > > WANTED: browsedir() function that selects and returns a
          > > > path/directory (rather than the path/filename browse() returns).
          > > >
          > > > I'll pay $50 US via mail or PayPal for a patch against the current
          > > > Vim source that adds the capability to both GTK2 and Windows
          > > > platforms. (Perhaps just WinNT/2K/XP as I believe browse() already
          > > > does this on Win95/98/ME--to be verified.) Half payment offered
          > > > for patch addressing one of the two platforms. If interested,
          > > > please contact me off list.
          > >
          > > Didn't see a response on this. I wonder why you need to select a
          > > directory in Vim.
          >
          > To select a location for placing files. I wrote a script for
          > non-computer saavy users to process reams of data files and they need
          > to select locations for dumping files, not selecting one.

          Are you willing to use the embedded perl interpreter? If so, the
          following will do it for gtk2:

          function! BrowseDir()
          perl <<EOF
          use Gtk2;
          my $choose = new Gtk2::FileChooserDialog
          'Choose a directory',
          undef,
          GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
          'gtk-ok' => 'close', 'gtk-cancel' => 'cancel';
          my $id = $choose->run;
          my $dir = $id eq 'close' ? $choose->get_filename() : '';
          VIM::DoCommand("let dir = '$dir'");
          $choose->destroy;
          EOF
          return dir
          endfunction

          You will need the Gtk2 perl module from CPAN. Still needs some
          polishing, of course.

          HTH
          Moshe
        • Mikolaj Machowski
          ... For Linux you can use (at least temporarily - script, not patch way) kdialog : kdialog --style --getexistingdirectory [startDir] m. --
          Message 4 of 5 , Oct 3, 2004
          • 0 Attachment
            Dnia niedziela, 3 października 2004 03:04, Steve Hall napisał:
            > On Sat, 2004-10-02 at 15:04, Bram Moolenaar wrote:
            > > Steve Hall wrote:
            > > > WANTED: browsedir() function that selects and returns a
            > > > path/directory (rather than the path/filename browse() returns).
            > > >
            > > > I'll pay $50 US via mail or PayPal for a patch against the current
            > > > Vim source that adds the capability to both GTK2 and Windows
            > > > platforms. (Perhaps just WinNT/2K/XP as I believe browse() already
            > > > does this on Win95/98/ME--to be verified.) Half payment offered
            > > > for patch addressing one of the two platforms. If interested,
            > > > please contact me off list.
            > >
            > > Didn't see a response on this. I wonder why you need to select a
            > > directory in Vim.
            >
            > To select a location for placing files. I wrote a script for
            > non-computer saavy users to process reams of data files and they need
            > to select locations for dumping files, not selecting one.
            >
            > > The low-level function gui_mch_browse() doesn't support it at the
            > > moment. This means it has to be implemented separately for each
            > > platform.
            >
            > I read through that code and started to jump into writing a patch.
            > Even found the correct Windows call, but I know only a rudimentary bit
            > of C, nothing of GTK/2 and figured someone else could do it better and
            > faster.

            For Linux you can use (at least temporarily - script, not patch way)
            kdialog :

            kdialog --style <something gtkish> --getexistingdirectory [startDir]

            m.

            --
            LaTeX + Vim = http://vim-latex.sourceforge.net/
            Vim-list(s) Users Map: (last change 17 Sep)
            http://skawina.eu.org/mikolaj/vimlist
            CLEWN - http://clewn.sf.net
          Your message has been successfully submitted and would be delivered to recipients shortly.