Skip to content

Instantly share code, notes, and snippets.

@Gronghon
Created February 17, 2013 14:32
Show Gist options
  • Save Gronghon/4971713 to your computer and use it in GitHub Desktop.
Save Gronghon/4971713 to your computer and use it in GitHub Desktop.
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
let g:pathogen_disabled = ['vim-fuzzyfinder', 'vim-tabbar', 'vim-neocomplcache', 'vim-phpfolding', 'vim-neocomplcache', 'vim-neocomplcache-snippets-complete', 'vim-minibufexpl']
"let g:pathogen_disabled = ['vim-fuzzyfinder', 'vim-tabbar', 'vim-minibufexpl']
call pathogen#infect()
call pathogen#helptags()
let mapleader = ","
let maplocalleader = ","
filetype on " Recognize syntax by file extension.
filetype indent on " Check for indent file.
filetype plugin on " Allow plugins to be loaded by file type.
" Plugins {
" PIV {
let g:DisableAutoPHPFolding = 0
let g:PIVAutoClose = 0
" }
" }
set enc=utf-8
setglobal fileencoding=utf-8
set encoding=utf-8
set showmatch " show matching bracket (briefly jump)
set showmode " show mode in status bar (insert/replace/...)
set showcmd " show typed command in status bar
set ruler " show cursor position in status bar
set title " show file in titlebar
set wildmenu " completion with menu
set confirm " get a dialog when :q, :w, or :wq fails
set wildignore=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn
set laststatus=2 " use 2 lines for the status bar
set lines=50
set columns=160
set history=300
set tabstop=4
set softtabstop=4
set shiftwidth=4 "Indent by 4 spaces when using >>, <<, == etc.
set number
set noexpandtab "Use softtabstop spaces instead of tab characters for indentation
set ignorecase
set incsearch
set autochdir
set cursorline
set backspace=2
set nohidden
set linespace=3
set autoindent "Keep indentation from previous line
set smartindent "Automatically inserts indentation in some cases
set cindent "Like smartindent, but stricter and more customisable
set nowrap
set list
set list listchars=tab:\|\ ,trail:.
" disable creation of swap files
set noswapfile
" no back ups wwhile editing
set nowritebackup
" disable creation of backups
set nobackup
"set backupdir=.\vimtmp
"set directory=.\vimtmp
"colorscheme xoria256 "http://www.vim.org/scripts/script.php?script_id=2140
"colorscheme zenburn
colorscheme wombat
" convert spaces to tabs when reading file
autocmd! bufreadpost * set noexpandtab | retab! 4
" convert tabs to spaces before writing file
autocmd! bufwritepre * set expandtab | retab! 4
" convert spaces to tabs after writing file (to show guides again)
autocmd! bufwritepost * set noexpandtab | retab! 4
" ctrlp
let g:ctrlp_map = '<F4>'
let g:ctrlp_custom_ignore = {'dir': 'cache\|compile\|\.git$\|\.hg$\|\.svn$', 'file': '\.exe$\|\.so$\|\.dll$', 'link': 'some_bad_symbolic_links'}
let g:ctrlp_working_path_mode = 'r'
let g:ctrlp_root_markers = ['.ctrlp']
let g:ctrlp_cmd = 'CtrlP'
"omnicomplete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType php5 set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType yaml setlocal ts=4 sts=4 sw=4 expandtab
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let php_sql_query=1
let php_htmlInStrings=1
" neocomplcache
"let g:acp_enableAtStartup = 0
"let g:neocomplcache_enable_at_startup = 1
"let g:neocomplcache_enable_smart_case = 1
"let g:neocomplcache_enable_camel_case_completion = 1
"let g:neocomplcache_enable_underbar_completion = 1
"let g:neocomplcache_min_syntax_length = 3
"let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
"let g:neocomplcache_enable_auto_select = 1
" Define keyword.
"if !exists('g:neocomplcache_keyword_patterns')
" let g:neocomplcache_keyword_patterns = {}
"endif
"let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Close tags
imap ,/ </<C-X><C-O>
"project
let g:proj_window_width = 24
let g:proj_flags = "imstg"
"MRU
let MRU_File = $VIM.'/vimfiles/_vim_mru_files'
let MRU_Window_Height = 15
let MRU_Max_Entries = 100
let MRU_Auto_Close = 1
"taglist
let Tlist_Ctags_Cmd = $VIMRUNTIME.'/ctags.exe'
let Tlist_Use_Right_Window = 1
"session
let SessionSaveDirectory = $VIM.'/vimfiles/sessions/'
" Buffergator
let g:buffergator_viewport_split_policy = 'T'
let g:buffergator_split_size = 7
let g:buffergator_autoexpand_on_split = 0
" NERDTree
let g:NERDTreeShowBookmarks=1
" easygrep
let g:EasyGrepRecursive=1
" powerline
let g:Powerline_symbols = 'fancy'
nnoremap <silent> <F2> :NERDTreeToggle<CR>
nnoremap <silent> <F3> :BuffergatorToggle<CR>
"nnoremap <silent> <F4> :FufCover,tageFile<CR>
nnoremap <silent> <F5> :TlistToggle<CR>
nnoremap <silent> <F6> :MRU<CR>
nmap <silent> <F7> <Plug>ToggleProject
map <F9> <Esc>:pwd<Cr>
nnoremap <silent> <F11> :SessionSave<CR>
nnoremap <silent> <F12> :SessionRestore<CR>
"map <F6> <Esc>:EnableFastPHPFolds<Cr>
"map <F7> <Esc>:EnablePHPFolds<Cr>
"map <F8> <Esc>:DisablePHPFolds<Cr>
inoremap <c-space> <c-x><c-o>
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
if has('gui_running')
"set guifont=Tamsyn8x15
set guifont=Consolas:h9
" Remove menu bar
"set guioptions-=m
" Remove toolbar
set guioptions-=T
endif
" Remove trailing white-space once the file is saved
au BufWritePre * silent g/\s\+$/s///
function! g:ToggleNuMode()
if(&rnu == 1)
set nu
else
set rnu
endif
endfunc
nnoremap <C-L> :call g:ToggleNuMode()<cr>
"command GREP :execute 'vimgrep /'.expand('<cword>').'/gj **' | copen
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment