Last active
July 22, 2017 15:02
-
-
Save stevelove/a5946ea5b67eb7fe918bde02678a4397 to your computer and use it in GitHub Desktop.
This file contains 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
"""" | |
" General | |
"""" | |
set encoding=utf-8 | |
let mapleader = "," | |
set history=700 | |
" Monitor file for outside changes | |
set autoread | |
" Delete buffer without closing the window | |
nmap ,d :b#<bar>bd#<CR> | |
" Remap increment and decrement to use Alt instead of Ctrl | |
nnoremap <A-a> <C-a> | |
nnoremap <A-x> <C-x> | |
" Vundle | |
set nocompatible | |
filetype off | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" other plugins | |
Plugin 'elixir-lang/vim-elixir' | |
Plugin 'mattreduce/vim-mix' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-cucumber' | |
Plugin 'tpope/vim-surround' | |
Plugin 'tpope/vim-endwise' | |
Plugin 'tpope/vim-markdown' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'majutsushi/tagbar' | |
Plugin 'ervandew/supertab' | |
Plugin 'ap/vim-css-color' | |
Plugin 'godlygeek/tabular' | |
Plugin 'hail2u/vim-css3-syntax' | |
Plugin 'othree/html5.vim' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'kien/rainbow_parentheses.vim' | |
Plugin 'baeuml/summerfruit256.vim' | |
Plugin 'tomasr/molokai' | |
Plugin 'morhetz/gruvbox' | |
Plugin 'myusuf3/numbers.vim' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
Plugin 'vim-scripts/FindFile' | |
Plugin 'vim-scripts/mediawiki' | |
Plugin 'pbrisbin/vim-syntax-shakespeare' | |
Plugin 'powerman/vim-plugin-AnsiEsc' | |
Plugin 'C64.vim' | |
Plugin 'lambdatoast/elm.vim' | |
Plugin 'vim-scripts/abnf' | |
Plugin 'vim-scripts/matchit.zip' | |
Plugin 'fatih/vim-go' | |
Plugin 'vim-scripts/AdvancedSorters' | |
call vundle#end() | |
filetype plugin indent on | |
" NERDTree | |
autocmd VimEnter * NERDTree | |
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() | |
function! s:CloseIfOnlyNerdTreeLeft() | |
if exists("t:NERDTreeBufName") | |
if bufwinnr(t:NERDTreeBufName) != -1 | |
if winnr("$") == 1 | |
q | |
endif | |
endif | |
endif | |
endfunction | |
" Set working dir to current file's directory | |
map <leader>r :NERDTreeFind<cr> | |
nmap <F8> :TagbarToggle<CR> | |
"""" | |
" UI | |
"""" | |
set so=7 | |
set wildmenu | |
set ruler | |
set cmdheight=2 | |
set hid | |
set number | |
set numberwidth=5 | |
set cpoptions+=n | |
set colorcolumn=80 | |
set textwidth=80 | |
" Highlight current line only in insert mode | |
au InsertLeave * set nocursorline | |
au InsertEnter * set cursorline | |
" Backspace config | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l | |
set ignorecase " ignore case when searching | |
set smartcase | |
set hlsearch " Highlight search things | |
set incsearch " Use incremental search | |
set nolazyredraw " Don't redraw while executing macros | |
set magic " Set magic on for regular expressions | |
set showmatch " Show matching brackets | |
set mat=2 " How many tenths of a second to blink | |
" No sound on errors | |
set noerrorbells | |
set novisualbell | |
set t_vb= | |
set tm=500 | |
syntax enable | |
try | |
colors molokai | |
catch /^Vim\%((\a\+)\)\=:E185/ | |
colors default | |
endtry | |
" Backups | |
set nobackup | |
set nowritebackup | |
set nowb | |
set noswapfile | |
" Surround current word or visually selected word with double quotes | |
nnoremap <leader>" ciw<C-r>""<Esc> | |
vnoremap <leader>" c"<C-r>""<Esc> | |
" Buffer navigation | |
nnoremap <leader>k <C-w><Up> | |
nnoremap <leader>j <C-w><Down> | |
nnoremap <leader>l <C-w><Right> | |
nnoremap <leader>h <C-w><Left> | |
" Persistent undo | |
try | |
set undodir=~/.vim_runtime/undodir | |
set undofile | |
catch | |
endtry | |
" Tabs and indents | |
set expandtab | |
set shiftwidth=4 | |
set tabstop=4 | |
set smarttab | |
set lbr | |
set tw=500 | |
set ai " Auto indent | |
set si " Smart indent | |
set wrap " Wrap lines | |
"""" | |
" Cucumber | |
"""" | |
" Tables | |
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) | |
endif | |
endfunction | |
augroup FiletypeOptions | |
au! | |
au FileType ruby,haml,eruby setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType cucumber setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType vim,gitconfig setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType build,xml setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType javascript setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType html,css setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType scala setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType elm setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType markdow setlocal autoindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType elixir setlocal keywordprg=/opt/eh | |
augroup END | |
au BufRead *_spec.rb syn keyword rubyRspec describe context it specify it_should_behave_like before after setup subject its shared_examples_for shared_context let | |
highlight def link rubyRspec Function | |
" Wiki | |
au BufRead,BufNewFile *.wiki set filetype=mediawiki | |
au BufRead,BufNewFile *.wikipedia.org* set filetype=mediawiki | |
au BufRead,BufNewFile *.wikibooks.org* set filetype=mediawiki | |
au BufRead,BufNewFile *.wikimedia.org* set filetype=mediawiki | |
" Replace a word under cursor globally | |
nnoremap <Leader>a :%s/\<<C-r><C-w>\>/ | |
" Replace a word under cursor in a line | |
nnoremap <Leader>s :s/\<<C-r><C-w>\>/ | |
" Change cursor shape in different modes | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
" Insert formatted date | |
:nnoremap <F5> "=strftime("%FT%T%z")<CR>P | |
:inoremap <F5> <C-R>=strftime("%FT%T%z")<CR> | |
" Highlight TODO, FIXME, OPTIMIZE, HACK, REVIEW | |
augroup HighlightTODO | |
autocmd! | |
autocmd WinEnter,VimEnter * :silent! call matchadd('Todo', 'TODO\|FIXME\|OPTIMIZE\|HACK\|REVIEW', -1) | |
augroup END | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 1 | |
let g:syntastic_css_checkers = ['stylelint'] | |
let g:syntastic_css_stylelint_exec = 'css-standard' | |
au BufRead,BufNewFile *.js let g:syntastic_javascript_checkers = ['standard'] | |
let NERDSpaceDelims = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment