Skip to content

Instantly share code, notes, and snippets.

@danbruegge
Last active July 26, 2016 20:22
Show Gist options
  • Save danbruegge/9803110 to your computer and use it in GitHub Desktop.
Save danbruegge/9803110 to your computer and use it in GitHub Desktop.
" vim:fdm=marker
"
" =============================================================================
" vim-plug {{{
" =============================================================================
call plug#begin('~/.vim/bundle')
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.sh
endif
endfunction
Plug 'tomasr/molokai'
Plug 'chriskempson/base16-vim'
Plug 'vim-scripts/loremipsum'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tmhedberg/matchit'
Plug 'bling/vim-airline'
Plug 'scrooloose/syntastic'
Plug 'tomtom/tlib_vim'
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
Plug 'kien/ctrlp.vim', { 'on': 'CtrlP' }
Plug 'garbas/vim-snipmate', { 'on': ['<Plug>snipMateNextOrTrigger', 'snipMateNextOrTrigger'] }
" Plug 'garbas/vim-snipmate'
Plug 'lervag/vim-latex', { 'for': ['plaintex', 'latextoc', 'tex'] }
Plug 'plasticboy/vim-markdown', { 'for': 'mkd' }
Plug 'mattn/emmet-vim', { 'for': ['xhtml', 'html', 'css', 'less'] }
Plug 'groenewege/vim-less', { 'for': 'less' }
Plug 'jdonaldson/vaxe', { 'for': 'haxe' }
Plug 'ntpeters/vim-better-whitespace'
Plug 'mileszs/ack.vim'
call plug#end()
" }}}
" =============================================================================
" vim common {{{
" =============================================================================
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
" filetype stuff
filetype on
filetype plugin on
filetype indent on
" syntax highlighting for vim
syntax on
" hide a unsaved buffer, so you can open a new buffer with :e
set hidden
" don't update the display while executing macors
set lazyredraw
" Keep some stuff in the history
set history=100
" When the page starts to scroll, keep the cursor 8 lines from the top and
" 8 lines from the bottom
set scrolloff=8
" Allow the cursor to go in to 'invalid' places
"set virtualedit=all
" Better command-line completion
set wildmenu
set wildignore+=*.dll,*.o,*.pyc,*.pyo,*.bak,*.exe,*.jpg,*.jpeg,*.png,*.gif
set wildignore+=*$py.class,*.class,*/*.dSYM/*,*.dylib,*.DAT
" When completing by tag, show the whole tag, not just the funtion name
set showfulltag
set encoding=utf-8
" move backup files to ~/.vim/sessions
set backupdir=~/.vim/sessions
set dir=~/.vim/sessions
set background=dark
" set terminal colors
set t_Co=256
" colorscheme molokai
colorscheme base16-default
set completeopt=longest,menuone
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see
" the mapping of <C-L> below)
set hlsearch
" show search matches on type
set incsearch
" set the search scan to wrap lines
set wrapscan
" tabbing stuff
set tabstop=8
set expandtab
set smarttab
set shiftwidth=4
set softtabstop=4
" indenting
set autoindent
set smartindent
set cindent
" line numbers
set number
" relative to the current line
" set relativenumber
" set and display line ending
set ruler
set textwidth=0 " prevent line break at the end of the line
set wrapmargin=0
set colorcolumn=80
" Dont highlight lines after 2048 chracters
set synmaxcol=2048
" a long line is just a long line
set nowrap
" Automatically read a file that has changed on disk
set autoread
" display/highlight current line
set cursorline
" Set the status line the way derek wyatt likes it
"set stl=%f\ %m\ %r%{fugitive#statusline()}\ Line:%l/%L[%p%%]\ Col:%v\ Buf:#%n\ [%b][0x%B]
" Always display the status line
set laststatus=2
" Set the command window height to 2 lines, to avoid many cases of having
" to press <Enter> to continue"
set cmdheight=2
" change options
set cpoptions+=$ " usefull when using `cw`. Adds a $ to the end of word
" less with css
autocmd BufNewFile,BufRead *.less set filetype=less.css
" the stuff at the end of a file, to tell vim some options. For example:
" # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
set modeline
" System default for mappings
" let mapleader="\<Space>"
let mapleader=","
" Solve the snipmate issue?
set nopaste
" Open the help window on the Vertical Left side
autocmd FileType help wincmd L
autocmd FileType h wincmd L
" }}}
" =============================================================================
" Working with split windows {{{
" =============================================================================
" Open a new vertical split and switch over to it
" nnoremap <leader>w <C-w>v<C-w>l
" Open a new empty vertical split and switch over to it
nnoremap <leader>n <C-w>n<C-w>L
" Makes jumping between splited windows easier
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" }}}
" =============================================================================
" Simple key mappings, that are time saver {{{
" =============================================================================
" imap -----------------------------------------------------------------------
" Add alternative for <Esc> in insert mode
imap jj <Esc>
" paste from system clipboard
imap <leader>p <C-r>*
" vmap -----------------------------------------------------------------------
" Simple sort lines
vmap <leader>s :sort<cr>
" copy to system clipboard
vmap <leader>y "+y
" nmap -----------------------------------------------------------------------
" Add new line on current position with <CTRL><ENTER>
nmap <c-cr> i<cr><Esc>
" force filetype to html on keystroke...fix my snipmate problem in html
" files with django/jinja stuff
nmap <leader>h :set ft=html<cr>
nmap <leader>1 :w !wc -w<cr>
" nnoremap -------------------------------------------------------------------
" Save file
nnoremap <leader>w :w<cr>
" Open file
nnoremap <leader>o :CtrlP<cr>
" disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
nnoremap <leader>m :w <BAR> !lessc % > %:t:r.css<CR><space>
nnoremap <c-c> :bp\|bd #<cr>
" }}}
" =============================================================================
" Spellchecking {{{
" =============================================================================
au BufNewFile,BufRead,BufEnter *.wiki setlocal spell spelllang=de_de
au BufNewFile,BufRead,BufEnter *.md setlocal spell spelllang=de_de
au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=de_de
au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=de_de
au BufNewFile,BufRead,BufEnter README setlocal spell spelllang=en_us
" }}}
" =============================================================================
" Markdown settings {{{
" =============================================================================
" Don't fold the first 2 levels
let g:vim_markdown_initial_foldlevel=6
" }}}
" =============================================================================
" Emmet settings {{{
" =============================================================================
"enable all function in all mode.
let g:user_emmet_mode='a'
" simpler key stroke for <c-y>,
" imap <leader>e <c-y>,
" }}}
" =============================================================================
" Syntastic stuff {{{
" =============================================================================
nmap <F8> :SyntasticCheck<cr>
" Dont check on save
let g:syntastic_mode_map = { 'mode': 'passive' }
" Args for checkers
let g:syntastic_javascript_jslint_args='--config ~/.jshintrc'
" Standard checker for python
let g:syntastic_python_checkers=['flake8', 'python']
" Standard checker for javascript
let g:syntastic_javascript_checkers=['jshint']
" }}}
" =============================================================================
" Clean up html {{{
" =============================================================================
vmap <F7> :!tidy -q -i --show-errors 0<cr>
" }}}
" =============================================================================
" Airline stuff {{{
" =============================================================================
let g:airline_theme = 'tomorrow'
let g:airline_enable_syntastic = 1
let g:airline_left_sep = ' '
let g:airline_right_sep = ' '
let g:airline#extensions#whitespace#checks = []
" }}}
" =============================================================================
" SnipMate stuff {{{
" =============================================================================
imap <c-tab> <esc>a<Plug>snipMateNextOrTrigger
smap <c-tab> <Plug>snipMateNextOrTrigger
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment