" Vundle configuration
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'sjbach/lusty.git'
Plugin 'kien/ctrlp.vim.git'
Plugin 'arnaud-lb/vim-php-namespace.git'
Plugin 'Lokaltog/vim-powerline.git'
Plugin 'tpope/vim-fugitive.git'
" Here should be other plugins
" Bundle 'joonty/vim-phpqa.git'
Bundle 'tobyS/pdv'
Bundle 'danro/rename.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype on
filetype plugin on
filetype indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Basics
set t_Co=256
colorscheme molokai
syntax on
set number
set tabstop=4
set expandtab
set smartindent
"set autoindent
set shiftwidth=4
set directory=/tmp/
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set wildmenu " Better completion
set wildmode=list:longest " BASH style completion
set wildignore=.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc,*.pyo,*.log,**/cache/**,**/logs/**,**/zend/**,**/vendor/**/vendor/**,web/css,web/js,web/bundles,*/project/*,*/target/*,*.hi
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
" Is cool in order to paste from the terminal, but drop the indentation
" could be use on a distant server
"set paste
set hidden
set showcmd
" Tags
:set tags+=vendor.tags
nnoremap <F7> :!ctags -h ".php" --PHP-kinds=+cf --recurse --exclude="*/cache/*" --exclude="*/logs/*" --exclude="*/data/*" --exclude="\.git" --exclude="\.svn" --languages=PHP
" Automatic folder creation
au BufWrite * :call <SID>MkdirsIfNotExists(expand('<afile>:h'))
function! <SID>MkdirsIfNotExists(directory)
if(!isdirectory(a:directory))
call system('mkdir -p '.shellescape(a:directory))
endif
endfunction
let mapleader=","
" Use the htmljinja syntax for twig files
au BufNewFile,BufRead *.twig set ft=htmljinja
" Remove trailing whitespaces and ^M chars
autocmd FileType c,cpp,java,php,js,css,html,xml,yml,vim,twig autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
" In order to have right colors on tmux
if !has("gui_running")
set term=screen-256color
endif
" Make CTRLP checking tags
noremap <silent> <C-t> :CtrlPTag<cr>
" Add php namespace plugin
" Add a `use` statement while tapping `,u`
inoremap <Leader>u <C-O>:call PhpInsertUse()<CR>
noremap <Leader>u :call PhpInsertUse()<CR>
" esay copy-paste clipboard
vmap <Leader>y "+y<CR>
nmap <leader>p "+p<CR>
" easy navigation between words
nmap <C-l> w
nmap <C-h> b
nmap <C-j> 4j
nmap <C-k> 4k
" Clear search highlight
nmap <silent> <leader>/ :let @/=""<cr>
" Powerline protip
let g:Powerline_symbols = 'fancy'
set ls=2 " Always show status bar
" This function allow to toggle settings for line in files (from absolute to
" relative)
function! NumberToggle()
if(&relativenumber == 1)
"set number
set norelativenumber
else
set relativenumber
endif
endfunc
" Mapping of the last function on CTRL+N
nnoremap <C-n> :call NumberToggle()<cr>