help about saving settings

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

help about saving settings

roberto-6
Hi all,
i'm currently trying to manage my personal settings of gvim; more in
particular, i want gvim to open automatically with my preferred font,
background color or other things like that. At the moment i have to
redefine these settings every time i open gvim and this is very
awful... : (

and time consuming

i tried the ":options" window but i did not find anything useful under
the chapter 4 "displaying text"

can you please help me to solve this problem??  : )
thank you!

--
roberto
debian sarge, kernel 2.6.8
Reply | Threaded
Open this post in threaded view
|

Re: help about saving settings

Tim Chase-2
> i'm currently trying to manage my personal settings of gvim;
> more in particular, i want gvim to open automatically with my
> preferred font, background color or other things like that. At
> the moment i have to redefine these settings every time i open
> gvim and this is very awful... : (
>
> and time consuming

You're right...there is a better way :)

For GUI settings, they're best preserved in your gvimrc file.
For vim-wide settings (non GUI specific), they're best put in
your vimrc file.  On *nix boxen, it's usually stored in ~/.vimrc
and ~/.gvimrc whereas on Windows boxes, they're called _vimrc and
_gvimrc (and where they're hidden is a little more varied, though
you might find them in $VIM/_vimrc or in $HOME/_vimrc (which vim
will return to you with

        :echo $VIM
        :echo $HOME

Once you've found the files, you can simply put in your settings.
  Things like your font or colorscheme of preference, you can put
in your gvimrc, as in

        colorscheme elflord
        set guifont=courier_new:h9:w6

or whatever your preferred settings are.  Vim-wide settigns, such
as tab-stops, indentation preferences, mappings, etc. can all go
in your vimrc file, as in

        set noexpandtab ts=4
        filetype plugin on
        syntax on

and the like.

Happy hacking,

-tim






Reply | Threaded
Open this post in threaded view
|

Re: help about saving settings

A.J.Mechelynck
In reply to this post by roberto-6
----- Original Message -----
From: "roberto" <[hidden email]>
To: <[hidden email]>
Sent: Friday, September 09, 2005 4:21 PM
Subject: help about saving settings


> Hi all,
> i'm currently trying to manage my personal settings of gvim; more in
> particular, i want gvim to open automatically with my preferred font,
> background color or other things like that. At the moment i have to
> redefine these settings every time i open gvim and this is very
> awful... : (
>
> and time consuming
>
> i tried the ":options" window but i did not find anything useful under
> the chapter 4 "displaying text"
>
> can you please help me to solve this problem??  : )
> thank you!
>
> --
> roberto
> debian sarge, kernel 2.6.8

see "help vimrc"

Basically, you write the commands to set your preferred settings in a file,
called _vimrc or .vimrc (the period is preferred on Unix, the underscore on
Windows, but if the one isn't found Vim will look for the other) and place
that file in your $HOME directory (the directory whose name appears in
response to

    :echo $HOME

in Vim). Each line is one Ex-command, i.e., same as on the command-line
without the colon. Lines beginning with a double quote are comments.

For example:


" force English messages
if has("unix")
    language messages C
else
    language messages en
endif
" set 'typical' settings
source $VIMRUNTIME/vimrc_example.vim
" if getting ready for GUI mode, maximize and set font
if has("gui_running")
    set lines=99999 columns=99999
    " warning: the 'guifont' option takes 4 possible formats
    " which are mutually incompatible.
    " Each version of gvim will accept
    " only one of them.
    " But it is possible to test which kind of gvim
    " we are currently using.
    if has("gui_gtk2")
        " GTK+2 GUI
        set guifont=Andale\ Mono\ 10
    elseif has("gui_kde")
        " kvim
        set guifont=Andale\ Mono/10
    elseif has("x11")
        " other x11 systems
        " the following must be all on one line
        set guifont=-*-lucidatypewriter-medium-r-normal-*-*-160-*-*-m-*-*
    else
        " non-x11, such as Windows or Classical Mac
        set guifont=Lucida_Console:h8:cDEFAULT
    endif
endif
" set our preferred color scheme
" (replace MyPreferredColors by the name
" of your preferred colorscheme)
colorscheme MyPreferredColors
" etc. (add possible additional settings here)



The file $VIMRUNTIME/vimrc_example.vim is a "typical" vimrc. I recommend
sourcing it (i.e., "running" it) near the top of your vimrc, as in this
example. There is also a script $VIMRUNTIME/mswin.vim which I recommend NOT
using, not even on Windows. It breaks too many of the standard Vim
normal-mode commands for my taste.

HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: help about saving settings

Dominic Evans
In reply to this post by Tim Chase-2
Rather than have to carry around two files to different machines, I
find it easier to put everything in .vimrc and simply wrap gui stuff
in

    if has("gui")
        set guifont=Courier_New:h8:cANSI
    endif

etc.

Do ':help feature-list' to see what else you can put in the has
method. win32 and other things are quite useful, especially when
setting gui fonts for different platforms

Cheers,
Dom

On 09/09/05, Tim Chase <[hidden email]> wrote:

> > i'm currently trying to manage my personal settings of gvim;
> > more in particular, i want gvim to open automatically with my
> > preferred font, background color or other things like that. At
> > the moment i have to redefine these settings every time i open
> > gvim and this is very awful... : (
> >
> > and time consuming
>
> You're right...there is a better way :)
>
> For GUI settings, they're best preserved in your gvimrc file.
> For vim-wide settings (non GUI specific), they're best put in
> your vimrc file.  On *nix boxen, it's usually stored in ~/.vimrc
> and ~/.gvimrc whereas on Windows boxes, they're called _vimrc and
> _gvimrc (and where they're hidden is a little more varied, though
> you might find them in $VIM/_vimrc or in $HOME/_vimrc (which vim
> will return to you with
>
>         :echo $VIM
>         :echo $HOME
>
> Once you've found the files, you can simply put in your settings.
>   Things like your font or colorscheme of preference, you can put
> in your gvimrc, as in
>
>         colorscheme elflord
>         set guifont=courier_new:h9:w6
>
> or whatever your preferred settings are.  Vim-wide settigns, such
> as tab-stops, indentation preferences, mappings, etc. can all go
> in your vimrc file, as in
>
>         set noexpandtab ts=4
>         filetype plugin on
>         syntax on
>
> and the like.
>
> Happy hacking,
>
> -tim
>
>
>
>
>
>
>