syn on
set hlsearch
" set nohlsearch
" set incsearch

" Maximum line size
" set textwidth=85

" c indent
set autoindent
set cindent
set cinoptions=>4,n4,}0

" Espaces a la place des tab
set expandtab 
set tabstop=4
autocmd FileType c set noet
autocmd FileType h set noet

" encoding
set encoding=UTF-8

" load the PHP dict
set dictionary-=/usr/share/dict/words dictionary+=/var/vim/PHP.dict

" Pas de numeros de ligne
set nonu
set numberwidth=3

" Paste toggle
set pastetoggle=<F10>

" Scroll when cursor gets within 3 characters of top/bottom edge
set scrolloff=3

" Jump to matching bracket for 2/10th of a second (works with showmatch)
set matchtime=2
set showmatch

" Show (partial) commands (or size of selection in Visual mode) in the status line
set showcmd

" Format du fichier (fileformat)
set ff=unix

" Use menu to show command-line completion (in 'full' case)
set wildmenu

" Set command-line completion mode:
"   - on first <Tab>, when more than one match, list all matches and complete
"     the longest common  string
"   - on second <Tab>, complete the next full match and show menu
set wildmode=list:longest,full

" permettre l'analyse de syntaxe en faisant CTRL+M
" autocmd FileType php noremap <C-M> :w!<CR>:!php %<CR>
" test le fichier php
" autocmd FileType php noremap <C-L> :!php -l %<CR>
autocmd FileType php noremap <C-S> :wq!<CR>
" NERDTree Swat

set sw=4 ts=4 fdm=marker

nmap X ci"
nmap x ci'
nnoremap <silent> <buffer> <F9> set number!<CR>

nnoremap <silent> <buffer> <F2> :NERDTreeToggle<CR>
nnoremap <silent> <buffer> <F12> :call ToggleMouse()<CR>

source ~/.vim/php-doc.vim
nnoremap <silent> <buffer> <F9> :set paste<CR>:exe PhpDoc()<CR>:set nopaste<CR>i


" Insert <Tab> or complete identifier
" if the cursor is after a keyword character
function MyTabOrComplete()
    let col = col('.')-1
    if !col || getline('.')[col-1] !~ '\k'
         return "\<tab>"
    else
         return "\<C-N>"
    endif
endfunction
inoremap <Tab> <C-R>=MyTabOrComplete()<CR>



" Only do this part when compiled with support for autocommands.
if has("autocmd")
  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif
endif " has("autocmd")

" Activate the mouse
" set mouse=a

" This function will make a visual selection of the lines that have the same
" indent level or more as the current line.
function! SelectIndent ()
    let temp_var=indent(line("."))
    while indent(line(".")-1) >= temp_var
        exe "normal k"
    endwhile
    exe "normal V"
    while indent(line(".")+1) >= temp_var
        exe "normal j"
    endwhile
endfunction

" Toggle mouse on/off
function! ToggleMouse()
if &mouse == "a"
exe "set mouse="
echo "Mouse is off"
else
exe "set mouse=a"
echo "Mouse is on"
endif
endfunction

func Eatchar(pat)
    let c = nr2char(getchar())
    return (c =~ a:pat) ? '' : c
endfunc

" Abreviations
ab <? <?php
" ab xhtml11 <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-15\"?>\n"; ?><CR><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"<CR>"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><CR><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"><CR><head><CR><title></title><CR></head><CR><body><CR></body><CR></html>
ab smailheader /**<CR> * Project: Smail<CR> * File: $Id$<CR> *<CR> * @copyright (c)2010 WebStart<CR> * @package smail-www<CR> * @version 5.0<CR> */<CR>




