# Global configuration for Vim?



## Kiki Novak (Mar 28, 2017)

Hi,

On a pristine FreeBSD installation, I just added the vim-lite package. Searching for the global vimrc configuration file, I found two.

/usr/local/etc/vim/vimrc.sample
/usr/local/share/vim/vim80/vimrc_example.vim
I'm confused, since on my workstation running Slackware Linux there's only one single /usr/share/vim/vimrc file.

Anyway, I'm looking for the system-wide configuration file for Vim so I can add a handful of options not only for the toor/root user, but also for all common users. Which one would that be? And how comes there are two seemingly unrelated configuration files for Vim in FreeBSD?

Cheers,

Niki


----------



## lme@ (Mar 28, 2017)

Copy /usr/local/etc/vim/vimrc.sample to /usr/local/etc/vim/vimrc.


----------



## SirDice (Mar 28, 2017)

When in doubt, consult the man pages:

```
/usr/local/etc/vim/vimrc                                      
                      System wide Vim initializations.
```
See vim(1).


----------



## Kiki Novak (Mar 28, 2017)

Thanks guys. Though there seems to be a little problem. Here goes.

On a vanilla installation with the vim-lite package, there's already a /usr/local/etc/vim/vimrc file, identical to /usr/local/etc/vim/vimrc.sample. So I edit that file and add my handful of options in the hope that they will apply system-wide. Here's what the first stanzas of the default file look like:

```
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
        set fileencodings=ucs-bom,utf-8,latin1
endif

let g:is_posix = 1
set nocompatible
set bs=indent,eol,start
set history=50
set ruler

if &t_Co > 2 || has("gui_running")
        syntax on
        set hlsearch
endif
```

Now I'm adding my own options in between these stanzas, as I do on my Slackware workstation.


```
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
        set fileencodings=ucs-bom,utf-8,latin1
endif

let g:is_posix = 1
set nocompatible
set bs=indent,eol,start
set history=50
set ruler

colorscheme elflord
set textwidth=79
set scrolloff=15
set autoindent
set tabstop=2
set shiftwidth=2
set expandtab
set modeline modelines=2

if &t_Co > 2 || has("gui_running")
        syntax on
        set hlsearch
endif
```

Now here's the weird thing. The very first option `colorscheme elflord` is taken into account... but all the other options have strictly no effect.

On the other hand, when I create a ~/.vimrc file and put these options into it, they all work.

So how comes system-wide options in that file don't work? I'm puzzled.


----------

