Created
August 25, 2014 02:15
-
-
Save rattlion/0500795af579c443daab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Maintained by Matt Ryan <[email protected]> | |
" Vundle {{{ | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#begin() | |
" let vundle manage vundle | |
Bundle 'gmarik/vundle' | |
" vim-scripts repos | |
Bundle "PDV--phpDocumentor-for-Vim" | |
Bundle 'L9' | |
Bundle 'YankRing.vim' | |
Bundle 'vim-json-bundle' | |
" github repos | |
Bundle '2072/PHP-Indenting-for-VIm' | |
Bundle 'Arkham/vim-quickfixdo' | |
Bundle 'Lokaltog/vim-powerline' | |
Bundle 'MarcWeber/vim-addon-mw-utils' | |
Bundle 'Raimondi/delimitMate' | |
Bundle 'StanAngeloff/php.vim' | |
Bundle 'cakebaker/scss-syntax.vim' | |
Bundle 'chriskempson/base16-vim' | |
Bundle 'edsono/vim-matchit' | |
Bundle 'garbas/vim-snipmate' | |
Bundle 'godlygeek/tabular' | |
Bundle 'henrik/vim-open-url' | |
Bundle 'itspriddle/vim-marked' | |
Bundle 'jelera/vim-javascript-syntax' | |
Bundle 'kana/vim-textobj-user' | |
Bundle 'kchmck/vim-coffee-script' | |
Bundle 'kien/ctrlp.vim' | |
Bundle 'mattn/gist-vim' | |
Bundle 'mattn/webapi-vim' | |
Bundle 'mhinz/vim-signify' | |
Bundle 'mileszs/ack.vim' | |
Bundle 'mrevd/vim-insert-image' | |
Bundle 'nelstrom/vim-textobj-rubyblock' | |
Bundle 'othree/html5.vim' | |
Bundle 'pangloss/vim-javascript' | |
Bundle 'rizzatti/dash.vim' | |
Bundle 'scrooloose/nerdcommenter' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'scrooloose/syntastic' | |
Bundle 'sunaku/vim-ruby-minitest' | |
Bundle 'terryma/vim-multiple-cursors' | |
Bundle 'thoughtbot/vim-rspec' | |
Bundle 'tomtom/tlib_vim' | |
Bundle 'tpope/vim-bundler' | |
Bundle 'tpope/vim-dispatch' | |
Bundle 'tpope/vim-endwise' | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'tpope/vim-liquid' | |
Bundle 'tpope/vim-markdown' | |
Bundle 'tpope/vim-rails.git' | |
Bundle 'tpope/vim-rake' | |
Bundle 'tpope/vim-repeat' | |
Bundle 'tpope/vim-surround' | |
Bundle 'tpope/vim-unimpaired' | |
Bundle 'vim-ruby/vim-ruby' | |
call vundle#end() | |
filetype plugin indent on | |
"}}} | |
" VIM behaviour {{{ | |
let mapleader="," | |
set showmode | |
set nowrap | |
set tabstop=2 | |
set softtabstop=2 | |
set expandtab | |
set shiftwidth=2 | |
set shiftround | |
set backspace=indent,eol,start | |
set autoindent | |
set copyindent | |
set number | |
set showmatch | |
set ignorecase | |
set smartcase | |
set smarttab | |
set scrolloff=4 | |
set virtualedit=all | |
set hlsearch | |
set incsearch | |
set nolist | |
set pastetoggle=<F2> | |
set mouse=a | |
set fileformats= | |
set formatoptions+=1 | |
set shell=sh | |
set hidden | |
set switchbuf=useopen | |
set history=100 | |
set undolevels=1000 | |
if v:version >= 730 | |
set undofile | |
set undodir=~/.vim/.undo,~/tmp,/tmp | |
endif | |
set nobackup | |
set noswapfile | |
set wildmenu | |
set wildmode=list:full | |
set wildignore+=tags | |
set visualbell | |
set noerrorbells | |
set showcmd | |
set nomodeline | |
set cursorline | |
set clipboard=unnamed | |
set linebreak | |
set synmaxcol=800 | |
set ttyfast | |
set dictionary+=/usr/share/dict/words | |
set viminfo+=n~/.vim/.viminfo/viminfo | |
set completefunc=syntaxcomplete#Complete | |
autocmd CursorMovedI * if pumvisible() == 0|silent! pclose|endif | |
autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif | |
nnoremap ; : | |
nnoremap <C-e> 2<C-e> | |
nnoremap <C-y> 2<C-y> | |
nnoremap j gj | |
nnoremap k gk | |
vnoremap j gj | |
vnoremap k gk | |
" Jump to matching pairs easily, with space | |
nmap <Space> % | |
vmap <Space> % | |
" Kill window and fast buffer navigaion | |
noremap K <C-w>c | |
noremap <C-h> <C-w>h | |
noremap <C-j> <C-w>j | |
noremap <C-k> <C-w>k | |
noremap <C-l> <C-w>l | |
" increment and decrement | |
nnoremap <leader>i <C-a> | |
nnoremap <leader>I <C-x> | |
" Edit the snippets file | |
nmap <silent> <leader>es :vsp $HOME/.vim/snippets/_.snippets<CR> | |
" Restore cursor position upon reopening files | |
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |
" Remove straing whitespace on save | |
autocmd BufWritePre * :%s/\s\+$//e | |
let g:netrw_home="~/.vim/.tmp" | |
" Folding {{{ | |
set foldmethod=marker foldlevel=0 | |
"}}} | |
" }}} | |
" VIM appearance {{{ | |
if has("gui_running") | |
set guioptions=egmt | |
set guifont=Monaco\ for\ Powerline:h12 | |
endif | |
set background=dark | |
colorscheme base16-default | |
syntax on | |
set termencoding=utf-8 | |
set encoding=utf-8 | |
set laststatus=2 | |
set cmdheight=2 | |
set title | |
" cursor appearance in insert mode | |
let &t_SI = "\<Esc>[5 q" | |
let &t_EI = "\<Esc>[0 q" | |
" }}} | |
" VIM plugins {{{ | |
" RSpec.vim mappings {{{ | |
map <Leader>t :call RunCurrentSpecFile()<CR> | |
map <Leader>s :call RunNearestSpec()<CR> | |
map <Leader>l :call RunLastSpec()<CR> | |
map <Leader>a :call RunAllSpecs()<CR> | |
let g:rspec_command = "Dispatch rspec {spec}" | |
" }}} | |
" NERDTree settings {{{ | |
" Put focus to the NERD Tree with F3 (tricked by quickly closing it and | |
" immediately showing it again, since there is no :NERDTreeFocus command) | |
nmap <leader>n :NERDTreeClose<CR>:NERDTreeToggle<CR> | |
nmap <leader>m :NERDTreeClose<CR>:NERDTreeFind<CR> | |
nmap <leader>N :NERDTreeClose<CR> | |
" Store the bookmarks file | |
let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks") | |
" Show the bookmarks table on startup | |
let NERDTreeShowBookmarks=1 | |
" Show hidden files, too | |
let NERDTreeShowFiles=1 | |
let NERDTreeShowHidden=1 | |
" Quit on opening files from the tree | |
let NERDTreeQuitOnOpen=1 | |
" Highlight the selected entry in the tree | |
let NERDTreeHighlightCursorline=1 | |
" Use a single click to fold/unfold directories and a double click to open files | |
let NERDTreeMouseMode=2 | |
" Don't display these kinds of files | |
let NERDTreeIgnore=[ '^\.git$', '\.DS_Store' ] | |
" }}} | |
" PHP Doc {{{ | |
inoremap <leader>pd <ESC>:call PhpDocSingle()<CR>i | |
nnoremap <leader>pd :call PhpDocSingle()<CR> | |
vnoremap <leader>pd :call PhpDocRange()<CR> | |
"}}} | |
" CTRL-P {{{ | |
let g:ctrlp_working_path_mode = '0' | |
let g:ctrlp_show_hidden = 1 | |
let g:ctrlp_custom_ignore = '.DS_Store\|.sass-cache\|bower_components\|node_modules\|\v[\/]\.(git|hg|svn)$' | |
"}}} | |
" Powerline {{{ | |
let g:Powerline_symbols = 'fancy' | |
let g:Powerline_colorscheme = 'solarized256' | |
"}}} | |
" Syntastic {{{ | |
let g:syntastic_check_on_open=1 | |
let g:syntastic_error_symbol='✗' | |
let g:syntastic_warning_symbol='⚠' | |
let g:syntastic_mode_map = { 'mode': 'active', | |
\ 'active_filetypes': [], | |
\ 'passive_filetypes': ['html', 'xhtml'] } | |
let g:syntastic_stl_format = '[%E{%e Errors}%B{, }%W{%w Warnings}]' | |
let g:syntastic_php_checkers=['php'] | |
" }}} | |
" Yankring {{{ | |
let g:yankring_history_dir = '$HOME/.vim/.tmp' | |
nmap <leader>r :YRShow<CR> | |
function! YRRunAfterMaps() | |
vmap y ygv<Esc> | |
endfunction | |
" }}} | |
" Gist-vim {{{ | |
let g:gist_clip_command = 'pbcopy' | |
let g:gist_detect_filetype = 1 | |
let g:gist_open_browser_after_post = 1 | |
" }}} | |
" Tabular wrapper for TabFirst {{{ | |
command! -nargs=1 -range TabFirst exec <line1> . ',' . <line2> . 'Tabularize /^[^' . escape(<q-args>, '\^$.[?*~') . ']*\zs/l0r1' | |
"}}} | |
" Dash {{{ | |
nmap <silent> <leader>d <Plug>DashGlobalSearch | |
"}}} | |
" Snipmate {{{ | |
let g:snipMate = {} | |
let g:snipMate.scope_aliases = {} | |
let g:snipMate.scope_aliases['scss'] = 'css' | |
"}}} | |
"}}} | |
" FileType {{{ | |
if has("autocmd") | |
" Drupal *.module and *.install files. | |
augroup module | |
autocmd BufRead,BufNewFile *.module set filetype=php | |
autocmd BufRead,BufNewFile *.install set filetype=php | |
autocmd BufRead,BufNewFile *.test set filetype=php | |
autocmd BufRead,BufNewFile *.inc set filetype=php | |
autocmd BufRead,BufNewFile *.profile set filetype=php | |
autocmd BufRead,BufNewFile *.view set filetype=php | |
augroup END | |
augroup conf | |
autocmd BufRead,BufNewFile *.symlink set filetype=zsh | |
augroup END | |
augroup sh | |
autocmd BufRead,BufNewFile .profile set filetype=sh | |
augroup END | |
augroup crontab | |
set nowritebackup | |
augroup end | |
augroup apache | |
autocmd BufRead,BufNewFile httpd-vhosts.conf set filetype=apache | |
augroup end | |
augroup liquid | |
autocmd BufNewFile,BufReadPost *.fr.liquid let b:liquid_subtype = 'html' | |
augroup end | |
augroup text | |
autocmd BufWritePre *.php,*.html :%s/“/"/e | |
autocmd BufWritePre *.php,*.html :%s/”/"/e | |
autocmd BufWritePre *.php,*.html :%s/‘/'/e | |
autocmd bufwritepre *.php,*.html :%s/’/'/e | |
augroup end | |
augroup dots | |
autocmd BufRead,BufNewFile vimrc.symlink set filetype=vim | |
augroup end | |
endif | |
"}}} | |
" Misc mappings {{{ | |
cmap w!! %!sudo tee > /dev/null % | |
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc> | |
" Reselect pasted block | |
nnoremap <leader>gp `[v`] | |
" Edit the vimrc file | |
nmap <silent> <leader>ev :e ~/.dotfiles/vim/vimrc.symlink<CR> | |
nmap <silent> <leader>sv :so $MYVIMRC<CR> | |
" Clears the search register | |
nmap <silent> <leader>/ :nohlsearch<CR> | |
" Pull word under cursor into LHS of a substitute (for quick search and replace) | |
nmap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\># | |
iab lorem Lorem ipsum dolor sit amet, consectetur adipiscing elit | |
iab llorem Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam lacus ligula, accumsan id imperdiet rhoncus, dapibus vitae arcu. Nulla non quam erat, luctus consequat nisi | |
iab lllorem Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam lacus ligula, accumsan id imperdiet rhoncus, dapibus vitae arcu. Nulla non quam erat, luctus consequat nisi. Integer hendrerit lacus sagittis erat fermentum tincidunt. Cras vel dui neque. In sagittis commodo luctus. Mauris non metus dolor, ut suscipit dui. Aliquam mauris lacus, laoreet et consequat quis, bibendum id ipsum. Donec gravida, diam id imperdiet cursus, nunc nisl bibendum sapien, eget tempor neque elit in tortor | |
"}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment