Skip to content

Instantly share code, notes, and snippets.

@fedesilva
Created April 6, 2012 18:20
Show Gist options
  • Save fedesilva/2321831 to your computer and use it in GitHub Desktop.
Save fedesilva/2321831 to your computer and use it in GitHub Desktop.
vimrc
" pathogen
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
""""""""""""""""""""""""""""""""
" => General
""""""""""""""""""""""""""""""""
" require vim
set nocompatible
" autosave when switching files
set autowrite
" display current cursor position in lower right corner
set ruler
" keep the buffers open even with unsaved changes
set hidden
" Sets how many lines of history VIM has to remember
set history=700
" Enable filetype plugin
filetype plugin on
filetype indent on
" set line numbers
set number
" turn syntax highlighting on
syntax enable
" tab width
set shiftwidth=2
set tabstop=2
" indentation
set smartindent
set autoindent
" turn on autocompletion list
set wildmode=list:longest
" turn on code folding
set foldmethod=syntax
set foldnestmax=5
set foldlevel=50
set foldcolumn=1
" turn on search highlighting
set hlsearch
" better line wrapping
set wrap
set textwidth=79
set formatoptions=qrn1
" set our default shell to zsh
set shell=/bin/zsh
""""""""""""""""""""""""""""""""
" => Plugin Configuration and Conflict Resolution
""""""""""""""""""""""""""""""""
" make EasyMotion play nice with Command-T (maps everything to "m"+default)
let g:EasyMotion_leader_key = '<leader>m'
" change the default EasyMotion shading to something more readable with
" Solarized
hi link EasyMotionTarget ErrorMsg
hi link EasyMotionShade Comment
" show hidden files in NERDTree
let NERDTreeShowHidden=1
" auto flush Command-T when invoked
nmap <leader>T :CommandTFlush<cr>
" taglist config
let Tlist_Close_On_Select=1
let Tlist_Use_SingleClick=1
" ragtag
let g:ragtag_global_maps=1
""""""""""""""""""""""""""""""""
" => Autocommand config
""""""""""""""""""""""""""""""""
" automatically save .vimrc when it is edited
autocmd! bufwritepost $MYVIMRC source $MYVIMRC
" automatically compile coffeescript when saved
autocmd BufWritePost *.coffee silent CoffeeMake!
" automatically save/load code foldings
au BufWinLeave * silent! mkview
au BufWinEnter * silent! loadview
""""""""""""""""""""""""""""""""
" => Mappings
""""""""""""""""""""""""""""""""
" Fast editing of the .vimrc
nnoremap <leader>ev :e $MYVIMRC<cr>
" map command mode to spacebar
nnoremap <space> :
" map esc to jj
inoremap jj <esc>
" toggle NERDTree
nnoremap <leader>nt :NERDTreeToggle<cr>
" OSX, copy to system clipboard
vnoremap <C-c> y:call system("pbcopy", getreg("\""))<cr>
" show tags
nnoremap <leader>0 :TagbarToggle<cr>
" allow the . to execute once for each line of a visual selection
vnoremap . :normal .<cr>
""""""""""""""""""""""""""""""""
" => Color configuration
""""""""""""""""""""""""""""""""
" color scheme
set background=dark
colorscheme solarized
" text size
set guifont=Menlo:h11
""""""""""""""""""""""""""""""""
" => Editor view
""""""""""""""""""""""""""""""""
" show command in the bottom right portion of the screen
set showcmd
" hide the macvim toolbar by default
set go-=T
" hide the mouse when editing
set mousehide
""""""""""""""""""""""""""""""""
" => Window & Tab Management
""""""""""""""""""""""""""""""""
" Smart way to move btw. windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
""""""""""""""""""""""""""""""""
" => Filetype customizations
""""""""""""""""""""""""""""""""
" highlight SQL syntax inside strings
let php_sql_query=1
" highlight HTML syntax inside strings
let php_htmlInStrings=1
" enable folding for classes and functions
let php_folding=1
" enable folding for ruby
let ruby_fold=1
" enable javascript syntax folding
" function! JavaScriptFold()
" setl foldmethod=syntax
" setl foldlevelstart=1
" syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
"
" function! FoldText()
" return substitute(getline(v:foldstart), '{.*', '{...}', '')
" endfunction
" setl foldtext=FoldText()
" endfunction
" au FileType javascript call JavaScriptFold()
" au FileType javascript setl fen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment