dotfiles/.vimrc

253 lines
7.4 KiB
VimL
Raw Normal View History

2014-07-29 16:55:49 -07:00
"NeoBundle Scripts-----------------------------
if has('vim_starting')
set nocompatible " Be iMproved
filetype off " turn this off for a minute
" Required:
set runtimepath+=/home/tgrosinger/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('/home/tgrosinger/.vim/bundle'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
NeoBundle 'tpope/vim-surround'
NeoBundle 'tpope/vim-commentary'
NeoBundle 'tpope/vim-repeat'
NeoBundle 'reedes/vim-wordy'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'idanarye/vim-merginal'
2014-07-29 16:55:49 -07:00
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'godlygeek/tabular'
NeoBundle 'Valloric/YouCompleteMe'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'Raimondi/delimitMate'
2015-02-25 14:19:51 -08:00
NeoBundle 'justinmk/vim-sneak'
NeoBundle 'blueyed/vim-diminactive'
" Tab Completion
NeoBundle 'ervandew/supertab'
NeoBundle 'sirver/ultisnips'
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>""
2014-07-29 16:55:49 -07:00
" Color Scheme
NeoBundle 'altercation/vim-colors-solarized'
" Tagbar
NeoBundle 'majutsushi/tagbar'
nnoremap <F8> :TagbarToggle<cr> " Toggle the tagbar
" Nerdtree
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'jistr/vim-nerdtree-tabs'
2014-12-11 09:29:19 -08:00
"let g:nerdtree_tabs_open_on_console_startup=1
2014-07-29 16:55:49 -07:00
nnoremap <F7> :NERDTreeTabsToggle<cr> " Toggle the NERDTree
" Airline
NeoBundle 'bling/vim-airline'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1 " Tab bar at top
set t_Co=256
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
if has('statusline')
set laststatus=2
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " Filetype
set statusline+=\ [%{getcwd()}] " Current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
2014-07-24 13:27:58 -07:00
" Golang Support
2014-07-29 16:55:49 -07:00
NeoBundle 'fatih/vim-go'
2014-07-24 13:27:58 -07:00
au FileType go nmap <Leader>gb <Plug>(go-doc)
au FileType go nmap <Leader>gd <Plug>(go-def-tab)
let g:go_fmt_command = "goimports"
2014-07-24 13:27:58 -07:00
" Python Support
2014-07-29 16:55:49 -07:00
NeoBundle 'klen/python-mode'
2014-07-24 13:27:58 -07:00
au FileType python let g:pymode_doc_bind = "<Leader>gb"
au FileType python let g:pymode_rope_goto_definition_bind = "<Leader>gd"
au FileType python let g:pymode_folding = 0
2014-07-24 13:27:58 -07:00
" Ctrl+P
2014-07-29 16:55:49 -07:00
NeoBundle 'kien/ctrlp.vim'
2014-07-24 13:27:58 -07:00
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files'],
\ },
\ 'fallback': 'find %s -type f'
\ }
2014-07-14 20:41:14 -07:00
NeoBundle 'tacahiroy/ctrlp-funky'
nnoremap <Leader>fu :CtrlPFunky<Cr>
let g:ctrlp_funky_syntax_highlight = 1
2014-07-29 16:55:49 -07:00
" Required:
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"End NeoBundle Scripts-------------------------
2014-07-14 20:41:14 -07:00
syntax on " Turn on syntax highlighting
set spell " Turn on spellchecking
set number " Turn on line numbers
set showmode " Display the current mode
set history=1000 " Greatly increase the size of the history (from 20)
set iskeyword-=. " '.' is an end of word designator
set iskeyword-=# " '#' is an end of word designator
set iskeyword-=- " '-' is an end of word designator
2014-07-29 16:55:49 -07:00
" Enable Ctrl+hjkl navigation between splits
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-H> <C-W>h<C-W>_
map <C-L> <C-W>l<C-W>_
2014-07-24 13:27:58 -07:00
let g:clang_user_options='|| exit 0'
2014-07-14 20:41:14 -07:00
2014-07-29 16:55:49 -07:00
cmap w!! w !sudo tee % >/dev/null
" JSON Support
nmap <leader>jt <Esc>:%!python -m json.tool<CR><Esc>:set filetype=json<CR>
2015-02-25 14:19:51 -08:00
autocmd BufNewFile,BufRead *.json set ft=javascript
2014-07-29 16:55:49 -07:00
2014-07-14 20:41:14 -07:00
"""
" Git Related Settings
"""
2014-07-29 16:55:49 -07:00
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
2014-07-14 20:41:14 -07:00
" Instead of reverting the cursor to the last position in the buffer, we
" set it to the first line when editing a git commit message
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
2014-07-29 16:55:49 -07:00
""
2014-07-14 20:41:14 -07:00
" Look and Feel
"""
set background=dark
2014-07-14 20:41:14 -07:00
set cursorline " Highlight the current line
2014-07-15 22:04:33 -07:00
set showmatch " Show matching brackets/parenthesis
set hlsearch " Highlight search terms
2014-07-14 20:41:14 -07:00
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
let g:CSApprox_hook_post = ['hi clear SignColumn']
highlight clear CursorLineNr " Remove highlight color from current line number
2014-07-24 13:27:58 -07:00
set textwidth=80
set colorcolumn=+1
2014-07-14 20:41:14 -07:00
2014-07-15 22:04:33 -07:00
set list " Highlight white-space characters
set listchars=tab:\ ,trail:•,extends:#,nbsp:. " but only the ones we don't want
2014-07-29 16:55:49 -07:00
set pastetoggle=<F6>
2014-07-14 20:41:14 -07:00
if filereadable(expand("~/.vim/bundle/vim-colors-solarized/colors/solarized.vim"))
2014-07-29 16:55:49 -07:00
let g:solarized_termcolors=256
2014-07-14 20:41:14 -07:00
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
color solarized
endif
highlight ColorColumn ctermbg=0 guibg=#eee8d5
2014-07-14 20:41:14 -07:00
2014-07-15 22:04:33 -07:00
" Command line
set wildmenu " Show a menu rather than auto-completing
" leader
let mapleader = ","
let g:mapleader = ","
" some shortcuts
:nmap \n :setlocal number!<CR>
:nmap \p :set paste!<CR>
" tabs
2014-07-24 13:27:58 -07:00
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
noremap <leader>0 :tablast<cr>
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>tt :tabnext<cr>
" moving between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" backup
set backup
set backupdir=$HOME/.vim/backups
set directory=$HOME/.vim/swaps
2014-07-29 16:55:49 -07:00
set undodir=$HOME/.vim/undo
2014-07-14 20:41:14 -07:00
if has('persistent_undo')
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
endif
" indenting
set tabstop=4
2012-11-09 20:44:06 -08:00
set softtabstop=4
set expandtab
set shiftwidth=4
set autoindent
set smartindent
2014-07-24 13:27:58 -07:00
" autocompletion
:inoremap <C-j> <Esc>/[)}"'\]>]<CR>:nohl<CR>a
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
2012-11-09 20:44:06 -08:00
" search
set ignorecase
set smartcase
set incsearch
2014-07-14 20:41:14 -07:00