Skip to content

Instantly share code, notes, and snippets.

@zimbatm
Created April 8, 2015 22:13
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 zimbatm/200affe170cff2fec204 to your computer and use it in GitHub Desktop.
Save zimbatm/200affe170cff2fec204 to your computer and use it in GitHub Desktop.
""" Settings
"" Global
set nocompatible
set encoding=utf-8
"" Plugged
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'Shougo/neocomplete.vim'
Plug 'Shougo/unite.vim'
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'Shougo/vimshell.vim'
Plug 'altercation/vim-colors-solarized'
Plug 'bling/vim-airline'
Plug 'bronson/vim-trailing-whitespace'
Plug 'editorconfig/editorconfig-vim'
Plug 'godlygeek/tabular'
Plug 'justinmk/vim-sneak'
Plug 'juvenn/mustache.vim'
Plug 'kana/vim-narrow'
Plug 'kana/vim-textobj-user'
Plug 'kien/ctrlp.vim'
Plug 'leafgarland/typescript-vim'
Plug 'mattn/gist-vim'
Plug 'mbbill/undotree'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'rking/ag.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'sickill/vim-pasta'
Plug 'sjl/vitality.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'vim-scripts/DirDiff.vim'
Plug 'vim-scripts/IndexedSearch'
Plug 'vim-scripts/bufexplorer.zip'
Plug 'vim-scripts/bufkill.vim'
Plug 'vim-scripts/buftabs'
Plug 'vim-scripts/gitignore'
Plug 'vim-scripts/matchit.zip'
Plug 'zimbatm/direnv.vim'
" Plug 'eagletmt/ghcmod-vim', { 'for': 'haskell' }
" Plug 'eagletmt/neco-ghc', { 'for': 'haskell' }
" Plug 'raichoo/haskell-vim', { 'for': 'haskell' }
" Plug 'vim-scripts/python.vim--Vasiliev', { 'for': 'python' }
Plug 'dag/vim2hs', { 'for': 'haskell' }
Plug 'jnwhiteh/vim-golang', { 'for': 'go' }
Plug 'slim-template/vim-slim', { 'for': 'slim' }
Plug 'tpope/vim-markdown', { 'for': 'markdown' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'vim-scripts/VimClojure', { 'for': 'clojure' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'othree/html5.vim', { 'for': 'html' }
call plug#end()
" Status line
" Set the command section height to 2 lines. Useful if notices (like syntastic) are shown on command lines
set cmdheight=2
" Already taken care of by powerline
set noshowmode
" TMP
set nobackup "VCS already does that
set nowritebackup
set noswapfile
set autowrite " automatically write a buffer when leaving
set autowriteall " automatically write a buffer when editing
set hidden " don't annoy me with unsaved buffers
if has("persistent_undo")
set undodir='~/.vim/undo/'
set undofile
endif
" Search
set hlsearch
"set ignorecase
set smartcase
" Whitespace stuff
set wrap
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
"set nosmarttab
set textwidth=78
set colorcolumn=+0
"set list listchars=tab:\ \ ,trail:·
set list listchars=tab:»·,trail:·
" http://vim.wikia.com/wiki/Highlight_unwanted_spaces
" tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,.direnv
" disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
"set complete=.,w,b
" Instead of failing command, present dialog if unsaved changes
set confirm
" Use modeline overrides
set modeline
"set modelines=0
" Disable folding
set nofoldenable
" Unix/emacs key bindings
inoremap <C-a> <c-o>0
inoremap <C-e> <c-o>$
inoremap <C-k> <esc>Da
cnoremap <C-a> <Home>
cnoremap <C-b> <Left>
nnoremap <C-a> 0
nnoremap <C-e> $
nnoremap <C-k> D
" <C-u> erase current line: works
" <C-k> erase until end of like: works
" <C-w> erase word before: works
" Write the file as sudoer
cmap w!! w !sudo tee % >/dev/null
"" Make windows well-sized. Borrowed from GRB. Not sure if liking.
"set winwidth=80
" We have to have a winheight bigger than we want to set winminheight. But if
" we set winheight to be huge before winminheight, the winminheight set will
" fail. (therealadam)
"set winheight=10
"set winminheight=10
"set winheight=999
" GUI
"set mouse=a
set t_Co=256
colorscheme solarized
set background=dark
"colorscheme desert256
"colorscheme Tomorrow-Night
if has("gui_running")
"colorscheme solarized
"set background=light
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar
set fuoptions=maxvert,maxhorz
map <D-Enter> :set invfullscreen<Enter>
" map <D-z> u
" map <D-shift-z> <C-r>
map <D-1> <ESC>1gt
map <D-2> <ESC>2gt
map <D-3> <ESC>3gt
map <D-4> <ESC>4gt
map <D-5> <ESC>5gt
map <D-6> <ESC>6gt
map <D-7> <ESC>7gt
map <D-8> <ESC>8gt
map <D-9> <ESC>9gt
"autocmd vimenter * NERDTree
if has("macunix")
"TODO: https://github.com/carlhuda/janus/blob/master/gvimrc
"set guifont=Terminal
set guifont=Monaco:h13
map <S-Insert> "*p
" Command-Shift-F for Ack
"map <D-F> :Ack<space>
"map <D-f> /
elseif has("unix")
set guifont=Monospace\ 10
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
elseif has("win32")
" ...
endif
endif
if has("autocmd")
function! s:setupWrapping()
set wrap
set wrapmargin=2
set textwidth=78
endfunction
" make and python use real tabs
autocmd FileType asciidoc call s:setupWrapping()
autocmd FileType go set noexpandtab
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
autocmd FileType jinja2 set noexpandtab
autocmd FileType jinja2 set tabstop=4
autocmd FileType make set noexpandtab
autocmd FileType markdown call s:setupWrapping()
autocmd FileType python set expandtab
autocmd FileType python set shiftwidth=4
autocmd FileType python set softtabstop=4
autocmd FileType python set tabstop=8
autocmd FileType python set tags+=$HOME/.vim/tags/python.ctags
autocmd FileType text call s:setupWrapping()
autocmd BufRead,BufNewFile *.jinja2 set filetype=jinja2
autocmd BufRead,BufNewFile *.adoc set filetype=asciidoc
" 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).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Source the vimrc file after saving it
"autocmd bufwritepost .vimrc source %
endif
" Commands
com! Sh VimShell
com! CD lcd %:p:h
" Stupid shift key fixes
com! W w
com! WQ wq
com! Wq wq
com! Q q
" Mappings
" Disable last search highlight
map <Space> :noh<cr>
" Plugin settings
let g:vimclojure#HighlightBuiltins = 1
let g:vimclojure#ParenRainbow = 1
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:sneak#streak = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment