Skip to content

Instantly share code, notes, and snippets.

@saevarb
Last active August 29, 2015 14:06
Show Gist options
  • Save saevarb/18d0111acd7309ed5dfd to your computer and use it in GitHub Desktop.
Save saevarb/18d0111acd7309ed5dfd to your computer and use it in GitHub Desktop.
" Autosave on focus lost
autocmd FocusLost * silent! :wa
" map leader to comma
let mapleader=","
" Change split navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Always show status bar(airline)
set laststatus=2
" Trying jj for <Esc>
imap jj <Esc>
" Map gt and gT to next/prev buffers instead of tabs
nmap gt :bnext<CR>
nmap gT :bprev<CR>
" Mapping Q (shift-q) to last used buffer
nmap Q :b#<CR>
" Map <Leader> x to close current buffer
nmap <Leader>x :bd<CR>
" Removing some GUI stuff
" should fix the empty space at the bottom
set guiheadroom=0
" Remove toolbars and scroll bar
set guioptions=aL
" Don't redraw while running macros
set lazyredraw
" Move to open instead of split
set switchbuf=useopen
" Show whitespace
set list
set list listchars=tab:>-,trail:.,extends:>
" Put swapfiles in ~/.vim/backup
set backupdir=~/.vim/backup
set directory=~/.vim/backup
" Expand tabs into spaces
set expandtab
set nocompatible
filetype off
" Auto indentation and smart indentation
set autoindent
" 4 space indent width
set tabstop=4
set softtabstop=4
set shiftwidth=4
set showmatch
" Edit anywhere
set virtualedit=all
" Allow mouse etc
set mouse=a
set smarttab
" Sexy font
"set guifont=Inconsolata\ Medium\ 12
set guifont=Mono\ One\ 10
set backspace=2
" Map C-Backspace to delete previous word
imap <C-BS> <C-W>
map <Leader>E :tabnew $MYVIMRC<CR>
map <Leader>S :source $MYVIMRC<CR>
syntax enable
" Set encoding to utf-8
set enc=utf-8
" Set colors to 256
set t_Co=256
" Numbered lines
set number
set relativenumber
" Incremental search
set incsearch
" Toggle hlsearch
map <Leader>s :set hlsearch!<CR>
" Keep cursor away from edges of screen
set so=5
" Automatically leave insert mode
au CursorHoldI * stopinsert
" auto linebreak after 76 chars
set tw=76
" Show last column(tw)
set colorcolumn=76
" Show cursorline
set cursorline
" Character to show at wrapped lines
let &showbreak='↪ '
filetype plugin indent on
" Make needs tabs, not spaces
autocmd FileType make setlocal noexpandtab
" EasyMotion leader key
" let g:EasyMotion_leader_key = ''
" Latex stuff
let g:LatexBox_latexmk_options="-pdf"
let g:LatexBox_viewer="evince"
let g:LatexBox_latexmk_preview_continuously=1
let g:LatexBox_latexmk_async=1
let g:LatexBox_quickfix=2
" --------------------------------------------------------------------------
" Haskell stuff
" --------------------------------------------------------------------------
" Sets default browser for haddock docs
let g:haddock_browser = 'google-chrome'
" Options make ghcmod not show those annoying warnings
let g:ghcmod_ghc_options = [ '-fno-warn-type-defaults', '-fno-warn-unused-imports', '-fno-warn-orphans' ]
" Makes ghcmod-vim check and lint on write
autocmd BufWritePost *.hs GhcModCheckAndLintAsync
" vim2hs
let g:haskell_conceal = 0
autocmd FileType haskell setlocal nofoldenable
autocmd FileType haskell map <F4> :%!stylish-haskell<CR>
"
" --------------------------------------------------------------------------
" Python stuff
" --------------------------------------------------------------------------
au! FileType python setl nosmartindent
au FileType python nmap <Leader>r :Dispatch ipython %<CR>
au FileTYpe python nmap <Leader>ar :Dispatch ipython %<Space>
" --------------------------------------------------------------------------
" YouCompleteMe
" --------------------------------------------------------------------------
let g:ycm_filetype_blacklist = {'text': 1}
" --------------------------------------------------------------------------
" CtrlP
" --------------------------------------------------------------------------
" let g:ctrlp_cmd = 'CtrlPBuffer'
let g:ctrlp_switch_buffer = 'Et'
let g:ctrlp_working_path_mode = 'ra'
" Wildignore for ctrlp
set wildignore=*.o,*.hi,*.class
" --------------------------------------------------------------------------
" gist-vim
" --------------------------------------------------------------------------
let g:gist_clip_command = 'xclip -selection clipboard'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_browser_command = 'google-chrome %URL%'
" --------------------------------------------------------------------------
" airline
" --------------------------------------------------------------------------
let g:airline#extensions#tabline#enabled = 1
" --------------------------------------------------------------------------
" Markdown
" --------------------------------------------------------------------------
au BufNewFile,BufRead *.md setf markdown
" --------------------------------------------------------------------------
" delimitMate
" --------------------------------------------------------------------------
let g:delimitMate_expand_cr = 2
" --------------------------------------------------------------------------
" dbext
" --------------------------------------------------------------------------
let g:dbext_default_profile_mysql_local="type=MYSQL:user=root:passwd=<REDACTED>:dbname=<REDACTED>"
" --------------------------------------------------------------------------
" Vundle stuff
" --------------------------------------------------------------------------
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" vim2hs
Bundle 'dag/vim2hs'
" Awesome autocompletion
Bundle 'Valloric/YouCompleteMe'
" Must for haskell in vim
Bundle 'eagletmt/ghcmod-vim'
" Required for ghcmod-vim IIRC
Bundle 'Shougo/vimproc'
" Awesome for syntax checking
Bundle 'scrooloose/syntastic'
" Commenting
Bundle 'scrooloose/nerdcommenter'
" Color scheme for vim
Bundle 'jnurmine/Zenburn'
" Color scheme for vim
Bundle 'altercation/vim-colors-solarized.git'
" Fuzzy file finder
Bundle 'kien/ctrlp.vim'
" Easy go-to-word stuff
Bundle 'Lokaltog/vim-easymotion.git'
" Easy surround of text objects
Bundle 'tpope/vim-surround.git'
" awesome for latex
Bundle 'LaTeX-Box-Team/LaTeX-Box'
" awesome for aligning stuff
Bundle 'godlygeek/tabular'
" vim gist
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
" Powerline!
" Bundle 'Lokaltog/powerline'
Bundle 'bling/vim-airline'
" Exchange words
Bundle 'tommcdo/vim-exchange'
" More text objects
Bundle 'wellle/targets.vim'
" Auto bracket completion
Bundle 'Raimondi/delimitMate'
" Snippets!
Bundle 'SirVer/UltiSnips'
Bundle 'honza/vim-snippets'
Bundle 'tpope/vim-fugitive'
Bundle 'raichoo/haskell-vim'
Bundle 'tpope/vim-dispatch'
Bundle 'vim-scripts/dbext.vim'
Bundle 'file:///home/identity/programming/python/chronos'
call vundle#end()
" Color
set background=dark
colors solarized
filetype plugin indent on
let g:airline_powerline_fonts=1
" --------------------------------------------------------------------------
" ultisnips
" --------------------------------------------------------------------------
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsExpandTrigger="<C-o>"
" Align on equals sign
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
" Align on first space
nmap <Leader>as :Tabularize /^[^ ]*\zs /<CR>
vmap <Leader>as :Tabularize /^[^ ]*\zs /<CR>
nmap <Leader>t :Tabularize /
vmap <Leader>t :Tabularize /
nmap <Leader>gst :Gstatus<CR>
nmap <Leader>gc :Gcommit<CR>
nmap <Leader>ge :Gedit<CR>
nmap <Leader>gd :Gdiff<CR>
nmap <Leader>ga :Gwrite<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment