Skip to content

Instantly share code, notes, and snippets.

@wrpaape
Created June 6, 2017 17:53
Show Gist options
  • Save wrpaape/a49ab8172ea32e79f8d0b357fe4aaf44 to your computer and use it in GitHub Desktop.
Save wrpaape/a49ab8172ea32e79f8d0b357fe4aaf44 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'kana/vim-metarw'
Plugin 'mattn/webapi-vim'
Plugin 'SirVer/ultisnips'
Plugin 'luochen1990/rainbow'
Plugin 'mattn/gist-vim'
Plugin 'marutha/vim-erlang-skeletons'
Plugin 'jmahler/hla.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'pboettch/vim-cmake-syntax'
" Plugin 'nickhutchinson/vim-cmake-syntax'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-surround'
call vundle#end() " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just
" :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to
" auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
"
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2008 Dec 17
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
call plug#begin('~/.vim/plugged')
Plug 'elixir-lang/vim-elixir'
" Plug 'vim-erlang/vim-erlang-runtime'
" Plug 'jimenezrick/vimerl'
call plug#end()
execute pathogen#infect()
colorscheme koehler
set nrformats=
set cursorline
set cursorcolumn
highlight CursorLine cterm=NONE ctermbg=238 ctermfg=NONE guibg=black guifg=NONE
highlight CursorColumn cterm=NONE ctermbg=238 ctermfg=NONE guibg=black guifg=NONE
" set shellcmdflag=-ic
set shell=/bin/zsh
set number
set history=200
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
filetype plugin on
set omnifunc=syntaxcomplete#Complete
map <Leader>p o<Bar>><Space>
"Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-k>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
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 g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
nnoremap <C-w>E :SyntasticCheck<CR> :SyntasticToggleMode<CR>
set t_Co=256
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
"Okays .ycm_extra_conf.py
let g:ycm_global_ycm_extra_conf = '~/my_projects/c/.ycm_extra_conf.py'
"turns off YCM diagnostic highlighting
let g:ycm_show_diagnostics_ui = 0
let g:ycm_enable_diagnostic_signs = 0
let g:ycm_enable_diagnostic_highlighting = 0
"turns off YCM preview popups
set completeopt-=preview
"ensure .c and .h files are detected as C instead of CPP
autocmd BufNewFile,BufReadPost *.c,*.h set filetype=c
"sets default indentation for filetypes
filetype plugin indent on
autocmd FileType cpp setlocal shiftwidth=4 tabstop=4 expandtab cino=(0
autocmd FileType cmake setlocal shiftwidth=4 tabstop=4 expandtab cino=(0
autocmd FileType make setlocal shiftwidth=8 tabstop=8 noexpandtab
autocmd FileType java setlocal shiftwidth=4 tabstop=4 cindent noexpandtab
autocmd FileType hla setlocal shiftwidth=4 tabstop=4 noexpandtab
autocmd FileType erlang setlocal shiftwidth=4 tabstop=4 expandtab
autocmd FileType javascript setlocal shiftwidth=4 tabstop=4 expandtab
autocmd FileType python setlocal shiftwidth=4 tabstop=4 expandtab
autocmd FileType sh setlocal shiftwidth=4 tabstop=4 expandtab
autocmd FileType xml setlocal shiftwidth=2 tabstop=2 expandtab
autocmd FileType lisp setlocal lisp
" Save your swp files to a less annoying place than the current directory.
" If you have .vim-swap in the current directory, it'll use that.
" Otherwise it saves it to ~/.vim/swap, ~/tmp or .
if isdirectory($HOME . '/.vim/swap') == 0
:silent !mkdir -p ~/.vim/swap >/dev/null 2>&1
endif
set directory=./.vim-swap//
set directory+=~/.vim/swap//
set directory+=.
if isdirectory($HOME . '/.vim/tmp') == 0
:silent !mkdir -p ~/.vim/tmp >/dev/null 2>&1
endif
" tilde temp files
set backupdir=./.vim-tmp//
set backupdir=~/.vim/tmp
set backupdir+=.
" viminfo stores the the state of your previous editing session
set viminfo+=n~/.vim/viminfo
if exists("+undofile")
" undofile - This allows you to use undos after exiting and restarting
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
" :help undo-persistence
" This is only present in 7.3+
if isdirectory($HOME . '/.vim/undo') == 0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=./.vim-undo//
set undodir+=~/.vim/undo//
set undofile
endif
" view c++ standard headers with correct FileType
au BufRead * if search('\M-*- C++ -*-', 'n', 1) | setlocal ft=cpp | endif
" treat <> as jumpable brackets
" set matchpairs+=<:>
" correct comments for cmake, cpp (vim-commentary)
au FileType cmake setlocal commentstring=#\ %s
au FileType cpp setlocal commentstring=//\ %s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment