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

Re: List all files in a directory tree to the buffer

Expand Messages
  • Tony Mechelynck
    ... or rather if !has( unix ) let $PATH .= ;C: cygwin bin endif If you run a Cygwin version of Vim it should already find /bin in the $PATH (it wouldn t
    Message 1 of 17 , Sep 1, 2008
    • 0 Attachment
      On 01/09/08 23:43, Gary Johnson wrote:
      > On 2008-09-01, Anton Sharonov<anton.sharonov@...> wrote:
      >> And to use cygwin "ls" if cygwing is installed in c:\cygwin\bin you
      >> can go to MyComputer / Properties / Advanced / Env. vars, select PATH
      >> and add at the tail ";c:\cygwin\bin" without the quoutation marks,
      >> than press "set", "ok". Note that you need to restart your gvim
      >> (changes in environment variables are only visible for new
      >> processese).
      >
      > If you're only invoking cygwin commands from a Cygwin shell or from
      > Windows vim (and not from a DOS prompt), an alternative to modifying
      > PATH at that point would be to modify it in your _vimrc:
      >
      > let $PATH.=";C:\\cygwin\\bin"

      or rather

      if !has('unix')
      let $PATH .= ';C:\cygwin\bin'
      endif

      If you run a Cygwin version of Vim it should already find /bin in the
      $PATH (it wouldn't understand C:\cygwin\bin). Single quotes avoid the
      need to escape backslashes;

      >
      > Regards,
      > Gary


      Best regards,
      Tony.
      --
      George Washington was first in war, first in peace -- and the first to
      have his birthday juggled to make a long weekend.
      -- Ashley Cooper

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Anton Sharonov
      ... Just minor improvement suggestion: You can of course test has( unix ) to detect cygwin vim, if you don t need to distinguish between unix and cygwin. But
      Message 2 of 17 , Sep 2, 2008
      • 0 Attachment
        > or rather

        > if !has('unix')
        > let $PATH .= ';C:\cygwin\bin'
        > endif

        > If you run a Cygwin version of Vim it should already find /bin in the
        > $PATH (it wouldn't understand C:\cygwin\bin). Single quotes avoid the
        > need to escape backslashes;

        Just minor improvement suggestion:
        You can of course test has('unix') to detect cygwin vim, if you don't
        need to distinguish between unix and cygwin. But
        better approach IMHO is:

        if ! has ("win32unix") " it is cygwin env.
        ...
        endif

        (Can be useful if one
        have some stuff, which must be defined only for cygwin environment but
        not for "real" UNIXes)

        --
        Mit freundlichen Grüßen
        Anton Sharonov
        mailto:anton.sharonov@...


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tony Mechelynck
        ... If you use double-boot, with Windows (g)vim and Cygwin vim on the W32 system, plus, let s say, GTK2 gvim on the Linux system, you should still use
        Message 3 of 17 , Sep 2, 2008
        • 0 Attachment
          On 02/09/08 09:34, Anton Sharonov wrote:
          >> or rather
          >
          >> if !has('unix')
          >> let $PATH .= ';C:\cygwin\bin'
          >> endif
          >
          >> If you run a Cygwin version of Vim it should already find /bin in the
          >> $PATH (it wouldn't understand C:\cygwin\bin). Single quotes avoid the
          >> need to escape backslashes;
          >
          > Just minor improvement suggestion:
          > You can of course test has('unix') to detect cygwin vim, if you don't
          > need to distinguish between unix and cygwin. But
          > better approach IMHO is:
          >
          > if ! has ("win32unix") " it is cygwin env.
          > ...
          > endif
          >
          > (Can be useful if one
          > have some stuff, which must be defined only for cygwin environment but
          > not for "real" UNIXes)
          >

          If you use double-boot, with Windows (g)vim and Cygwin vim on the W32
          system, plus, let's say, GTK2 gvim on the Linux system, you should still
          use has('unix') in this case because you don't want to add Windows paths
          when using _either_ Cygwin Vim or Linux Vim.

          In my experience, has('win32unix') is only very rarely needed (I'm not
          saying 'never'), because Cygwin Vim (when called from Cygwin bash)
          behaves almost identically to other Unix-like versions of Vim.


          Best regards,
          Tony.
          --
          Time flies like an arrow
          Fruit flies like a banana

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Benjamin Fritz
          ... You have many suggestions already, but just to add one more: From outside of Vim, in a command shell, do: (Windows) dir /S | gvim - (*nix) ls -R | vim -
          Message 4 of 17 , Sep 2, 2008
          • 0 Attachment
            On Mon, Sep 1, 2008 at 11:57 AM, bgold12 <bgold12@...> wrote:
            >
            > Is there a way to list all files in a directory tree to the current
            > vim buffer, similar to what the system command "ls -R >> tempfile"
            > would do in the command line?
            >

            You have many suggestions already, but just to add one more:

            From outside of Vim, in a command shell, do:

            (Windows)
            dir /S | gvim -

            (*nix)
            ls -R | vim -

            See :help ---

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • bgold12
            Thanks, all of these methods work well, but I would still prefer if I could just have gvim automatically run a batch file for every shell it creates from the
            Message 5 of 17 , Sep 3, 2008
            • 0 Attachment
              Thanks, all of these methods work well, but I would still prefer if I
              could just have gvim automatically run a batch file for every shell it
              creates from the :! command; that way, I would be able to set up the
              same environment each time I use the :! command as I have when I open
              command prompt separately. That way I would only have to set the path
              I want in my main batch file, and it would work for the command line
              on its own as well as in the gvim shell.

              bgold12
              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Tony Mechelynck
              ... You can set ant environment variables within Vim, let s say ... ²&é (§è!çà)-µ n . azertyuiop^$ n . qsdfghjklmù n . wxcvbn,;:= n .
              Message 6 of 17 , Sep 3, 2008
              • 0 Attachment
                On 03/09/08 17:29, bgold12 wrote:
                > Thanks, all of these methods work well, but I would still prefer if I
                > could just have gvim automatically run a batch file for every shell it
                > creates from the :! command; that way, I would be able to set up the
                > same environment each time I use the :! command as I have when I open
                > command prompt separately. That way I would only have to set the path
                > I want in my main batch file, and it would work for the command line
                > on its own as well as in the gvim shell.
                >
                > bgold12

                You can set ant environment variables within Vim, let's say

                :let $KEYBOARD =
                \ "²&é\"'(§è!çà)-µ\n" .
                \ "azertyuiop^$\n" .
                \ "qsdfghjklmù\n .
                \ "wxcvbn,;:=\n" .
                \ ""

                then any child process and any of _its_ children will inherit them.

                Note that if you set the $PATH, it is a semicolon-separated list of
                backslash-separated paths on Windows, but a colon-separated list of
                (forward)-slash-separated paths on Unix. If you use a common vimrc on a
                double-boot machine, you'll have to take care of that.

                Or you can set your $PATH and other "fixed" environment variables once
                and for all, either on "My Computer => System => Advanced => Environment
                variables" (or similar) on Windows, or in /etc/profile or .bash.login
                (or similar) on Linux.


                Best regards,
                Tony.
                --
                "Acting is an art which consists of keeping the audience from
                coughing."

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Ben Schmidt
                ... Is there a reason you don t want to set your path in Windows System properties? Particularly as Windows passes its commandlines to applications simply as a
                Message 7 of 17 , Sep 3, 2008
                • 0 Attachment
                  bgold12 wrote:
                  > Thanks, all of these methods work well, but I would still prefer if I
                  > could just have gvim automatically run a batch file for every shell it
                  > creates from the :! command; that way, I would be able to set up the
                  > same environment each time I use the :! command as I have when I open
                  > command prompt separately. That way I would only have to set the path
                  > I want in my main batch file, and it would work for the command line
                  > on its own as well as in the gvim shell.

                  Is there a reason you don't want to set your path in Windows System
                  properties?

                  Particularly as Windows passes its commandlines to applications simply
                  as a string (how remarkably inconvenient), you may also be able to get
                  what you want by messing with the 'shell' and/or 'shellcmdflag' options
                  in Vim. Or there may be some environment variable you can set in Vim to
                  make cmd.exe automatically pre-load a batch file or something. Or a
                  registry entry, I seem to remember you can use to make stuff autoload in
                  a command prompt. Check 'help cmd' in a command prompt and see if the
                  docs reveal anything. A quick google suggest to me that something like

                  :set shell=cmd.exe\ /K\ mybatchfile.bat

                  may work, and also reveals that registry key.

                  Ben.



                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.