Re: Mac Questions

2007-02-01 Thread Benji Fisher
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


Re: Mac Questions

2007-01-19 Thread Robert Hicks
When you do this --enable-pythoninterp --enable-rubyinterp what do you 
get? Does that just allow another language to be used as a vim script?


Robert



Re: Mac Questions

2007-01-19 Thread Robert Hicks

litespeed59 wrote:

Alan,

I recently figured out how to compile Vim on a Mac from source, so here is
the method I used. I too am fairly new at this, so if any Mac users can
improve on my instructions, feel free to do so.

I obtained the Vim sources through Subversion (I keep my source code
downloads in ~/Source). You may need to install a Subversion client on your
system to get this to work. Open Terminal and enter the following commands
(assuming ~/Source already exists):

  cd ~/Source
  svn co https://svn.sourceforge.net/svnroot/vim/vim7



Does that get everything? Including patches released since Vim7 has come 
out?


Robert



RE: Mac Questions

2007-01-19 Thread striker
These commands enable an interface to the script interpreter for whatever
languages you enable at compile time.
This is of course if you have the scripting language installed.
See
:h python
:h perl
:h ruby

Kevin

-Original Message-
From: news [mailto:[EMAIL PROTECTED] Behalf Of Robert Hicks
Sent: Friday, January 19, 2007 9:33 AM
To: vim@vim.org
Subject: Re: Mac Questions


When you do this --enable-pythoninterp --enable-rubyinterp what do you
get? Does that just allow another language to be used as a vim script?

Robert



Re: Mac Questions

2007-01-19 Thread litespeed59

Robert,

Yes, the initial Subversion download will get Vim with all the latest
patches. There may be a delay of a day or two between the time the patches
are first released, and when they appear in the Subversion repository, but
otherwise this is a great way to stay up to date.

Regards,
Trev


Robert Hicks-2 wrote:
 
 Does that get everything? Including patches released since Vim7 has come 
 out?
 
 Robert
 

-- 
View this message in context: 
http://www.nabble.com/Mac-Questions-tf2937782.html#a8460380
Sent from the Vim - General mailing list archive at Nabble.com.



Re: Mac Questions

2007-01-19 Thread Robert Hicks

litespeed59 wrote:

Robert,

Yes, the initial Subversion download will get Vim with all the latest
patches. There may be a delay of a day or two between the time the patches
are first released, and when they appear in the Subversion repository, but
otherwise this is a great way to stay up to date.

Regards,
Trev



I just did it and it worked like a charm. Cool.

Robert



Re: Mac Questions

2007-01-16 Thread litespeed59

Alan,

I recently figured out how to compile Vim on a Mac from source, so here is
the method I used. I too am fairly new at this, so if any Mac users can
improve on my instructions, feel free to do so.

I obtained the Vim sources through Subversion (I keep my source code
downloads in ~/Source). You may need to install a Subversion client on your
system to get this to work. Open Terminal and enter the following commands
(assuming ~/Source already exists):

  cd ~/Source
  svn co https://svn.sourceforge.net/svnroot/vim/vim7

You may get prompted to accept the certificate after the second command ...
I usually hit 't' to accept it temporarily. If all goes well, you should end
up with a new vim7 directory in ~/Source.

I build Vim with Python and Ruby support and the huge feature set. You need
to have both languages installed on your system to build Vim this way. This
is what I would enter next:

  cd vim7/src
  ./configure --enable-pythoninterp --enable-rubyinterp --with-features=huge
  make
  make test

If you don't need support for Python and Ruby, just omit those options from
the ./configure line above. If you need support for other languages like
Perl, see the Makefile in the vim7/src directory for additional options.

If all goes well at this point, you can enter the following command to
install Vim in the /Applications folder:

  make install

This should move Vim.app to /Applications, and you can launch it from there.

When new patches come out, I just do the following to update my copy of Vim:

  cd ~/Source/vim7
  svn update
  cd src
  make
  make test
  make install

Hope this helps!
Trev


Alan G Isaac wrote:
 
 Would you mind outlining the steps you took for someone who 
 is making the same transition but is not used to compiling 
 their own apps? (I have XCode installed.)
 
 Thank you,
 Alan Isaac
 

-- 
View this message in context: 
http://www.nabble.com/Mac-Questions-tf2937782.html#a8402869
Sent from the Vim - General mailing list archive at Nabble.com.



Re: Mac Questions

2007-01-15 Thread Marc Wilson
On Mon, Jan 08, 2007 at 06:35:18PM +1100, Brett Calcott wrote:
 I thought the same thing. But it does not appear to source my
 .bash_profile or .bashrc.

Why would it?  Vim is not bash.

The shell in which you run a console vim should have already sourced bash
startup files as appropriate (see the INVOCATION section of the bash
manpage), and the GUI vim couldn't care less about what you might put in
some random shell startup file.

-- 
 Marc Wilson | Why do we have two eyes?  To watch 3-D movies with.
 [EMAIL PROTECTED] |


Re: Quick start compiling on Mac (was Mac Questions)

2007-01-14 Thread Nick Lo

Hi Brett,

These instructions worked perfectly for me using OS X 10.4.8 on a  
Macbook. I'd suggest putting these instructions somewhere like vim  
tips or a blog. I'm inclined to mention them on my own blog (pointing  
to the source of course) just for the sake of record keeping.


Many thanks,

Nick



Would you mind outlining the steps you took for someone who
is making the same transition but is not used to compiling
their own apps? (I have XCode installed.)



I installed subversion and used it to get the latest version of the
code. Get it from here :
http://www.codingmonkeys.de/mbo/

Then it goes something like this:

mkdir Source
cd Source
svn co https://svn.sourceforge.net/svnroot/vim/vim7
(see this page http://www.vim.org/subversion.php)

cd vim7

./configure --enable-pythoninterp
(I have python installed and want to use the python support in vim,
but leave out the option if you don't have/want python)

make
(This compiles it using your xcode install)
make install
(This installs the gui version of vim in Applications; so you might
need to type in an admin password)

The vim invoked at the Terminal will still be the 6.3 one that came
with mac. You can do what somebody suggested in the thread by setting
an alias, or if you want to be a bit more brutal (like me) then

sudo mv src/Vim /usr/bin/vim

Which moves the unix executable (not the Vim.app package) that was
built over the top of the old version.

Whenever you feel like the latest patches, just do svn up in the
same dir, and then repeat the same stuff.

Let me know if that works for you.
Cheers,
Brett


Re: Mac Questions

2007-01-12 Thread Robert Hicks

Alan G Isaac wrote:
On Mon, 8 Jan 2007, Brett Calcott apparently wrote: 
I have just got a Macbook (switching from windows) and 
have downloaded and compiled the latest version of Vim on 
it. It all works fine, but I have a few questions. 


Would you mind outlining the steps you took for someone who 
is making the same transition but is not used to compiling 
their own apps? (I have XCode installed.)


Thank you,
Alan Isaac






I would suggest going here:  http://macvim.org/OSX/index.php

It has a binary and some hints and tips as well.

Robert



Re: Mac Questions

2007-01-12 Thread Krzysztof MaJ


On 2007-01-12, at 03:45, A.J.Mechelynck wrote:




By default, Vim doesn't change directories when you open a file. If  
you open Vim from the Dock, without a filename, the current dir is  
your home directory. If you later edit one or more files, the  
current directory is unchanged. If you want to edit a file which is  
not in the current dir, you should specify the path as part of the  
argument to the :edit command. (You can use command-line  
completion repeatedly to complete one subdirectory or file name at  
a time.) If you type just :e filename, then if filename doesn't  
exist in the current directory, Vim will assume that you want to  
create a new file there.


If, instead, you click a file in Finder, the OS sets the current  
directory to that file's directory, then invokes Vim.


If Vim is compiled with +netbeans_intg or with +sun_workshop, you  
can set 'autochdir'. This will change the current directory  
whenever you edit a new file, switch buffers, etc., so the current  
directory will follow the current file. Vim will still not guess  
a directory name (how could it?): :e filename with no path, still  
means that you want to edit (or create) a file in the current  
directory, whatever it is.


Alternately, you can use

:autocmd BufWinEnter * lcd %:p:h

which will set a local directory for each buffer. This  
alternative only requires +autocmd, which is included in Normal,  
Big and Huge builds of Vim.


Personally, I've tried it, and I've found that I don't like  
directory changes happening, so to speak, behind my back. I  
prefer that directories only be changed when I use :cd or :lcd  
explicitly. (YMMV)


In any case, each window's status line (when present) displays the  
path to the file in that window, relative to the current directory  
if possible, or otherwise as an absolute path.


See
:help 'autochdir'
:help :autocmd
:help BufWinEnter
:help :cd
:help :lcd
:help 'laststatus'


Best regards,
Tony.


Wow, you guys are always very helpful! Thanks a lot for help. I  
personally prefer a directory changes automatically at least right  
know, working with one big project in LaTeX2e. Maybe after that I'll  
change my mind being enough experienced ;-)

Thanks a lot once again!

stay in touch,
--
Pozdrawiam - Krzysztof Maj
 I'm a Mac now, are you PC?
Oh, dear... ;-)





Re: Mac Questions

2007-01-11 Thread Krzysztof MaJ


On 2007-01-09, at 14:54, Brian McKee wrote:

 Get a good value for $PATH.  For example, if teTeX is installed,  
this

 should add the path to tex, pdflatex, etc.
 This should only make a difference when vim is started from the  
Finder or

 with open.
let $PATH = system(printenv PATH)
let $PATH = substitute($PATH, \C-J$, , )


Hi,
I have a question. If I open my GVIM from the Dock and after that I  
open some file from the gui it sets PWD to my home directory not to  
the place from the file really is. If I open the same file clicking  
on it in Finder VIM sets PWD to the right place (to directory from  
this file is). I have written above lines to my .gvimrc but without  
any effects. Could somebody explain me what's going on? It's really  
frustrating because if I don't change the path manually forgetting  
about it, GVIM write my file in the home directory not in the place  
where it really is, making two diffrent copies of it.


How to correct it?

Cheers,
--
Pozdrawiam - Krzysztof Maj
 I'm a Mac now, are you PC?
Oh, dear... ;-)





Re: Mac Questions

2007-01-11 Thread A.J.Mechelynck

Krzysztof MaJ wrote:
[...]

Hi,
I have a question. If I open my GVIM from the Dock and after that I open 
some file from the gui it sets PWD to my home directory not to the place 
from the file really is. If I open the same file clicking on it in 
Finder VIM sets PWD to the right place (to directory from this file is). 
I have written above lines to my .gvimrc but without any effects. Could 
somebody explain me what's going on? It's really frustrating because if 
I don't change the path manually forgetting about it, GVIM write my file 
in the home directory not in the place where it really is, making two 
diffrent copies of it.


How to correct it?

Cheers,
--Pozdrawiam - Krzysztof Maj
 I'm a Mac now, are you PC?
Oh, dear... ;-)







By default, Vim doesn't change directories when you open a file. If you open 
Vim from the Dock, without a filename, the current dir is your home directory. 
If you later edit one or more files, the current directory is unchanged. If 
you want to edit a file which is not in the current dir, you should specify 
the path as part of the argument to the :edit command. (You can use 
command-line completion repeatedly to complete one subdirectory or file name 
at a time.) If you type just :e filename, then if filename doesn't exist 
in the current directory, Vim will assume that you want to create a new file 
there.


If, instead, you click a file in Finder, the OS sets the current directory to 
that file's directory, then invokes Vim.


If Vim is compiled with +netbeans_intg or with +sun_workshop, you can set 
'autochdir'. This will change the current directory whenever you edit a new 
file, switch buffers, etc., so the current directory will follow the current 
file. Vim will still not guess a directory name (how could it?): :e 
filename with no path, still means that you want to edit (or create) a file 
in the current directory, whatever it is.


Alternately, you can use

:autocmd BufWinEnter * lcd %:p:h

which will set a local directory for each buffer. This alternative only 
requires +autocmd, which is included in Normal, Big and Huge builds of Vim.


Personally, I've tried it, and I've found that I don't like directory changes 
happening, so to speak, behind my back. I prefer that directories only be 
changed when I use :cd or :lcd explicitly. (YMMV)


In any case, each window's status line (when present) displays the path to the 
file in that window, relative to the current directory if possible, or 
otherwise as an absolute path.


See
:help 'autochdir'
:help :autocmd
:help BufWinEnter
:help :cd
:help :lcd
:help 'laststatus'


Best regards,
Tony.


Current working directory (was Re: Mac Questions

2007-01-11 Thread Timothy Knox
Somewhere on Shadow Earth, at Fri, Jan 12, 2007 at 03:45:26AM +0100, 
A.J.Mechelynck wrote:
snip
 Alternately, you can use
 
   :autocmd BufWinEnter * lcd %:p:h
 
 which will set a local directory for each buffer. This alternative only 
 requires +autocmd, which is included in Normal, Big and Huge builds 
 of Vim.
 
 Personally, I've tried it, and I've found that I don't like directory 
 changes happening, so to speak, behind my back. I prefer that directories 
 only be changed when I use :cd or :lcd explicitly. (YMMV)

Whereas I added that to my .vimrc some time ago, and absolutely love it. On the
other hand, I work on a large software development project with many deep
directory hierarchies (the Real Networks media server, most of the code for
which is open source, so you can see what I mean), and I find it *very* handy to
do something like this:

$ cd server/protocol/transport/rdt/unittest
$ vim ut_rdttcptran.cpp
from within vim
:e ../../../tools/unittest/netio/ut_socket.cpp
later
:e ut_bufsock.cpp (which is in the same dir as ut_socket.cpp)
still later, after flipping back to ut_rdttcptran.cpp
:e ut_rdtudptran.cpp (which is in the same dir as ut_rdttcptran.cpp)

I find that far more convenient than having to constantly remember to preface my
:e with a bunch of ../'s, but, as noted, YMMV.

-- 
I have always wished that my computer would be as easy to use as my telephone.
My wish has come true. I no longer know how to use my telephone.
-- Bjarne Stroustrup, creator of the C++ programming language


Re: Current working directory (was Re: Mac Questions

2007-01-11 Thread A.J.Mechelynck

Timothy Knox wrote:

Somewhere on Shadow Earth, at Fri, Jan 12, 2007 at 03:45:26AM +0100, 
A.J.Mechelynck wrote:
snip

Alternately, you can use

:autocmd BufWinEnter * lcd %:p:h

which will set a local directory for each buffer. This alternative only 
requires +autocmd, which is included in Normal, Big and Huge builds 
of Vim.


Personally, I've tried it, and I've found that I don't like directory 
changes happening, so to speak, behind my back. I prefer that directories 
only be changed when I use :cd or :lcd explicitly. (YMMV)


Whereas I added that to my .vimrc some time ago, and absolutely love it. On the
other hand, I work on a large software development project with many deep
directory hierarchies (the Real Networks media server, most of the code for
which is open source, so you can see what I mean), and I find it *very* handy to
do something like this:

$ cd server/protocol/transport/rdt/unittest
$ vim ut_rdttcptran.cpp
from within vim
:e ../../../tools/unittest/netio/ut_socket.cpp
later
:e ut_bufsock.cpp (which is in the same dir as ut_socket.cpp)
still later, after flipping back to ut_rdttcptran.cpp
:e ut_rdtudptran.cpp (which is in the same dir as ut_rdttcptran.cpp)

I find that far more convenient than having to constantly remember to preface my
:e with a bunch of ../'s, but, as noted, YMMV.



I don't use auto-change-dir methods but I will, at times, use the :lcd 
command, either just before loading a new file, or in the form :lcd %:p:h 
after navigating to a new file. Since :lcd only applies to the current 
window, going back to the other window also goes back to the other directory.



Best regadrs,
Tony.


Re: Mac Questions

2007-01-09 Thread Bram Moolenaar

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 -- [EMAIL PROTECTED] -- 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///


Re: Mac Questions

2007-01-09 Thread Brian McKee

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8-Jan-07, at 5: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.

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.



FWIW - found this in my .vimrc
 Get a good value for $PATH.  For example, if teTeX is installed, this
 should add the path to tex, pdflatex, etc.
 This should only make a difference when vim is started from the  
Finder or

 with open.
let $PATH = system(printenv PATH)
let $PATH = substitute($PATH, \C-J$, , )

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

iD8DBQFFo56iGnOmb9xIQHQRArvVAKC9jHkQ2cg/nSN1eoui9TwlUkKwGwCg06LF
EUmrItXId5XsNVgg2Cc6VLU=
=DhLZ
-END PGP SIGNATURE-


Re: Mac Questions

2007-01-08 Thread striker

I believe both versions of Vim get its initial info from ~/.bashrc.
In my ~/.vimrc I have the following entry:

 make sure Vim uses the bash shell
set shell=bash

Which verion(s) are you using?  I have OS X 10.4.8 and the command  
line version of Vim is 6.3.82.
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.


Kevin


On Jan 8, 2007, at 1:42 AM, Brett Calcott wrote:


Hi all,

I have just got a Macbook (switching from windows) and have downloaded
and compiled the latest version of Vim on it. It all works fine, but I
have a few questions.

1. How do I distinguish between the command line and gui versions.
Both appear to respond 'True' to has(gui). Is there another feature
that I should be looking for.

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.

Thanks for any aid,
Brett





Re: Mac Questions

2007-01-08 Thread Alan G Isaac
On Mon, 8 Jan 2007, Brett Calcott apparently wrote: 
 I have just got a Macbook (switching from windows) and 
 have downloaded and compiled the latest version of Vim on 
 it. It all works fine, but I have a few questions. 

Would you mind outlining the steps you took for someone who 
is making the same transition but is not used to compiling 
their own apps? (I have XCode installed.)

Thank you,
Alan Isaac






Re: Mac Questions

2007-01-08 Thread Axel Kielhorn


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.



Re: Mac Questions

2007-01-08 Thread Mikolaj Machowski
On pon sty 8 2007, vim@vim.org wrote:
 I thought the same thing. But it does not appear to source my
 .bash_profile or .bashrc.

 Anyone out there got some clues...?

/etc/profile
/etc/bashrc 

?

This will be global for all users (if working :)).

m.



Re: Mac Questions

2007-01-08 Thread 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 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


Quick start compiling on Mac (was Mac Questions)

2007-01-08 Thread Brett Calcott


Would you mind outlining the steps you took for someone who
is making the same transition but is not used to compiling
their own apps? (I have XCode installed.)



I installed subversion and used it to get the latest version of the
code. Get it from here :
http://www.codingmonkeys.de/mbo/

Then it goes something like this:

mkdir Source
cd Source
svn co https://svn.sourceforge.net/svnroot/vim/vim7
(see this page http://www.vim.org/subversion.php)

cd vim7

./configure --enable-pythoninterp
(I have python installed and want to use the python support in vim,
but leave out the option if you don't have/want python)

make
(This compiles it using your xcode install)
make install
(This installs the gui version of vim in Applications; so you might
need to type in an admin password)

The vim invoked at the Terminal will still be the 6.3 one that came
with mac. You can do what somebody suggested in the thread by setting
an alias, or if you want to be a bit more brutal (like me) then

sudo mv src/Vim /usr/bin/vim

Which moves the unix executable (not the Vim.app package) that was
built over the top of the old version.

Whenever you feel like the latest patches, just do svn up in the
same dir, and then repeat the same stuff.

Let me know if that works for you.
Cheers,
Brett


Re: Mac Questions

2007-01-08 Thread Dave Land

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
   keymyvimhelp/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



Re: Mac Questions

2007-01-08 Thread Dave Land

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



Re: Mac Questions

2007-01-07 Thread A.J.Mechelynck

Brett Calcott wrote:

Hi all,

I have just got a Macbook (switching from windows) and have downloaded
and compiled the latest version of Vim on it. It all works fine, but I
have a few questions.

1. How do I distinguish between the command line and gui versions.
Both appear to respond 'True' to has(gui). Is there another feature
that I should be looking for.


Many non-Windows versions of GUI-enabled Vim can also run in console mode. The 
classical way for a script to determine whether it is being sourced by gvim 
or by Console Vim is to check has(gui_running).




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.

Thanks for any aid,
Brett



I don't know the answer to this one, except that it gets its environment the 
same way as any other program. If Mac is sufficiently similar to Linux (both 
are Unix-like OSes after all) non-login shells may get it from shell-specific 
files like ~/.bashrc, ~/.cshrc, etc. (For details,see the manpage for your 
shell.) (Note: Files whose names start with a dot are normally not listed in 
directory listings. Use ls -a (possibly with other options) to make them 
appear.)



Best regards,
Tony.


Re: Mac Questions

2007-01-07 Thread Brett Calcott


 1. How do I distinguish between the command line and gui versions.
 Both appear to respond 'True' to has(gui). Is there another feature
 that I should be looking for.

Many non-Windows versions of GUI-enabled Vim can also run in console mode.
classical way for a script to determine whether it is being sourced by gvim
or by Console Vim is to check has(gui_running).


Yay! Thanks for that Tony.




 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 the answer to this one, except that it gets its environment the
same way as any other program. If Mac is sufficiently similar to Linux (both
are Unix-like OSes after all) non-login shells may get it from shell-specific
files like ~/.bashrc, ~/.cshrc, etc. (For details,see the manpage for your
shell.) (Note: Files whose names start with a dot are normally not listed in
directory listings. Use ls -a (possibly with other options) to make them
appear.)



I thought the same thing. But it does not appear to source my
.bash_profile or .bashrc.

Anyone out there got some clues...?

Thanks
Brett


Re: Mac Questions

2007-01-07 Thread A.J.Mechelynck

Brett Calcott wrote:


 1. How do I distinguish between the command line and gui versions.
 Both appear to respond 'True' to has(gui). Is there another feature
 that I should be looking for.

Many non-Windows versions of GUI-enabled Vim can also run in console 
mode.
classical way for a script to determine whether it is being sourced 
by gvim

or by Console Vim is to check has(gui_running).


Yay! Thanks for that Tony.




 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 the answer to this one, except that it gets its 
environment the
same way as any other program. If Mac is sufficiently similar to Linux 
(both
are Unix-like OSes after all) non-login shells may get it from 
shell-specific
files like ~/.bashrc, ~/.cshrc, etc. (For details,see the manpage for 
your
shell.) (Note: Files whose names start with a dot are normally not 
listed in
directory listings. Use ls -a (possibly with other options) to make 
them

appear.)



I thought the same thing. But it does not appear to source my
.bash_profile or .bashrc.

Anyone out there got some clues...?

Thanks
Brett



If you type echo $SHELL (without the quotes) at the Terminal app 
command-line, what is the answer?



Best regards,
Tony.


Re: Mac Questions

2007-01-07 Thread A.J.Mechelynck

Brett Calcott wrote:



If you type echo $SHELL (without the quotes) at the Terminal app
command-line, what is the answer?




/bin/bash for both gui and command line versions.


Brett



Hm, then let's wait and see what the Mac guys have to say.


Best regards,
Tony.