" /etc/vim/vimrc, ~/.vimrc or ~/.exrc
" VIM Configuration File
" Made by Pierre Mavro
" Version 0.3
" Show matching parentheses
set showmatch
" Number the lines
set number
" Try to keep the cursor in the same column when changing lines
set nostartofline
" Auto-completion options
setwildmode=list:full
" Always keep one visible line above the cursor on the screen
set scrolloff=1
" Euro encoding with accents
setenc=UTF-8
" Character font for Gvim that supports the euro symbol
set guifont=-misc-fixed-medium-r-semicondensed-*-*-111-75-75-c-*-iso8859-15
" Activate syntax highlighting
syntax on
" Use the standard color scheme
colorscheme default
" Display cursor position 'line,column'set ruler
" Searches are not 'case sensitive'
set ignorecase
" Highlight searched expressions
set hlsearch
" Tabulation section
set autoindent
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
" Message functionfunction! s:DisplayStatus(msg) echohl Todo
echo a:msg
echohl None
endfunction
" Mouse state mode
let s:mouseActivation = 1
" Activating / Desactivating mouse mode
function! ToogleMouseActivation()if(s:mouseActivation)let s:mouseActivation =0setmouse=n
set paste
call s:DisplayStatus('Paste Mode Desactivated')elselet s:mouseActivation =1setmouse=a
set nopaste
call s:DisplayStatus('Paste Mode Activated') endif
endfunction
" Activating mouse mode by default
"setmouse=a
set paste
" Cleaning function
" Call this function: ':call Clean()'function! Clean() %retab
%s/^M//g
%s/\s\+$//
call s:DisplayStatus('Code cleaned')endfunction
" Advanced completion
" Use: 'Ctrl+x & Ctrl+o | Ctrl+x & Ctrl+k | Ctrl+x & Ctrl+n'function! MultipleAutoCompletion()if &omnifunc !=''return"\<C-x>\<C-o>" elseif &dictionary !=''return"\<C-x>\<C-k>"elsereturn"\<C-x>\<C-n>" endif
endfunction
" Fold function
function! MyFoldFunction()
let line = getline(v:foldstart)
let sub = substitute(line, '/\*\|\*/\|^\s+', '', 'g')
let lines = v:foldend - v:foldstart + 1
return '[+] '. v:folddashes.sub . '...' . lines . 'lines...' .
getline(v:foldend)
endfunction
" Activate Fold function" Use: za (open or close), zm (close all) or zr (close zr)
set foldenable
set fillchars=fold:=
set foldtext=MyFoldFunction()
" Comment / Uncomment with # or //" Use: Shift+v, select wished lines and press F5 or F6
map <F5> :s.^.#. <CR> :noh <CR>
map <F6> :s.^#.. <CR> :noh <CR>
" Use: Shift+v, select wished lines and press F7 or F8
map <F7> :s.^.\/\/. <CR> :noh <CR>
map <F8> :s.^\/\/.. <CR> :noh <CR>
" Indent or not from 4 spaces
" Use: Shift+v, select wished lines and press F3 or F4
map <F3> :s.^ .. <CR> :noh <CR>
map <F4> :s.^. . <CR> :noh <CR>
This should be placed in ~/.exrc. You will then have auto-indentation, line numbering, etc.