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

Re: MacVim working directory problem

Expand Messages
  • David
    Bjorn, Thanks for making this wonderful product. It s better than any other IDE I have used in the past. I don t think I understand the full scope of this
    Message 1 of 22 , Oct 3, 2010
    • 0 Attachment
      Bjorn,

      Thanks for making this wonderful product. It's better than any other
      IDE I have used in the past.

      I don't think I understand the full scope of this problem. I just know
      the symptoms. I was wondering if this behavior could be turned into a
      variable of some kind? Then we could allow different types of behavior
      in terms of when to set the pwd.

      Thanks.

      David

      On Oct 2, 1:01 pm, björn <bjorn.winck...@...> wrote:
      > On 2 October 2010 03:26, Alec Thomas <a...@...> wrote:
      >
      >
      >
      >
      >
      > > On Sep 3, 5:12 am, David Salgado <da...@...> wrote:
      >
      > >> I think I'll leave things as they are; if more people complain about
      > >> it I'll start thinking about a better solution.  (It's only a guess,
      > >> but I think most people do want the pwd to be set to the first file
      > >> they open.)
      >
      > > Hi Björn,
      >
      > > There's a long discussion about this issue on this PeepOpen bug
      > > tracker issue:http://github.com/topfunky/PeepOpen-Issues/issues#issue/62
      >
      > > PeepOpen is an external application launched from vim. It offers up a
      > > nice efficient file dialog. Once a file is selected PeepOpen tells
      > > MacVim to open the file, which is where it hits this issue.
      >
      > > For reference, here's how I typically use MacVim in order of
      > > frequency:
      >
      > > 1. Open it from the dock, then ":cd <project-root>", then use PeepOpen
      > > to open various files under the project root.
      > > 2. Cd into the project directory from the command line then run mvim
      > > (though since this change I now run "mvim .").
      > > 3. Open MacVim by clicking or right-clicking on files (typically
      > > source I've downloaded to check out) in Finder.
      >
      > > Here are some suggestions that might help (any of which would solve
      > > this issue for PeepOpen users specifically):
      >
      > > 1. Disable the feature as soon as any command is typed into MacVim at
      > > all.
      > > 2. Disable the feature if the user launches MacVim via mvim.
      > > 3. Add a MacVim-specific option to disable the feature.
      >
      > I see that something has to change...but I'm still not sure how.  The
      > current behavior is confusing to say the least -- when I change it I
      > want it to be completely obvious what is going on.  I'd rather avoid
      > introducing another option for this.
      >
      > Under what circumstances _should_ the pwd be set?
      >
      > Well, if new files open in a new window then I guess it should always
      > be set when opening a file (?), so the question only really applies to
      > when you've set MacVim to open files in the "current" window.  Maybe
      > with this option set the pwd should never be touched?  At least this
      > is consistent (I think your suggestions 1 & 2 may lead to some
      > confusion however).
      >
      > Does anybody have comments on this (please make yourselves heard)?
      >
      > Let me rephrase this slightly:  is there anybody out there who has got
      > MacVim set to open files in the "current" window and who wants the pwd
      > to be set when they open a new file?  (If so, when?)
      >
      > > PS. Thanks for your work on MacVim, it is fantastic :)
      >
      > I'm glad you like it!
      >
      > Björn

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • björn
      ... I agree. This is the most intuitive behavior. I ve pushed a patch already:
      Message 2 of 22 , Oct 3, 2010
      • 0 Attachment
        On 3 October 2010 17:04, David Salgado <david@...> wrote:
        >> Does anybody have comments on this (please make yourselves heard)?
        >
        > My preference would be to never mess with the pwd if the window is already open.
        >
        > If opening the file opens a new window, then I think it makes sense to
        > set the pwd to the directory containing the file.

        I agree. This is the most intuitive behavior. I've pushed a patch already:

        http://github.com/b4winckler/macvim/commit/c96d4dcc8e5b65bf989efa7e1b86f262974f935c

        Björn

        --
        You received this message from the "vim_mac" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Kyle Lippincott
        ... I imagine those people are already the type of people who change directories on BufEnter (I know at least one). My $.04 (stupid currency devaluing):
        Message 3 of 22 , Oct 3, 2010
        • 0 Attachment
          On Sat, Oct 2, 2010 at 10:01 AM, björn <bjorn.winckler@...> wrote:
          On 2 October 2010 03:26, Alec Thomas <alec@...> wrote:
          > On Sep 3, 5:12 am, David Salgado <da...@...> wrote:
          >>
          >> I think I'll leave things as they are; if more people complain about
          >> it I'll start thinking about a better solution.  (It's only a guess,
          >> but I think most people do want the pwd to be set to the first file
          >> they open.)
          >
          > Hi Björn,
          >
          > There's a long discussion about this issue on this PeepOpen bug
          > tracker issue: http://github.com/topfunky/PeepOpen-Issues/issues#issue/62
          >
          > PeepOpen is an external application launched from vim. It offers up a
          > nice efficient file dialog. Once a file is selected PeepOpen tells
          > MacVim to open the file, which is where it hits this issue.
          >
          > For reference, here's how I typically use MacVim in order of
          > frequency:
          >
          > 1. Open it from the dock, then ":cd <project-root>", then use PeepOpen
          > to open various files under the project root.
          > 2. Cd into the project directory from the command line then run mvim
          > (though since this change I now run "mvim .").
          > 3. Open MacVim by clicking or right-clicking on files (typically
          > source I've downloaded to check out) in Finder.
          >
          > Here are some suggestions that might help (any of which would solve
          > this issue for PeepOpen users specifically):
          >
          > 1. Disable the feature as soon as any command is typed into MacVim at
          > all.
          > 2. Disable the feature if the user launches MacVim via mvim.
          > 3. Add a MacVim-specific option to disable the feature.

          I see that something has to change...but I'm still not sure how.  The
          current behavior is confusing to say the least -- when I change it I
          want it to be completely obvious what is going on.  I'd rather avoid
          introducing another option for this.

          Under what circumstances _should_ the pwd be set?

          Well, if new files open in a new window then I guess it should always
          be set when opening a file (?), so the question only really applies to
          when you've set MacVim to open files in the "current" window.  Maybe
          with this option set the pwd should never be touched?  At least this
          is consistent (I think your suggestions 1 & 2 may lead to some
          confusion however).

          Does anybody have comments on this (please make yourselves heard)?

          Let me rephrase this slightly:  is there anybody out there who has got
          MacVim set to open files in the "current" window and who wants the pwd
          to be set when they open a new file?  (If so, when?)

          I imagine those people are already the type of people who change directories on BufEnter (I know at least one).

          My $.04 (stupid currency devaluing): Personally I never switch directories, but that's because I almost always run vim from the command line if I'm in a situation where I'd want to (specifically: I do lots of coding on linux.  I use the command line version of vim a lot.  In MacVim, I rarely care what directory I'm in since it's rare that I have a tree of files that I need to navigate.. if the file has siblings, I'll just automatically use %:h/ to get to them).

          I think the proposed solution is probably the best one.  It doesn't bother users like me (who don't care what pwd is), and it shouldn't bother the BufEnter directory changers, since BufEnter should still fire (after you've modified the pwd), and you're probably setting it to what they want anyway.
           

          > PS. Thanks for your work on MacVim, it is fantastic :)

          I'm glad you like it!


          Björn

          --
          You received this message from the "vim_mac" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          --
          You received this message from the "vim_mac" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Brian McKee
          ... Hmmm? I didn t follow that part of your comment... -- Hey, it s your computer.... isn t it? -- You received this message from the vim_mac maillist. Do
          Message 4 of 22 , Oct 4, 2010
          • 0 Attachment
            On Sun, Oct 3, 2010 at 8:38 PM, Kyle Lippincott <spectral@...> wrote:
            if the file has siblings, I'll just automatically use %:h/ to get to them

            Hmmm?  I didn't follow that part of your comment...

            --
            Hey, it's your computer.... isn't it?

            --
            You received this message from the "vim_mac" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • björn
            ... I d like to try and avoid introducing more options. What different types of behavior do you want? Currently (after the latest patch) it goes like this
            Message 5 of 22 , Oct 4, 2010
            • 0 Attachment
              On 3 October 2010 16:17, David <ddavis1@...> wrote:
              >
              > I don't think I understand the full scope of this problem. I just know
              > the symptoms. I was wondering if this behavior could be turned into a
              > variable of some kind? Then we could allow different types of behavior
              > in terms of when to set the pwd.

              I'd like to try and avoid introducing more options. What different
              types of behavior do you want?

              Currently (after the latest patch) it goes like this when you open one
              or more files (not using the "mvim" script):

              1. If this causes a new window to appear on screen then the working
              directory is set to the first file that is being opened (they are
              sorted alphabetically because Finder does not "remember" the order in
              which you select them).

              2. Otherwise (i.e. you have gone into the prefs and set MacVim to open
              new files in the "current" window, or you're dragging to a window) the
              current directory is not touched.

              The old behavior was broken because the pwd would change even if you
              had manually gone in and changed it (e.g. via a ":cd .." command).

              If you open files using the "mvim" script the working directory is the
              same as Terminal's working directory.

              If you open a new empty window (e.g. via Cmd+N, or when starting
              MacVim) the working directory will be set to your home directory.


              Björn

              --
              You received this message from the "vim_mac" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Kyle Lippincott
              Ah, sorry. Normally when coding (the only time I care about the current directory of vim), I ll be working with a tree of files, something like:
              Message 6 of 22 , Oct 4, 2010
              • 0 Attachment
                Ah, sorry.  Normally when coding (the only time I care about the current directory of vim), I'll be working with a tree of files, something like:

                library1/src/foo.cpp
                library1/src/foo.h
                library2/client/rpc_interface.py

                I want to be able to type:
                :e library1/src/foo.cpp     or
                :e library2/client/rpc_interface.py

                However, if I'm already in foo.cpp, I automatically type:
                :e %:h/foo.h 

                So by siblings I meant "files in the same directory as the file I'm currently editing".  I actually do this for subdirectories as well (say there's a 'library1/src/testing' directory, then it's %:h/testing/blah.cpp).  To explain what this is doing, I believe the help topic in vim for the description of these is 'filename-modifiers', and % is the filename of the current buffer.

                On Mon, Oct 4, 2010 at 5:50 AM, Brian McKee <brian.mckee@...> wrote:


                On Sun, Oct 3, 2010 at 8:38 PM, Kyle Lippincott <spectral@...> wrote:
                if the file has siblings, I'll just automatically use %:h/ to get to them

                Hmmm?  I didn't follow that part of your comment...

                --
                Hey, it's your computer.... isn't it?

                --
                You received this message from the "vim_mac" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php

                --
                You received this message from the "vim_mac" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Brian McKee
                ... Thank you. That s something I wasn t familiar with. Brian -- You received this message from the vim_mac maillist. Do not top-post! Type your reply below
                Message 7 of 22 , Oct 5, 2010
                • 0 Attachment
                  On Mon, Oct 4, 2010 at 4:01 PM, Kyle Lippincott <spectral@...> wrote:

                  :e %:h/foo.h 
                   
                   To explain what this is doing, I believe the help topic in vim for the description of these is 'filename-modifiers', and % is the filename of the current buffer.


                  Thank you.  That's something I wasn't familiar with.

                  Brian

                  --
                  You received this message from the "vim_mac" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                Your message has been successfully submitted and would be delivered to recipients shortly.