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

Re: Mac OSX Issues

Expand Messages
  • Benji Fisher
    ... Thanks for trying this. Since it did not work the last time I tried (something like) this, I was reluctant to spend the time trying again. Now that I
    Message 1 of 12 , Mar 20 4:35 PM
    • 0 Attachment
      Erik Westra wrote:
      > Hi guys,
      >
      >> Rain Dog wrote:
      >>
      >>> The file Vim.app/Contents/PkgInfo, which is generated by the
      >>> makefile, contains the
      >>> type and creator codes (currently "APPL????", should be "APPLVIM!").
      >>> It's necessary,
      >>> but probably not sufficient, to change this file to get the behavior
      >>> you want.
      >>> Other things you might try are creating a Finder copy of the modified
      >>> Vim.app/
      >>> and then restarting the Finder or logging out and back in again.
      >>
      >>
      >> Benji, have you tried this? It worked for me, though I can't be
      >> certain that I haven't
      >> made other changes that addressed the problem.
      >
      >
      > I had a play with this last night. It seems that this provides a good
      > start to solving the problem, but as you say by itself it isn't
      > sufficient. I poked around a bit more, and found that the "info.plist"
      > file also contains an entry that needs to be changed. Here's a quick
      > HOWTO (aimed at non-developers) detailing the steps needed to fix the
      > creator code on a particular copy of Vim:

      Thanks for trying this. Since it did not work the last time I tried
      (something like) this, I was reluctant to spend the time trying again. Now that
      I have a report that it works, it is a different story.

      > -------------------------------------------------------------------------------
      >
      >
      > 1. Open the "Vim" application's package by control-clicking on the app
      > and choosing "Show Package Contents" from the pop-up menu. Inside the
      > "Contents" folder are two files that need to be edited: "Info.plist" and
      > "PkgInfo".
      >
      > 2. Control-click on PkgInfo and choose "Open with...Other". Then select
      > your favour text editor (another copy of Vim will do) and change the
      > file's contents from "APPL????" to "APPLVIM!". Save the changes, and
      > close the file.

      How about starting Vim and

      :e $VIM/Vim.app/Contents/Info.plist

      (with generous use of command-line completion, now that you have :set nocp)? I
      would be surprised if using Vim.app to modify its own property list and package
      info will create a problem, provided that you then make a copy with the Finder.

      > 3. Control-click on Info.plist, and again choose "Open with...Other" to
      > edit it in a text editor. On about line 14 of the file, you'll see an
      > entry which looks like this:
      >
      > <key>CFBundleSignature</key>
      > <string>????</string>
      >
      > Again, change the "????" to "VIM!", save the file, and close the folders
      > you opened.
      >
      > 4. Finally, try making a copy of the Vim application and log out and log
      > back in again to force OSX to recognise Vim's new creator code.
      >
      > -------------------------------------------------------------------------------
      >
      >
      > With this done, Vim behaves as it should -- files created by Vim open in
      > Vim when you double-click on them, and you can make *all* text files
      > open in Vim by selecting any ".txt" file, getting info on the file and
      > selecting Vim as the default application to use for that file. Then, by
      > clicking on "Change All...", all text files from that time on will be
      > opened using Vim. Hurray!
      >
      > Note: I did *not* need to use the "set backupcopy=yes" command suggested
      > in the FAQ to make this work -- as soon as the file's creator code has
      > been set correctly, it appears that "set backupcopy=yes" is no longer
      > necessary...

      What happens if you use Vim.app to edit a file that already has the
      creator code from some other program? Not only what happens, but what do you
      want/expect to happen? (I do not use any old-style Mac programs, so this is
      pretty much terra incognita for me.)

      >> Try changing line 175 of Make_osx.mak from '@echo -n "APPL????" > $@' to
      >> '@echo -n "APPLVIM!" > $@' (preserving the leading tab character), and
      >> then rebuild
      >> Vim. To test the change (and, again, you might need to create a
      >> Finder copy of Vim
      >> or log out and back in), use the /Developer/Tools/SetFile command to
      >> set the type
      >> and creator codes of a text file (SetFile -c 'VIM!' -t 'TEXT'
      >> myfile.txt).
      >> You should then be able to double-click myfile.txt to open it in Vim.
      >> This should also address the OzTeX issue.
      >
      >
      > Yup, it'd be great to get this working on Vim right out of the box. I
      > don't have the developer tools installed on my OSX machine (yet), so I
      > can't test anything, but it seems that the makefile includes commands to
      > explicitly build the Info.plist command, so it should be easy to change
      > the "????" to "VIM!" there too. That'd make my instructions above
      > obsolete...any chance you could try this at some time, Benji?

      Maybe tomorrow. I have one question. Andrew Trevorrow (of OzTeX fame)
      suggested using something other than VIM! for the Carbon version, to avoid
      conflicts with the other (Classic) version of vim. Is he right? I am inclined
      to stick with VIM! unless someone talks me out of it.

      --Benji Fisher
    • Rain Dog
      ... Indeed, my copy of Make_osx.mak creates an Info.plist with the CFBundleSignature set to VIM! . I must have made that change some time ago. Thanks for
      Message 2 of 12 , Mar 20 8:48 PM
      • 0 Attachment
        Erik Westra wrote:
        > I don't have the developer tools installed on my OSX machine (yet), so
        > I can't test anything, but it seems that the makefile includes
        > commands to explicitly build the Info.plist command, so it should be
        > easy to change the "????" to "VIM!" there too.

        Indeed, my copy of Make_osx.mak creates an Info.plist with the
        CFBundleSignature
        set to 'VIM!'. I must have made that change some time ago. Thanks for
        the correction!

        Benji Fisher wrote:
        > Andrew Trevorrow (of OzTeX fame) suggested using something other than
        > VIM! for the Carbon version, to avoid conflicts with the other
        > (Classic) version of vim. Is he right? I am inclined to stick with
        > VIM! unless someone talks me out of it.

        My advice would be to use 'VIM!' for the Carbon version, so that
        existing files open
        with that version. If you have reason to keep the Classic version
        around, change
        its creator code instead.

        Peter
      • Erik Westra
        Hi Benji, ... Great! ... That works fine, too. Thanks -- I hadn t thought of doing that. ... Okay, I did some playing around, and here s what happens. If you
        Message 3 of 12 , Mar 21 2:20 AM
        • 0 Attachment
          Hi Benji,

          > Thanks for trying this. Since it did not work the last time I tried
          > (something like) this, I was reluctant to spend the time trying
          > again. Now that I have a report that it works, it is a different story.

          Great!

          >>2. Control-click on PkgInfo and choose "Open with...Other". Then select
          >>your favour text editor (another copy of Vim will do) and change the
          >>file's contents from "APPL????" to "APPLVIM!". Save the changes, and
          >>close the file.
          >
          > How about starting Vim and
          >
          >:e $VIM/Vim.app/Contents/Info.plist
          >
          >(with generous use of command-line completion, now that you have :set
          >nocp)? I would be surprised if using Vim.app to modify its own property
          >list and package info will create a problem, provided that you then make a
          >copy with the Finder.

          That works fine, too. Thanks -- I hadn't thought of doing that.

          >>Note: I did *not* need to use the "set backupcopy=yes" command suggested
          >>in the FAQ to make this work -- as soon as the file's creator code has
          >>been set correctly, it appears that "set backupcopy=yes" is no longer
          >>necessary...
          >
          > What happens if you use Vim.app to edit a file that already has the
          > creator code from some other program? Not only what happens, but what do
          > you want/expect to happen? (I do not use any old-style Mac programs, so
          > this is pretty much terra incognita for me.)

          Okay, I did some playing around, and here's what happens. If you set
          'backupcopy=yes' and then edit a file created by some other application,
          that other application stays as the creator for that file, even though it
          was edited and saved within Vim. If 'backupcopy' is not set beforehand (or
          set to 'no'), editing a file created by another app and saving it causes
          Vim to become the file's creator, so that double-clicking on the document
          will open Vim instead of the other app.

          Personally, I prefer the second option -- it makes it easier to switch an
          existing file to open again in Vim. If you wanted to be absolutely
          "correct" as far as the Mac's user interface standards go, then I guess
          you'd have to modify your gvimrc file so that the "Save..." menu command
          behaves as if 'backupcopy' was set to 'yes', but the "Save As..." command
          behaves as if 'backupcopy' was set to 'no'. That way, simply saving a
          document (with "Save") wouldn't affect the file's creator (because you're
          saving the file in place), but choosing "Save As..." would set Vim as the
          document's creator (because you're creating a new file, and Vim is the app
          creating that file). Even if you "Save As..." and overwrite the old file,
          the creator should still be set.

          As I say, that's how an "absolutely correct" app would behave, but it's
          probably more work than it would be worth. I personally almost never use
          the standard "Open", "Save" or "Save As" commands from the menu, and even
          if I did I wouldn't be too fussed if the file's creator was changed to
          Vim. Now that the creator code is correct, I really don't see much value
          in having 'backupcopy' set at all...

          >>Yup, it'd be great to get this working on Vim right out of the box. I
          >>don't have the developer tools installed on my OSX machine (yet), so I
          >>can't test anything, but it seems that the makefile includes commands to
          >>explicitly build the Info.plist command, so it should be easy to change
          >>the "????" to "VIM!" there too. That'd make my instructions above
          >>obsolete...any chance you could try this at some time, Benji?
          >
          > Maybe tomorrow. I have one question. Andrew Trevorrow (of OzTeX
          > fame) suggested using something other than VIM! for the Carbon version,
          > to avoid conflicts with the other (Classic) version of vim. Is he
          > right? I am inclined to stick with VIM! unless someone talks me out of it.

          I'd also vote to keep the creator as "VIM!". There really isn't a problem
          with having more than one version of an app (with the same creator code) on
          the same hard disk. Apple's developer docs (at:
          http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/Finder/chapter_10_section_13.html)
          give the details of how the Finder selects which application to use to open
          a particular file. The rules are quite complicated, but the following is
          the relevant bit for us:

          <<<...The Finder gives preference to native applications over Classic
          applications. It also gives preference to later versions of an application
          and to applications with a later modification date...if there is an
          application with the same creator type already running, select that
          application instead.>>>

          In other words, Mac OSX should happily handle both classic and OSX versions
          of Vim co-existing, both with the same creator code. I actually think it's
          important that we keep the creator code set to "VIM!", so that files
          created with Vim stay associated with Vim even if they're shifted from one
          machine to the other.

          Anyway, just my $0.02 worth...

          Cheers,

          - Erik.
        • Benji Fisher
          ... I do not think I will change the defaults, but maybe I can update the FAQ, now that I understand it a bit better. ... I would not be that hard ... ...
          Message 4 of 12 , Mar 21 8:32 AM
          • 0 Attachment
            Erik Westra wrote:
            > Hi Benji,
            >
            >> What happens if you use Vim.app to edit a file that already has
            >> the creator code from some other program? Not only what happens, but
            >> what do you want/expect to happen? (I do not use any old-style Mac
            >> programs, so this is pretty much terra incognita for me.)
            >
            >
            > Okay, I did some playing around, and here's what happens. If you set
            > 'backupcopy=yes' and then edit a file created by some other application,
            > that other application stays as the creator for that file, even though
            > it was edited and saved within Vim. If 'backupcopy' is not set
            > beforehand (or set to 'no'), editing a file created by another app and
            > saving it causes Vim to become the file's creator, so that
            > double-clicking on the document will open Vim instead of the other app.

            I do not think I will change the defaults, but maybe I can update the FAQ,
            now that I understand it a bit better.

            > Personally, I prefer the second option -- it makes it easier to switch
            > an existing file to open again in Vim. If you wanted to be absolutely
            > "correct" as far as the Mac's user interface standards go, then I guess
            > you'd have to modify your gvimrc file so that the "Save..." menu command
            > behaves as if 'backupcopy' was set to 'yes', but the "Save As..."
            > command behaves as if 'backupcopy' was set to 'no'. That way, simply
            > saving a document (with "Save") wouldn't affect the file's creator
            > (because you're saving the file in place), but choosing "Save As..."
            > would set Vim as the document's creator (because you're creating a new
            > file, and Vim is the app creating that file). Even if you "Save As..."
            > and overwrite the old file, the creator should still be set.
            >
            > As I say, that's how an "absolutely correct" app would behave, but it's
            > probably more work than it would be worth. I personally almost never
            > use the standard "Open", "Save" or "Save As" commands from the menu, and
            > even if I did I wouldn't be too fussed if the file's creator was changed
            > to Vim. Now that the creator code is correct, I really don't see much
            > value in having 'backupcopy' set at all...

            I would not be that hard ...

            >>> Yup, it'd be great to get this working on Vim right out of the box.
            >>> I don't have the developer tools installed on my OSX machine (yet),
            >>> so I can't test anything, but it seems that the makefile includes
            >>> commands to explicitly build the Info.plist command, so it should be
            >>> easy to change the "????" to "VIM!" there too. That'd make my
            >>> instructions above obsolete...any chance you could try this at some
            >>> time, Benji?
            >>
            >> Maybe tomorrow. I have one question. Andrew Trevorrow (of OzTeX
            >> fame) suggested using something other than VIM! for the Carbon
            >> version, to avoid conflicts with the other (Classic) version of vim.
            >> Is he right? I am inclined to stick with VIM! unless someone talks me
            >> out of it.
            >
            > I'd also vote to keep the creator as "VIM!". There really isn't a
            > problem with having more than one version of an app (with the same
            > creator code) on the same hard disk. Apple's developer docs (at:
            > http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/Finder/chapter_10_section_13.html)
            > give the details of how the Finder selects which application to use to
            > open a particular file. The rules are quite complicated, but the
            > following is the relevant bit for us:
            >
            > <<<...The Finder gives preference to native applications over Classic
            > applications. It also gives preference to later versions of an
            > application and to applications with a later modification date...if
            > there is an application with the same creator type already running,
            > select that application instead.>>>
            >
            > In other words, Mac OSX should happily handle both classic and OSX
            > versions of Vim co-existing, both with the same creator code. I
            > actually think it's important that we keep the creator code set to
            > "VIM!", so that files created with Vim stay associated with Vim even if
            > they're shifted from one machine to the other.

            Unfortunately, it does not work for me.

            1. If I change the creator code to VIM!, either by editing Info.plist and
            PkgInfo or by recompiling (and letting the Makefile fo it for me), then nothing
            I can do (re-launch Finder, log out, reboot) will convince my Mac that VIM!
            means this version of Vim. If I use

            % /Developer/Tools/SetFile -c 'VIM!' ~/temp/temp.txt

            (as suggested by Peter), then the OS starts up the Classic environment to run my
            old version of Vim. Does anyone else have a copy of Vim on his OS 9 partition?

            2. If I change the creator code to something new, like 'VimX', and use SetFile
            to give temp.txt the same creator code, then Vim starts up as expected. But
            files I create with Vim do not get a creator code, no matter what I try.

            Even if it is not working for me, I am glad that it is starting to work
            for others. If we (some of us) are getting documents associated with Vim, we
            should use Douglas Stebila's icons from http://theorem.ca/~dstebila/code/vim/ .
            I assume I should include the .icns file (or files) in
            Vim.app/Contents/Resources and modify Info.plist accordingly. Do we want to use
            both of the document icons? If so, how do we fix Info.plist to use doc.icns or
            doc-text.icns as appropriate. If not, which of the two icons should I use?

            --Benji Fisher
          Your message has been successfully submitted and would be delivered to recipients shortly.