Skip to content

Instantly share code, notes, and snippets.

@mhoffman
Created August 24, 2016 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhoffman/8720010b3826af951b2dfdfb892a441c to your computer and use it in GitHub Desktop.
Save mhoffman/8720010b3826af951b2dfdfb892a441c to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"" Plugin Manager
Plugin 'gmarik/Vundle.vim'
"" Meta/Navigation
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlp.vim'
Plugin 'vim-scripts/closetag.vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'fugitive.vim' " Git bindings
Plugin 'browsereload-mac.vim'
Plugin 'WebAPI.vim'
Plugin 'Gist.vim' " Create git gists from buffer, need WebAPI
Plugin 'lrvick/Conque-Shell' " Open Shells in buffer
Plugin 'Rainbow-Parenthesis'
Plugin 'matchit.zip' " Better support of % jumping
Plugin 'tpope/vim-repeat' "Support repetition of macros
Plugin 'tpope/vim-vinegar' "Enhance netrw
Plugin 'itchyny/lightline.vim'
"" Auto Completion/Less Typing
Plugin 'comments.vim'
Plugin 'Raimondi/delimitMate'
Plugin 'xptemplate'
"Plugin 'derekprior/vim-trimmer'
Plugin 'UltiSnips'
Plugin 'tpope/vim-surround'
" Snippet collections
Plugin 'tommorris/scala-vim-snippets'
Plugin 'honza/vim-snippets'
"" Language/Syntax Plugins
Plugin 'fatih/vim-go'
Plugin 'coffee.vim'
Plugin 'vim-coffee-script'
Plugin 'derekwyatt/vim-scala'
Plugin 'Syntastic' " Syntax Checker
Plugin 'ensime/ensime-vim' "extensive scala integration"
Plugin 'mxw/vim-jsx'
""" Productivity
"Plugin 'journal.vim'
"" Misc. Unknown
Plugin 'severin-lemaignan/vim-minimap'
Plugin 'goyo.vim'
"Plugin 'koron/minimap-vim'
Plugin 'pydave/AsyncCommand' "Requirement for pomodoro
Plugin 'mnick/vim-pomodoro'
"Plugin 'mattn/calendar.vim'
Plugin 'itchyny/calendar.vim'
Plugin 'vim-scripts/gnupg.vim'
Plugin 'yuratomo/gmail.vim'
Plugin 'Shougo/vimproc'
"Plugin 'jmcantrell/vim-journal'
Plugin 'edthedev/minion'
Plugin 'darfink/vim-plist'
" Zotero plugin
Plugin 'Shougo/unite.vim'
Plugin 'rafaqz/citation.vim'
call vundle#end()
" let Vundle manage Vundle
" and don't put the comment on the same line
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General behavior
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"colorscheme blue
"colorscheme coffee
"colorscheme darkblue
colorscheme default "GOOD
"colorscheme delek
"colorscheme desert
"colorscheme elflord
"colorscheme evening NICE
"colorscheme koehler
"colorscheme morning NICE
"colorscheme murphy
"colorscheme pablo
"colorscheme peachpuff
"colorscheme ron
"colorscheme shine
"colorscheme slate
"colorscheme torte
"colorscheme zellner
set autowrite " Speichert bei jedem :make, ;next, :rewind etc.
set autoread
if match($TERM, "screen")!=-1
set term=xterm
endif
set title " Set buffer name as terminal name
" Schaltet syntax-highlighting und korrektes Einrücken an
" und filetype spezifisches ein
syntax on
filetype plugin indent on
" Vermeidet Probleme beim pasten aus dem Browser
" Disable by default to make delimitMate work
" set paste
" Stellt die Dateinamenerweiterung wie unter bash ein
set wildmode=longest,list
" Der Zeiger springt kurz zur öffnenden Klammer, wenn die schließende
" eingegeben wird
set showmatch
set matchtime=1 " In diesem Fall 1/10 sek.
set autoindent " automatic and smart indentation
set smartindent
set copyindent
" Die Einrückweite pro Level
set shiftwidth=4
" Ein Tab wird wie 4 Leerzeichen angezeigt und dank expandtab werden tabs
" gleich als Leerzeichen eingefügt.
set tabstop=4
set expandtab
set softtabstop=4
set smarttab
" Setzt die maximale Textbreite von Fließtext
"set linebreak
set textwidth=66
" highlight lines that are to long
" highlight OverLength ctermbg=red ctermfg=white guibg=#592929
" match OverLength /\%79v.\+/
" Wenn mit /suchwort gesucht wird, springt der Zeiger schon beim Eintippen
set incsearch
"Sucht standardmäßig ohne Groß- und Kleinschreibung zu unterscheiden
set ignorecase
"Blendet Zeileninformation ein
set ruler
"Blendet Formatierungszeichen ein
set lcs=tab:>-,trail:-,nbsp:~
set nolist
"Faltet automatisch neue Dateien nach Einrückung ein
set foldmethod=indent
"set foldcolumn=8
set foldlevel=8
set showcmd " Display an incomplete command in the lower right corner of the Vim window
set mouse-=a " Disable mouse
set mousehide " Hide mouse after chars typed
set scrolloff=3 "Always keep at least 3 lines around the cursor
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Keyboard short cuts
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" change the mapleader from \ to ,
let mapleader=","
"let mapleader=" "
" Show trailing characters and such
map <leader>st :tet list<CR>
map <leader>sr /\(\<\S\+\>\)\(\_\s\+\<\1\>\)\+<CR>
" Quickly edit/reload the vimrc file
nmap <silent> <leader>oc :e $MYVIMRC<CR>
nmap <silent> <leader>rc :so $MYVIMRC<CR>
nmap <silent> <leader>ob :e ~/.bashrc<CR>
nmap <silent> <leader>rb :!hash -r && source ~/.bashrc<CR>
nmap <leader>h :help<space>
" Vundle/Bundle short cuts
nmap <leader>bs :BundleSearch<space>
nmap <silent> <leader>bi :BundleInstall<CR>
nmap <silent> <leader>bu :BundleUpdate<CR>
" Short cut for hypergit
nmap <leader>g :Gmail<CR>
nmap <leader>gs :Gstatus<CR>
nmap <leader>gd :Gdiff<CR>
nmap <leader>gc :Gcommit<CR>
" Short cut for Goyo, close w/ <leader>q
nmap <leader>y :Goyo<CR> " Enter distraction free mode
" Save files, close vim
map <leader>w :w<CR>
map <leader>x :x<CR>
map <leader>q :q!<CR>
nmap <silent><leader>c :SyntasticCheck<CR>
" Open netrw explore in write mode
nmap <leader>v :Vex<CR>
" Simplify saving and closing of files
"map <F5> :silent execute "!pdflatex % > /dev/null && xpdf -remote paper -reload > /dev/null &"<CR>ggG<C-o><C-o>
map <F5> :!%<CR>
map <F8> :w<CR>
map <F10> :x<CR>
" Spellcheck, ignore tex comments
map <F7> :SyntasticCheck<CR>
map <F9> :set spell<CR>
let g:tex_comment_nospell=1
" Short cuts for ConqueTerm shell
map <leader>sh :set splitbelow<CR>:new<CR>:resize 10<CR>:ConqueTerm bash<CR>
map <leader>py :set splitbelow<CR>:new<CR>:resize 10<CR>:ConqueTerm python<CR>
map <leader>sc :set splitbelow<CR>:new<CR>:resize 10<CR>:ConqueTerm scala<CR>
map <leader>rb :set splitbelow<CR>:new<CR>:resize 10<CR>:ConqueTerm irb<CR>
" open MRU menu
nnoremap <leader>m :MRU<CR>
" NERDtree on <leader>t
nnoremap <leader>t :NERDTree<CR>
nmap <leader>cd :Calendar -view=day<CR>
nmap <leader>cm :Calendar -view=month<CR>
nmap <leader>cw :Calendar -view=week<CR>
nmap <leader>cy :Calendar -view=year<CR>
nmap <leader>cc :Calendar -view=clock<CR>
nmap <leader>j :Calendar -view=week<CR>
" remove trailing whitespace
map <leader>rt :%s/\s\+$//<CR>
map <leader>sp :set paste<CR>
map <leader>fl a.format(**locals())<ESC>
map <leader>up i#!/usr/bin/env python<CR><CR>if __name__ == '__main__':<CR>
map <leader>um i#!/usr/bin/env python<CR><CR>def main():<CR> pass<CR><CR>if __name__ == '__main__':<CR> main()<ESC>
map <leader>in iif __name__ == '__main__':<CR>
" open FuzzyFinder
map <leader>ff :FufFile<CR>
" Have NERDTree alway open in the current folder
set autochdir
let NERDTreeChDirMode=2
" Setzt die Ergebnisse einer Stringsuche immer in die Mitte des Bildschirms
nmap n nzzzv
nmap N Nzzzv
nmap * *zzzv
nmap # #zzzv
nmap g* g*zzzv
nmap g# g#zzzv
" Indent the whole file using --
fun! BenIndent()
let oldLine=line('.')
normal(gg=G)
execute ':' . oldLine
endfun
map -- :call BenIndent()<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Language specific behavior
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fortran
" Fixes 'bug' in wrong form recognition
let fortran_free_source=1
let fortran_fold=1
"autocmd FileType fortran compiler ifort
" Java Spezifisches
let java_highlight_all=1
let java_highlight_functions="style"
let java_allow_cpp_keywords=1
" LaTeX Spezifisches
"set iskeyword+=:
"let g:Tex_Env_theorem "\\pspicture(0,0)(,)(,)\<CR>\<CR>\\endpspicture"
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_CompileRule='latex --interaction=nonstopmode $*'
let g:Tex_CompileRule_ps='dvips -q -Ppdf -o $*.ps $*.dvi'
let g:Tex_CompileRule_pdf='ps2pdf $*.ps'
let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf'
let g:Tex_IgnoredWarnings=' \"Underfull\n".
\"Overfull\n".
\"specifier changed to\n".
\"You have requested\n".
\"Missing number, treated as zero.\n".
\"There were undefined references\n".
\"Citation %.%# undefined\n"
\"Unused global option"'
autocmd Filetype html,xml,xsl source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
autocmd BufRead,BufNewFile *.scala set filetype=scala
autocmd BufRead,BufNewFile *.sc set filetype=scala
""Enables OmniComplete Toggeling with only Ctrl-n
"set complete-=k complete+=k
let NERDTreeIgnore=['\~$', '\.pyc$', '\.pyo$', '\.class$', 'pip-log\.txt$', '\.o$']
nnoremap <tab> <c-p>
" Function to automagically increase number of marked column
fun! Incr()
let l = line(".")
let c = virtcol("'<")
let l1 = line("'<")
let l2 = line("'>")
if l1 > l2
let a = l - l2
else
let a = l - l1
endif
if a != 0
exe 'normal '.c.'|'
exe 'normal '.a."\<c-a>"
endif
normal `<
endfunction
vnoremap <c-a> :call Incr()<CR>
"jump to last position when reopen
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin specific behavior
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" OmniCompletion
"Omni Completion für alle möglichen sprachen einschalten
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
"autocmd FileType php set omnifunc=phpcomplete#CompletePHP
"autocmd FileType c set omnifunc=ccomplete#Complete
let g:SuperTabDefaultCompletionType = "context"
set completeopt=menuone,longest,preview
" for Goerz' sendToScreen gimmick
autocmd BufNewFile,BufRead *.py let b:sendToProgramMode="ipython"
let b:sendToProgramName="~/.vim/scripts/send2screen.py -S ipy1 "
" settings for pydiction (Python tab completion) plugin)
let g:pydiction_location="~/.vim/ftplugin/pydiction/complete-dict"
let g:pydiction_menu_height=20
let g:tex_flavor='latex'
"" for Go
"filetype off
"filetype plugin indent off
"set runtimepath += "/usr/local/go/misc/vim"
"filetype plugin indent on
"syntax on
let g:instant_markdown_slow = 1
" allow for better search and replace
vnoremap <silent> s //e<C-r>=&selection=='exclusive'?'+1':''<CR><CR>
\:<C-u>call histdel('search',-1)<Bar>let @/=histget('search',-1)<CR>gv
omap s :normal vs<CR>
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
" Open number per default on open
call NumberToggle()
" Run flake8 with F7, ignore certain errors
let g:flake8_ignore="E501,W293"
" Syntastic settings
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 = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_check_on_q = 0
let g:syntastic_check_on_w = 0
let g:syntastic_check_on_x = 0
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_python_flake8_args='--ignore=E501,E402'
let g:syntastic_mode_map = { 'mode': 'passive' }
let delimitMate_autoclose = 1
let delimitMate_expand_cr = 0
let delimitMate_expand_space = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Lightline settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:lightline = {
\ 'colorscheme': 'wombat',
\ }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pomodoro settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <leader>ps :PomodoroStart<CR>
" Duration of a pomodoro in minutes (default: 25)
let g:pomodoro_time_work = 25
" Duration of a break in minutes (default: 5)
let g:pomodoro_time_slack = 5
" Log completed pomodoros, 0 = False, 1 = True (default: 0)
let g:pomodoro_do_log = 0
" Path to the pomodoro log file (default: /tmp/pomodoro.log)
let g:pomodoro_log_file = "/tmp/pomodoro.log"
" Vim Calender configuration
let g:calendar_frame = 'default'
let g:calendar_google_calendar = 1
let g:calendar_google_task = 1
let g:calendar_task = 1
let g:calendar_task_delete = 1
let g:calendar_yank_deleting = 1
" Handy abbreviations
iabbrev @- mjhoffmann@gmail.com
iabbrev date- <c-r>=strftime("%F")<CR>
" Minion Shortcuts
nmap <leader>mn :MinionNote<space>
nmap <leader>mo :MinionOpen<space>
" Minimap shortcuts
"let g:minimap_highlight='Visual'
nmap <leader>ms :Minimap<CR>
nmap <leader>mc :MinimapClose<CR>
" Zotero plugin settings
nmap <space> [unite]
nnoremap [unite] <nop>
let g:citation_vim_zotero_folder=["/Users/maxjh/Library/Application Support/Zotero/Profiles/y9hwubw4.default/zotero"]
let g:citation_vim_bibtex_file="/Users/maxjh/stanford/My Library.bib"
let g:citation_vim_mode="zotero"
let g:citation_vim_collection = "My Library"
let g:citation_vim_cache_path='~/.vim/cache_path'
let g:citation_vim_outer_prefix="["
let g:citation_vim_inner_prefix="@"
let g:citation_vim_suffix="]"
nnoremap <silent><leader>zk :<C-u>Unite -buffer-name=citation -start-insert -default-action=append citation/key<cr>
nnoremap <silent><leader>za :<C-u>Unite -buffer-name=citation -start-insert -default-action=append citation/author<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment