Create default configuration for VIM

For having a good looking VIM with a nicer colorscheme, we only need to follow two steps (Of course we need to install vim first)

Create VIM default configuration file

Create the file .vimrc in your home directory.

touch ~/.vimrc

edit the file:

vim ~/.vimrc

insert the default configuration:

set nocompatible
set showmatch
set nohls
set ruler

" 4 SPACES INDENTATION
" set tabstop=4
" set shiftwidth=4
" set expandtab

" TAB INDENTATION
set ts=2
set shiftwidth=2
set smarttab

set ignorecase
set smartcase
set nowrap
set nonumber
set encoding=utf-8
set fileencoding=utf-8
set fileformat=unix
set fileformats=unix
" set number
set hlsearch
set wrap
set ai
set si
set mouse=a

set pastetoggle=<F10>

let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 40
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Show_One_File = 1

autocmd FileType php set omnifunc=phpcomplete#CompletePHP

inoremap <C-P> <ESC>:call PhpDocSingle()<CR>i
nnoremap <C-P> :call PhpDocSingle()<CR>
vnoremap <C-P> :call PhpDocRange()<CR>

map <F2> :NERDTreeToggle<CR>
map <F3> :MRU<CR>
map <F4> :TlistToggle<CR>
nnoremap <F5> :!/usr/bin/phpcs --standard=Zend %<CR>

if ! has("gui_running")
        set t_Co=256
endif
set background=dark
colors peaksea

let feature_filetype='behat'

highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
" Show trailing whitespace:
:match ExtraWhitespace /\s\+$/
" Show spaces before a tab:
:match ExtraWhitespace / \+\ze\t/
" Show tabs that are not at the start of a line:
:match ExtraWhitespace /[^\t]\zs\t\+/
" Show spaces used for indenting (so you use only tabs for indenting).
:match ExtraWhitespace /^\t*\zs \+/

" :match ErrorMsg '\%>80v.\+'

Add the color scheme

Now we can download our favourite color scheme. In this example I’m using peaksea.vim which can be downloaded here.

Once the color scheme is downloaded, move the file to the following path:

~/.vim/colors/peaksea.vim

Create default configuration for all users

On Linux you can add the configuration for all users just modifying the file /etc/vim/vimrc adding the line:

:color COLOR_SCHEME

Just replace COLOR_SCHEME by the name of the color scheme you want to use, I recommend Jelly beans. The color scheme must exist within the folder /etc/vim/colors/.

Comments 1

Leave a Reply to Daniel Lemures Cancel reply

Your email address will not be published. Required fields are marked *