Skip to content

Instantly share code, notes, and snippets.

@simonswine
Created August 11, 2016 07:20
Show Gist options
  • Save simonswine/3529a594926553ceada281d650bcdb1c to your computer and use it in GitHub Desktop.
Save simonswine/3529a594926553ceada281d650bcdb1c to your computer and use it in GitHub Desktop.
.vimrc 2016-08-10
" .vimrc
"
" Install vundle
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"
" Launch vim and run
" :VundleInstall
" Disable compatability
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Let Vundle manage Vundle
Plugin 'gmarik/vundle'
" Making Vim look good
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
Plugin 'bling/vim-airline'
" Vim as a programmer's text editor: Nerdtree
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
" CustomTextobjects
Plugin 'kana/vim-textobj-user'
" Syntax checking
Plugin 'scrooloose/syntastic'
" JSON highlighting
Plugin 'elzr/vim-json'
" Gradle
Plugin 'tfnico/vim-gradle'
" Elixir
Plugin 'elixir-lang/vim-elixir'
" Haskell
Plugin 'lukerandall/haskellmode-vim'
" Tags
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
" Ctrl+P file search / suggestions
Plugin 'kien/ctrlp.vim'
" HTML parsing
Plugin 'lepture/vim-jinja'
" Git support
Plugin 'tpope/vim-fugitive'
" Enable spell check for commit messages
autocmd FileType gitcommit setlocal spell
" Puppet Plugins
Plugin 'rodjek/vim-puppet'
Plugin 'godlygeek/tabular'
" Ansible yaml
Plugin 'chase/vim-ansible-yaml'
" Saltstack plugin
Plugin 'saltstack/salt-vim'
" Python
Plugin 'klen/python-mode'
" Ruby
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-rake'
Plugin 'nelstrom/vim-textobj-rubyblock'
" Golang
Plugin 'fatih/vim-go'
" Easy sourrounding edits
Plugin 'tpope/vim-surround'
" Better default values
Plugin 'tpope/vim-sensible'
" Outlines
Plugin 'vimoutliner/vimoutliner'
" Latex
Plugin 'git://git.code.sf.net/p/vim-latex/vim-latex'
" Arduino
Plugin 'sudar/vim-arduino-syntax'
" Haskell
Plugin 'dag/vim2hs'
Plugin 'eagletmt/neco-ghc'
" Scala
Plugin 'derekwyatt/vim-scala'
filetype plugin indent on
let mapleader=","
" No temporary files in working directories
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set undodir=~/.vim/undo//
" General settings
set backspace=indent,eol,start
set number
set showcmd
set incsearch
set hlsearch
" Display position coordinates in bottom right
set ruler
" Abbreviate messages and disable intro screen
set shortmess=atI
" Get rid of omnicomplete doc preview
set completeopt=menu
" Automatically expand tabs into spaces
set expandtab
" Tabs are four spaces
set shiftwidth=4
set softtabstop=4
set tabstop=4
" Show whitespaces type
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
" Uncomment the next line if your terminal is not configured for solarized
"let g:solarized_termcolors=256
" Set the colorscheme
set background=dark
colorscheme solarized
"" vim-airline settings
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_detect_paste=1
" Airline for tabs
let g:airline#extensions#tabline#enabled = 1
"" nerdtree settings
" Open/close NERDTree Tabs with \t
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
" To have NERDTree always open on startup
let g:nerdtree_tabs_open_on_console_startup = 0
"" Syntastic
let g:syntastic_error_symbol = '✘'
let g:syntastic_warning_symbol = "▲"
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
augroup mySyntastic
au!
au FileType tex let b:syntastic_mode = "passive"
augroup END
"" vim-easytags settings
" Where to look for tags files
" Sensible defaults
let g:easytags_events = ['BufReadPost', 'BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1
" ----- majutsushi/tagbar settings -----
" Open/close tagbar with \b
nmap <silent> <leader>g :TagbarToggle<CR>
"" Language specific
" Highlight excess line length in python
autocmd FileType python highlight Excess ctermbg=8
autocmd FileType python match Excess /\%80v.*/
autocmd FileType python set nowrap
"
" Ruby Stuff
"
autocmd FileType ruby set shiftwidth=2
autocmd FileType ruby set softtabstop=2
autocmd FileType ruby set tabstop=2
"
" Yaml ident
"
autocmd FileType yaml set shiftwidth=2
autocmd FileType yaml set softtabstop=2
autocmd FileType yaml set tabstop=2
"
" Golang stuff
"
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
"
" Latex stuff
"
" LatexPDF and Okular
au BufEnter *.tex set autowrite
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_MultipleCompileFormats = 'pdf'
let g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*'
let g:Tex_GotoError = 0
let g:Tex_ViewRule_pdf = 'okular'
let g:Tex_Flavor='latex'
let g:tex_comment_nospell=1
" Use makefile
let g:Tex_UseMakefile=1
function! SyncTexForward()
let execstr = "silent !okular --unique %:p:r.pdf\\#src:".line(".")."%:p &"
exec execstr
endfunction
nmap <Leader>f :call SyncTexForward()<CR>
" Tex files spell check
autocmd BufNewFile,BufRead *.tex set spell spelllang=en_us spellfile=.spell.us.utf-8.add
" Tex hard-wrap
autocmd BufNewFile,BufRead *.tex set formatoptions=t1
autocmd BufNewFile,BufRead *.tex set textwidth=80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment