Trouble with .vimrc files on OS X Tiger

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble with .vimrc files on OS X Tiger

Unnsse Khan-2
Hello,

I am using gVim 7.0aa ALPHA on OS X 10.4 (Tiger) (I downloaded this  
from: http://macvim.org/OSX/index.html) and several settings are not  
being enabled at runtime...

My .gvimrc file is:

Raven:~ untz$ cat .gvimrc
set nocompatible
set backspace=indent,eol,start
set ts=4
set nu!
set autoindent
set ruler
syntax on
colorscheme torte
set gfn=Anonymous:h12
set anti

My .vimrc is:

set nocompatible
set ts=4
set nu!
set autoindent
set ruler
set backspace=indent,eol,start
syntax on
colorscheme torte
set gfn=set guifont=Bitstream\ Vera\ Sans\ Mono\ 20

Several issues:

1. The set nu! doesn't turn on when my Vim is launched. I still have  
to explicitly set it everytime I launch the application.

2. When I try to highlight code using "shift + arrowkey", nothing  
happens! It does become highlighted when use the mouse, however...

3. When I type gvim from the command line, gvim 7.00 aa ALPHA  
launches, however, when I type "vim", vim 6.2 launches.

I also copied the aforementioned .gvimrc and .vimrc files to /
Applications/Vim.app

Are any of these problems associated with the fact that I am using an  
ALPHA release?

With thanks!

- Unnsse
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with .vimrc files on OS X Tiger

A.J.Mechelynck
Unnsse Khan wrote:

> Hello,
>
> I am using gVim 7.0aa ALPHA on OS X 10.4 (Tiger) (I downloaded this
> from: http://macvim.org/OSX/index.html) and several settings are not
> being enabled at runtime...
>
> My .gvimrc file is:
>
> Raven:~ untz$ cat .gvimrc
> set nocompatible
> set backspace=indent,eol,start
> set ts=4
> set nu!
> set autoindent
> set ruler
> syntax on
> colorscheme torte
> set gfn=Anonymous:h12
> set anti
>
> My .vimrc is:
>
> set nocompatible
> set ts=4
> set nu!
> set autoindent
> set ruler
> set backspace=indent,eol,start
> syntax on
> colorscheme torte
> set gfn=set guifont=Bitstream\ Vera\ Sans\ Mono\ 20
>
> Several issues:
>
> 1. The set nu! doesn't turn on when my Vim is launched. I still have  to
> explicitly set it everytime I launch the application.
>
> 2. When I try to highlight code using "shift + arrowkey", nothing
> happens! It does become highlighted when use the mouse, however...
>
> 3. When I type gvim from the command line, gvim 7.00 aa ALPHA  launches,
> however, when I type "vim", vim 6.2 launches.
>
> I also copied the aforementioned .gvimrc and .vimrc files to /
> Applications/Vim.app
>
> Are any of these problems associated with the fact that I am using an
> ALPHA release?
>
> With thanks!
>
> - Unnsse
>
>
>

0. It is not needed to repeat in your .gvimrc settings which are already
in your .vimrc (gvim will read both). For settings which are to be set
differently for GUI or console mode, use

        if has("gui_running")
                set guifont=Bistream\ Vera\ Sans\ Mono\ 20
        else
                set guifont=Anonymous:h12:cDEFAULT
        endif

though I make two remarks here:
        (a) the above assumes that the GUI uses GTK+2 and that Console Vim is
"non-X11"; see below.
        (b) I suspect that trying to set 'guifont' in console Vim would produce
an error ("Unknown option: guifont").
        (c) Here is an "all-platforms" snippet for the GUI only:

    if has("gui_running")
        if has("gui_gtk2")
            set gfn=Bitstream\ Vera\ Sans\ Mono\ 20
        elseif has("gui_kde")
            set gfn=Bitstream\ Vera\ Sans\ Mono/20
        elseif has("x11")
            set gfn=*-courier-medium-r-normal-*-*-200-*-*-m-*-*
        else
            set gfn=Anonymous:h12:cDEFAULT
        endif
    endif

1. ":set nu!" means "invert the 'nu' setting". Gvim will invert it once
when reading the vimrc and a second time when reading the gvimrc, with
the result that it will not been changed. If you want numbers, use

        :set nu

(with no exclamation mark) in your vimrc, and nothing in your gvimrc.

2. To highlight code using shift+arrowkey, you need (as a minimum)

        :set keymodel=startsel

(The default for 'keymodel' is empty, and with that setting the shifted
arrow keys will not start a selection.)

3. I'm not sure how this works on MacOsX but try creating an alias or a
softlink (or something) so that the gvim program be launched when you
invoke "vim". It should know that you invoked it as vim and start in
Console mode. If it starts in GUI mode nevertheless, try running "gvim
-v" (without the quotes).


HTH,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: Trouble with .vimrc files on OS X Tiger

Chris Allen
On 01/06/05, A. J. Mechelynck <[hidden email]> wrote:
> 3. I'm not sure how this works on MacOsX but try creating an alias or a
> softlink (or something) so that the gvim program be launched when you
> invoke "vim". It should know that you invoked it as vim and start in
> Console mode. If it starts in GUI mode nevertheless, try running "gvim
> -v" (without the quotes).

That won't work so well, actually, which should probably be construed
as a bug.  The gvim script bundled with OS X Vim backgrounds Vim
automatically, which makes console Vim fail in interesting ways.  The
quick fix for this is to copy the gvim shell script to vim and remove
the ampersand (&) from the last line.  For that to work, of course,
/usr/local/bin has to be ahead of /usr/bin in your path, or you can
nuke the ancient OS X vim binary and replace it.

Chris Allen