Skip to content

Instantly share code, notes, and snippets.

@just-digital
Created February 20, 2012 08:33
Show Gist options
  • Save just-digital/1868435 to your computer and use it in GitHub Desktop.
Save just-digital/1868435 to your computer and use it in GitHub Desktop.
A .vimrc file for Drupal. Sets correct tabs configuration and a few other gems. Also includes function from Aron Novak (http://drupal.org/user/61864) sourced at http://vim.wikia.com/wiki/Remove_unwanted_spaces which will remove trailing white space upon
set nocompatible
syntax on
filetype on
filetype plugin on
filetype indent on
set sidescroll=1
set sidescrolloff=3
set wrap! "turn off wrapping
set showtabline=2
set title
set hlsearch
set incsearch
set ignorecase
set smartcase
set wildmenu
set wildmode=list:longest
set wildignore=*.svn
set scrolloff=3
set backspace=indent,eol,start
set backupdir=~/.vim-tmp,~/.tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,/tmp
set hidden
set tags=tags;~/
let mapeader = ","
set timeoutlen=300
imap lkj <ESC>
set history=1000
set showmatch
set matchtime=0
set shortmess=atI
set ruler
set showcmd
"smart indent
set smartindent
set number
set numberwidth=5
set cpoptions+=n
set tabstop=2
set shiftwidth=2
set expandtab
%retab 2
"autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
nnoremap <F2> :set invpaste paste?<CR>
nnoremap <F3> :NERDTreeToggle<CR>
nmap <S-h> gt
set pastetoggle=<F2>
set showmode
"color
set t_Co=256
au BufRead,BufNewFile *.json set filetype=json
au BufRead,BufNewFile *.html set filetype=htmldjango
au BufRead,BufNewFile *.install set filetype=php
au BufRead,BufNewFile *.profile set filetype=php
au BufRead,BufNewFile *.inc set filetype=php
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"set tags+=$HOME/.vim/tags/python.ctags
set tags=./tags
" automatically remove trailing whitespace before write
function! StripTrailingWhitespace()
normal mZ
%s/\s\+$//e
if line("'Z") != line(".")
echo "Stripped whitespace\n"
endif
normal `Z
endfunction
autocmd BufWritePre *.module,*.install,*.inc :call StripTrailingWhitespace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment