dotfiles/vim/vimrc
2016-11-16 11:09:22 -06:00

259 lines
6.2 KiB
VimL

filetype detect
filetype plugin on
filetype indent on
" All those configuration variables
set autoindent
set autoread
set background=dark
set backspace=eol,start,indent
set colorcolumn=80,120
set cursorline
set encoding=utf8
set expandtab
set foldmethod=marker
set hidden
set history=1000
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set lazyredraw
set list
set listchars=tab:└─,trail:•
set magic
set mat=2
set nocindent
set nocompatible
set noerrorbells
set novisualbell
set number
set pastetoggle=<F2>
set relativenumber
set rtp+=~/.dotfiles/vendor/VundleVim/Vundle.vim
set shiftwidth=4
set showmatch
set showmode
set smartcase
set so=7
set softtabstop=4
set t_Co=256
set tabstop=4
set title
"set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)
set tm=500
set ttyfast
set undolevels=1000
set wildmenu
set wildmode=list:longest
" TODO: Should clean this shit up
" Sets up our filetypes
autocmd BufNewFile,BufRead *.dust,*.dustjs,*.tl set filetype=dustjs
autocmd BufNewFile,BufRead *.less set filetype=less
autocmd BufNewFile,BufRead nginx.conf set filetype=nginx
autocmd BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache
autocmd BufNewFile,BufRead *.handlebars,*.hbs set filetype=html.handlebars syntax=mustache
autocmd FileType javascript,dustjs,html.handlebars,css,scss setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType go setlocal noexpandtab
autocmd BufWritePost ~/.tmux.conf silent !tmux source-file ~/.tmux.conf
" Automatically wraps markdown and text to 80 columns
if &filetype == 'markdown' || &filetype == 'text'
set textwidth=80
set wrapmargin=2
else
set smartindent
set textwidth=0
endif
set backupdir=~/.vim/backup//,/tmp
set directory=~/.vim/swap//,/tmp
set undodir=~/.vim/undo//,/tmp
set undofile
call vundle#rc()
Plugin 'gmarik/vundle'
Plugin 'bling/vim-bufferline'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'dietsche/vim-lastplace'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'scrooloose/syntastic'
Plugin 'tomtom/tlib_vim'
Plugin 'vim-scripts/matchit.zip'
"Plugin 'SirVer/ultisnips'
"Plugin 'Valloric/YouCompleteMe'
" Colors
Plugin 'nanotech/jellybeans.vim'
Plugin 'vim-scripts/AfterColors.vim'
" Completion
Plugin 'ervandew/supertab'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
Plugin 'shawncplus/phpcomplete.vim'
" Syntax
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'groenewege/vim-less'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'jimmyhchan/dustjs.vim'
Plugin 'joshtronic/php.vim'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'pangloss/vim-javascript.git'
Plugin 'tmux-plugins/vim-tmux'
call vundle#end()
filetype plugin indent on
syntax enable
set background=dark
colorscheme jellybeans
autocmd BufEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhiteSpace /\s\+$/
" TODO: None of this seems to work
highlight ExtraWhitespace ctermbg=red guibg=red
highlight LineTooLong ctermbg=red guibg=red
match LineTooLong /\%121v.\+/
let mapleader = ','
let g:bufferline_echo = 0
autocmd VimEnter *
\ let &statusline='%{bufferline#refresh_status()}'
\ .bufferline#get_status_string()
" TODO: Confirm this shit. Also whitespace stuff
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
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 = 0
let b:match_words = '<:>,<tag>:</tag>'
let g:SuperTabDefaultCompletionType = 'context'
"let g:indent_guides_start_level = 2
"let g:indent_guides_guide_size = 1
" Auto pastetoggle
" let &t_SI .= "\<Esc>[?2004h"
" let &t_EI .= "\<Esc>[?2004l"
" inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
" Not entirely sure I need this. Auto pastetoggle within tmux
"
" function! XTermPasteBegin()
" set pastetoggle=<Esc>[201~
" set paste
" return ""
" endfunction
"
" function! WrapForTmux(s)
" if !exists('$TMUX')
" return a:s
" endif
"
" let tmux_start = "\<Esc>Ptmux;"
" let tmux_end = "\<Esc>\\"
"
" return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
" endfunction
"
" let &t_SI .= WrapForTmux("\<Esc>[?2004h")
" let &t_EI .= WrapForTmux("\<Esc>[?2004l")
"
" function! XTermPasteBegin()
" set pastetoggle=<Esc>[201~
" set paste
" return ""
" endfunction
"
" inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
vnoremap // y/<C-R>"<CR>
nmap <silent> ,/ :nohlsearch<CR>
nnoremap ; :
nnoremap <Leader>[ :bprevious<CR>
nnoremap <Leader>] :bnext<CR>
nmap <Leader>1 :buffer 1<CR>
nmap <Leader>2 :buffer 2<CR>
nmap <Leader>3 :buffer 3<CR>
nmap <Leader>4 :buffer 4<CR>
nmap <Leader>5 :buffer 5<CR>
nmap <Leader>6 :buffer 6<CR>
nmap <Leader>7 :buffer 7<CR>
nmap <Leader>8 :buffer 8<CR>
nmap <Leader>9 :buffer 9<CR>
nmap <Leader>0 :buffer 10<CR>
nnoremap <Leader>f :set nolist<CR>
nnoremap <Leader>F :set list<CR>
nnoremap <Leader>b :BundleUpdate<CR>:q<CR>
nnoremap <Leader>c :w<CR>:!wc %<CR>
nnoremap <Leader>v :so ~/.vim/vimrc<CR>
nnoremap <Leader>ss / $<CR>
nnoremap <Leader>tt /\t$<CR>
nnoremap <leader>d "_d
vnoremap <leader>d "_d
vnoremap <leader>p "_dP
" nnoremap <Leader>w :wa<CR>
" nnoremap <Leader>ww :wa!<CR>
" nnoremap <Leader>q :qa<CR>
syntax on
syntax sync fromstart
" Ignore some folders and files for CtrlP indexing
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.yardoc\|public$|log\|tmp$',
\ 'file': '\.so$\|\.dat$|\.DS_Store$'
\ }
" if executable('ag')
" let g:ctrlp_user_command = 'ag --ignore-case --nogroup --hidden --follow
" \ -U -p ~/.agignore
" \ -l -m 50000
" \ %s -g ""'
" endif
set gcr=a:block
" mode aware cursors
set gcr+=o:hor50-Cursor
set gcr+=n:Cursor
set gcr+=i-ci-sm:InsertCursor
set gcr+=r-cr:ReplaceCursor-hor20
set gcr+=c:CommandCursor
set gcr+=v-ve:VisualCursor
set gcr+=a:blinkon0
hi InsertCursor ctermfg=15 guifg=#fdf6e3 ctermbg=37 guibg=#2aa198
hi VisualCursor ctermfg=15 guifg=#fdf6e3 ctermbg=125 guibg=#d33682
hi ReplaceCursor ctermfg=15 guifg=#fdf6e3 ctermbg=65 guibg=#dc322f
hi CommandCursor ctermfg=15 guifg=#fdf6e3 ctermbg=166 guibg=#cb4b16