Skip to content

Instantly share code, notes, and snippets.

@bcremer
Created June 3, 2014 17:27
Show Gist options
  • Save bcremer/3ddb95248a622b04c501 to your computer and use it in GitHub Desktop.
Save bcremer/3ddb95248a622b04c501 to your computer and use it in GitHub Desktop.
My .vimrc
set nocompatible " Disable vi compability
filetype off " required!
" Init Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" Sensible defaults?
Bundle "tpope/vim-sensible"
" Syntaxt checks
Bundle 'scrooloose/syntastic'
" Solarized color scheme
Bundle "altercation/vim-colors-solarized"
" Fancy snippet machine, prerequisite for PDV
Bundle 'SirVer/ultisnips'
" Vmustache template engine, prerequisite for PDV
Bundle "tobyS/vmustache"
" PHP Documentor for VIM
Bundle "tobyS/pdv"
" New file skeletons
Bundle "tobyS/skeletons.vim"
" Rewrap argument lists
Bundle 'jakobwesthoff/argumentrewrap'
" Fuzzy search through project files
Bundle 'kien/ctrlp.vim'
" Expand region
Bundle 'terryma/vim-expand-region'
" Insert mode autocomplete management
Bundle "ervandew/supertab"
" Advanced Keyword completion
Bundle 'szw/vim-kompleter'
Bundle 'tpope/vim-commentary'
" Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-surround'
Bundle 'mileszs/ack.vim'
Bundle 'bling/vim-airline'
"Bundle 'airblade/vim-gitgutter'
" Required after Vundle did its job.
filetype plugin indent on " required!
" Automatically reload .vimrc if it is change
"if has("autocmd")
" autocmd bufwritepost .vimrc source $MYVIMRC
"endif
" Set shell, required if using fish
set shell=/bin/sh
" Disable wrap araound
set wrap!
syntax on
" Set color scheme
set background=dark
"set background=light
colorscheme solarized
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set encoding=utf-8
set scrolloff=5 " keep at least 5 lines above/below
set sidescrolloff=5 " keep at least 5 lines left/right
set showmode
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set ttyfast
set ruler
set cursorline " Hightlight current line
set backspace=indent,eol,start
set laststatus=2
set number
set nobackup
set noswapfile
set mouse=a " use mouse in visual mode only
set list listchars=tab:→\ ,trail:· " highlight traling spaces
set ignorecase " ignorecase & smartcase: if search-term is all lowercase search will be case insesitive
set smartcase " if not search will be case sensitive
set gdefault
set incsearch " Inremental Search
set showmatch " hlsearch highlight search results while typing
set hlsearch
"set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline), eg for powerline
" Disable Arrowkeys
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" Move cursor by display line
"noremap <buffer> <silent> k gk
"noremap <buffer> <silent> j gj
" Pressing < or > will let you indent/unident selected lines without deselect
" visual selection
vnoremap < <gv
vnoremap > >gv
" Save file as root using sudo
cnoremap w!! w !sudo tee % >/dev/null
" Remap jk to exit insertmode
inoremap jk <Esc>
" Automatically save all files when vim loses focus
" au FocusLost * :wa
" Map Leader key to custom commands
let mapleader = ","
" Quickly edit/reload the vimrc file
nnoremap <silent> <leader>ev :e $MYVIMRC<CR>
noremap <silent> <leader>sv :so $MYVIMRC<CR>
" MAp Leder to clear search highlight
nnoremap <leader><space> :nohl<cr>
nnoremap<leader>a :Ack <space>
" Pressing < or > will let you indent/unident selected lines without deselect
" visual selection
vnoremap < <gv
vnoremap > >gv
" Save file as root using sudo
cnoremap w!! w !sudo tee % >/dev/null
" Enhance Omnicompletion
" http://vim.wikia.com/wiki/VimTip1386
set completeopt=longest,menuone
" Completion options
set completeopt=menu,preview
" Default completion is "normal" (what my old PHP FT plugin did)
" let g:SuperTabDefaultCompletionType = "<c-p>"
" Set super tab completion to Kompleter
let g:SuperTabDefaultCompletionType = "<c-x><c-u>"
" Remove scrollbars toolbar and menu in gvim
if has('gui_running')
set guioptions-=T " Get rid of toolbar "
set guioptions-=m " Get rid of menu "
" scrollbars need to be removed separetly (bug?)
set guioptions-=l
set guioptions-=r
set guioptions-=b
set guifont=Consolas\ for\ Powerline\ 13
let g:airline_powerline_fonts = 1
endif
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_powerline_fonts=0
let g:airline_section_a='' " disable mode
let g:airline_section_z='' " disable line number
let g:pdv_template_dir = $HOME ."/.vim/bundle/pdv/templates_snip"
" Activate argument rewrap
nnoremap <leader>w :call argumentrewrap#RewrapArguments()<CR>
nnoremap <leader>p :call pdv#DocumentWithSnip()<CR>
" Expand region with v-v-v
vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)
" PHP expand objects
let g:expand_region_text_objects_php = {
\ 'iw' :0,
\ 'i"' :0,
\ 'i''' :0,
\ 'i]' :1,
\ 'ib' :1,
\ 'iB' :1
\ }
let g:ctrlp_max_files=0
let g:ctrlp_max_depth=40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment