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

Re: Mac Questions

Expand Messages
  • Axel Kielhorn
    ... Well, actually they get the environment from the shell that starts Vim. When you start Vim from the bash, it will inherit the environment. When you start
    Message 1 of 9 , Jan 8, 2007
    • 0 Attachment
      Am 08.01.2007 um 13:26 schrieb striker:

      > I believe both versions of Vim get its initial info from ~/.bashrc.

      Well, actually they get the environment from the shell that starts Vim.

      When you start Vim from the bash, it will inherit the environment.
      When you start Vim from the Finder (or the Dock) it will only have a
      minimal environment.

      > Which verion(s) are you using? I have OS X 10.4.8 and the command
      > line version of Vim is 6.3.82.

      This seems to be the Vim provided with Mac OS. It was 6.3 in MacOS 10.3

      > The GUI version is 7.0. Other than some goofy font issues, the GUI
      > version is more useful and has some rather nice features (tabs for
      > one) that aren't available in the earlier command line version.

      You can this version in the command line as well, I have
      alias vim="~/src/Vim/vim70/src/darwin7.9/Vim.app/Contents/MacOS/Vim"
      alias gvim="~/src/Vim/vim70/src/darwin7.9/Vim.app/Contents/MacOS/Vim -g
      &"
      in my .bashrc.

      >> 2. Where does the gui version get its initial environment from? I want
      >> to add some extra stuff to PATH. I know I can do this using $PATH in
      >> the .vimrc, but I would rather do it at some global level.

      I don't know how to extend the environment of the Finder, but maybe you
      can write an automator script to call Vim from a bash.

      Axel

      PS: I cc'ed this to the Mac list as well.
    • Brett Calcott
      This does seem to be the case. No amount of fiddling with .profile .bashrc .bash_profile /etc/bashrc or whatever makes any difference to the environment that
      Message 2 of 9 , Jan 8, 2007
      • 0 Attachment
        This does seem to be the case. No amount of fiddling with .profile
        .bashrc .bash_profile /etc/bashrc or whatever makes any difference to
        the environment that ends up in the GUI version that is started from
        the dock.

        For the moment I just do something like this:
        if has("gui_running")
        let $PATH=$PATH.':/some/more/paths:/and/more/still'
        endif

        Which does the trick for now.

        >
        > PS: I cc'ed this to the Mac list as well.
        >
        >

        Thanks for that. I probably should have started there...

        Thanks for the replies.
        Brett
      • Dave Land
        Hello, ... I don t know if the Mac folks have filled you in, but apps launched from the Finder get their environment from the file ~/.MacOSX/
        Message 3 of 9 , Jan 8, 2007
        • 0 Attachment
          Hello,

          On Jan 8, 2007, at 2:31 PM, Brett Calcott wrote:

          > This does seem to be the case. No amount of fiddling with .profile
          > .bashrc .bash_profile /etc/bashrc or whatever makes any difference to
          > the environment that ends up in the GUI version that is started from
          > the dock.

          I don't know if the Mac folks have filled you in, but apps launched
          from the Finder get their environment from the file ~/.MacOSX/
          environment.plist. Mac OS X "Property List" files are XML, and they
          look like this (this is a bit of my own environment.plist):

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
          www.apple.com/DTDs/PropertyList-1.0.dtd">
          <plist version="1.0">
          <dict>
          <key>myvimhelp</key>
          <string>~/.vim/doc/dml.txt</string>
          </dict>
          </plist>

          Th file contains any number of <key>/<string> pairs, which give the
          name and value of environment variables for Finder-launched apps.

          The values in environment.plist are loaded at login time, so you have
          to log out and back in for new variables to be available.

          Some folks keep all their environment variables in environment.plist
          and parse it from .bashrc (or equivalent for other shells) to load
          those vars into their shell. Happily, Apple provided a utility that
          handles it for you:

          defaults read "${HOME}/.MacOSX/environment"

          Also, with the Apple developer tools comes a program "Property List
          Editor" that makes it very easy to muck about with its contents. Of
          course, this being a vim list, most of you probably would prefer to
          use something like pico or emacs for this purpose :-).

          Dave
        • Dave Land
          ... Actually, making this work in bash (or other shell) requires a little more than just reading the file... Here s the relevant chunk from my .bashrc: # Get
          Message 4 of 9 , Jan 8, 2007
          • 0 Attachment
            On Jan 8, 2007, at 3:03 PM, Dave Land wrote:

            > Happily, Apple provided a utility that handles it for you:
            >
            > defaults read "${HOME}/.MacOSX/environment"

            Actually, making this work in bash (or other shell) requires a little
            more than just reading the file... Here's the relevant chunk from
            my .bashrc:

            # Get environment variables from ~/.MacOSX/environment.plist
            # (This avoids the sin of duplicating data here and in that file)
            if [[ `uname` == 'Darwin' ]] ; then
            defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
            awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
            $OneLine; done;
            fi

            To give credit where it's due, this came from a comment on
            macosxhints.com.

            The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
            same .bashrc across several hosts, including Solaris, Linux, and Mac
            OS X.

            Dave
          • Bram Moolenaar
            ... This issue comes up often enough that it deserves a section in the help. Could you perhaps write some text? If you can send me a patch that would be
            Message 5 of 9 , Jan 9, 2007
            • 0 Attachment
              Dave Land wrote:

              > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
              >
              > > Happily, Apple provided a utility that handles it for you:
              > >
              > > defaults read "${HOME}/.MacOSX/environment"
              >
              > Actually, making this work in bash (or other shell) requires a little
              > more than just reading the file... Here's the relevant chunk from
              > my .bashrc:
              >
              > # Get environment variables from ~/.MacOSX/environment.plist
              > # (This avoids the sin of duplicating data here and in that file)
              > if [[ `uname` == 'Darwin' ]] ; then
              > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
              > awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
              > $OneLine; done;
              > fi
              >
              > To give credit where it's due, this came from a comment on
              > macosxhints.com.
              >
              > The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
              > same .bashrc across several hosts, including Solaris, Linux, and Mac
              > OS X.

              This issue comes up often enough that it deserves a section in the help.
              Could you perhaps write some text? If you can send me a patch that
              would be great.

              --
              hundred-and-one symptoms of being an internet addict:
              4. Your eyeglasses have a web site burned in on them.

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ download, build and distribute -- http://www.A-A-P.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
            • Brian McKee
              ... Hash: SHA1 ... Just a quick note to anyone using that plist option - I once wasted about 20 hours of my time because a bad? corrupt? I never determined
              Message 6 of 9 , Jan 9, 2007
              • 0 Attachment
                -----BEGIN PGP SIGNED MESSAGE-----
                Hash: SHA1

                On 8-Jan-07, at 6:14 PM, Dave Land wrote:

                > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
                >
                >> Happily, Apple provided a utility that handles it for you:
                >>
                >> defaults read "${HOME}/.MacOSX/environment"
                >
                > Actually, making this work in bash (or other shell) requires a
                > little more than just reading the file... Here's the relevant chunk
                > from my .bashrc:
                >
                > # Get environment variables from ~/.MacOSX/environment.plist
                > # (This avoids the sin of duplicating data here and in that file)
                > if [[ `uname` == 'Darwin' ]] ; then
                > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"'
                > "'" | awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine;
                > do eval $OneLine; done;
                > fi
                >
                > To give credit where it's due, this came from a comment on
                > macosxhints.com.
                >
                > The conditional (if [[ `uname` == "Darwin' ]]) is because I use
                > this same .bashrc across several hosts, including Solaris, Linux,
                > and Mac OS X.

                Just a quick note to anyone using that plist option - I once wasted
                about 20 hours of my time because a 'bad? corrupt? I never determined
                exactly'
                enviroment.plist file caused my home folder to become read-only to
                the Finder! IIRC Terminal.app could still manipulate files.
                It caused all sorts of nifty issues (mainly because ~/Library is used
                so much). Since it's a single user machine, it looked like some
                bizarre disk issue.
                What really got me going was when I couldn't find the problem, I
                reinstalled from scratch, everything was fine, then it came back when
                I restored my home folder.
                Much hair tearing occurred on that one!

                Hopefully I can save a few follicles for somebody else.

                Brian
                -----BEGIN PGP SIGNATURE-----
                Version: GnuPG v1.4.6 (Darwin)
                Comment: Verify this email or encrypt your email for free - see gnupg.org

                iD8DBQFFo+f8GnOmb9xIQHQRAsbaAJ9GcS7DyjSU78O1v3YWxdgtoBReUgCgy8Aq
                HHLv34cFN6eyzje31pYIysk=
                =c/F5
                -----END PGP SIGNATURE-----
              • Brett Calcott
                Hi Dave, Thanks for that. I have spent about 15 years on Windows and know it well. Now I have the fun of discovering all the hidden bits on Mac. Thanks a lot!
                Message 7 of 9 , Jan 10, 2007
                • 0 Attachment
                  Hi Dave,

                  Thanks for that. I have spent about 15 years on Windows and know it well.
                  Now I have the fun of discovering all the hidden bits on Mac.

                  Thanks a lot!
                  Brett

                  On 1/9/07, Dave Land <land@...> wrote:
                  >
                  > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
                  >
                  > > Happily, Apple provided a utility that handles it for you:
                  > >
                  > > defaults read "${HOME}/.MacOSX/environment"
                  >
                  > Actually, making this work in bash (or other shell) requires a little
                  > more than just reading the file... Here's the relevant chunk from
                  > my .bashrc:
                  >
                  > # Get environment variables from ~/.MacOSX/environment.plist
                  > # (This avoids the sin of duplicating data here and in that file)
                  > if [[ `uname` == 'Darwin' ]] ; then
                  > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
                  > awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
                  > $OneLine; done;
                  > fi
                  >
                  > To give credit where it's due, this came from a comment on
                  > macosxhints.com.
                  >
                  > The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
                  > same .bashrc across several hosts, including Solaris, Linux, and Mac
                  > OS X.
                  >
                  > Dave
                  >
                  >
                • Niklas Lindström
                  Hi! Regarding getting your environment into a gvim session. I use the gvim.app which is used to launch multiple Vim.app:s, but with a modified script. ...
                  Message 8 of 9 , Jan 11, 2007
                  • 0 Attachment
                    Hi!

                    Regarding getting your environment into a gvim session.

                    I use the gvim.app which is used to launch multiple Vim.app:s, but
                    with a modified script.

                    I have simply replaced the content of "gvim.app/Contents/Resources/script" with:

                    ------------------------------ 8< ------------------------------
                    #!/bin/sh

                    PROFILE=~/.profile
                    if [ -e $PROFILE ]; then source $PROFILE; fi

                    VIM_APP_DIR=`echo $0 | sed 's#^\(.*\)gvim.app/Contents/Resources/script$#\1#'`

                    ${VIM_APP_DIR}/Vim.app/Contents/MacOS/Vim -go "$@" &
                    ------------------------------ >8 ------------------------------

                    Which gives me the same env-variables I have in my bash-sessions (and
                    also enables gvim.app and related to be put anywhere, not just
                    "/Applications").

                    Best regards,
                    Niklas
                  • Benji Fisher
                    ... The docs already explain one way to set $PATH. ... As it says there, the system vimrc files in the versions distributed at macvim.org/OSX already use this
                    Message 9 of 9 , Feb 1, 2007
                    • 0 Attachment
                      On Tue, Jan 09, 2007 at 10:23:25AM +0100, Bram Moolenaar wrote:
                      >
                      > Dave Land wrote:
                      >
                      > > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
                      > >
                      > > > Happily, Apple provided a utility that handles it for you:
                      > > >
                      > > > defaults read "${HOME}/.MacOSX/environment"
                      > >
                      > > Actually, making this work in bash (or other shell) requires a little
                      > > more than just reading the file... Here's the relevant chunk from
                      > > my .bashrc:
                      > >
                      > > # Get environment variables from ~/.MacOSX/environment.plist
                      > > # (This avoids the sin of duplicating data here and in that file)
                      > > if [[ `uname` == 'Darwin' ]] ; then
                      > > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
                      > > awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
                      > > $OneLine; done;
                      > > fi
                      > >
                      > > To give credit where it's due, this came from a comment on
                      > > macosxhints.com.
                      > >
                      > > The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
                      > > same .bashrc across several hosts, including Solaris, Linux, and Mac
                      > > OS X.
                      >
                      > This issue comes up often enough that it deserves a section in the help.
                      > Could you perhaps write some text? If you can send me a patch that
                      > would be great.

                      The docs already explain one way to set $PATH.

                      :help mac-faq

                      As it says there, the system vimrc files in the versions distributed at
                      macvim.org/OSX already use this method. The same method should work for
                      other environment variables ... but AFAIK the only one that matters is
                      $PATH.

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