Skip to content

Instantly share code, notes, and snippets.

@wkf
Created January 12, 2014 19:31
Show Gist options
  • Save wkf/8389288 to your computer and use it in GitHub Desktop.
Save wkf/8389288 to your computer and use it in GitHub Desktop.
My .vimrc
set nocompatible " be iMproved
set shell=/bin/bash
set backspace=indent,eol,start
if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
set t_Co=256
endif
set list
set listchars=tab:>-,trail:.,extends:#,nbsp:.
set hidden
set history=100 " Default history is only 20
set undolevels=100 " Use more levels of undo
set expandtab
set tabstop=2 " a tab is 2 spaces
set softtabstop=2 " tab size when insterting/pasting
set shiftwidth=2 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set nofoldenable " dont fold by default
set foldmethod=indent " fold based on indentation
set foldnestmax=10 " deepest fold is 10 levels
set foldlevel=1
set cursorline
set ruler " Ruler on
set nu " Line numbers on
set nobackup " dont use backupfile
set noswapfile
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp " store swap files here
syntax on " Enable syntax highlighting
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
set incsearch " show search matches as you type
set ignorecase " case insensitive search
set smartcase " If a capital letter is included in search, make it case-sensitive
set nohlsearch " dont highlight search results
set background=dark
set scrolloff=2
set visualbell " dont beep
set noerrorbells " dont beep
set laststatus=2
set autoread " Auto read when a file is changed on disk
"set paste
set nowrap
let mapleader=","
runtime ./theme/Tomorrow-Night-Eighties.vim
cmap w!! w !sudo tee % >/dev/null " allow saving a sudo file if forgot to open as sudo
autocmd! BufWrite * mark ' | silent! %s/\s\+$// | norm ''
autocmd BufRead,BufNewFile *.md setlocal spell spelllang=en_us
autocmd BufRead,BufNewFile *.txt setlocal spell spelllang=en_us
autocmd FileType gitcommit setlocal spell spelllang=en_us
autocmd BufRead,BufNewFile *.md setlocal textwidth=80
autocmd BufRead,BufNewFile *.txt setlocal textwidth=80
autocmd FileType gitcommit setlocal textwidth=80
filetype off " required!
set runtimepath+=~/Dropbox/Shared/Vim/bundle/neobundle.vim/
call neobundle#rc(expand('~/Dropbox/Shared/Vim/bundle/'))
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
" Recommended to install
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
"NeoBundle 'Valloric/YouCompleteMe' , {
"\ 'build' : {
"\ 'mac' : './install.sh --clang-completer',
"\ 'unix' : './install.sh --clang-completer --system-libclang'
"\ },
"\ }
NeoBundle 'bling/vim-airline'
NeoBundle 'Shougo/unite.vim'
"NeoBundle 'ujihisa/unite-colorscheme'
"NeoBundle 'ervandew/supertab'
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'jnwhiteh/vim-golang'
NeoBundle 'groenewege/vim-less'
NeoBundle 'othree/html5.vim'
NeoBundle 'plasticboy/vim-markdown'
NeoBundle 'puppetlabs/puppet-syntax-vim'
NeoBundle 'vim-scripts/scons.vim'
NeoBundle 'wavded/vim-stylus'
NeoBundle 'digitaltoad/vim-jade'
NeoBundle 'vim-ruby/vim-ruby'
NeoBundle 'dag/vim-fish'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'airblade/vim-gitgutter'
"NeoBundle 'sjl/gundo.vim'
"NeoBundle 'scrooloose/syntastic'
NeoBundle 'terryma/vim-multiple-cursors'
"NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'crooloose/nerdcommenter'
NeoBundle 'vim-scripts/sudo.vim'
NeoBundleCheck
""let g:airline_powerline_fonts = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Unite
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:unite_source_history_yank_enable = 1
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_source_rec_max_cache_files=5000
let g:unite_enable_start_insert = 1
"let g:unite_split_rule = "botright"
let g:unite_force_overwrite_statusline = 0
"let g:unite_winheight = 10
" Use ag for search
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '--nocolor --nogroup'
let g:unite_source_grep_recursive_opt = ''
let g:unite_source_rec_async_command='ag --nocolor --nogroup -g ""'
endif
" Use the fuzzy matcher for everything
call unite#filters#matcher_default#use(['matcher_fuzzy'])
" Use the rank sorter for everything
call unite#filters#sorter_default#use(['sorter_rank'])
nnoremap <leader>/ :Unite -buffer-name=grep -no-split grep:.<cr>
nnoremap <leader>y :Unite -buffer-name=yank -no-split history/yank<cr>
nnoremap <leader>t :Unite -buffer-name=file -no-split file_rec/async:!<cr>
nnoremap <leader>b :Unite -buffer-name=buffer -no-split buffer<cr>
nnoremap <leader>m :Unite -buffer-name=mru -no-split file_mru<cr>
nnoremap <leader>f :Unite -buffer-name=folder -no-split file<cr>
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
"let b:SuperTabDisabled=1
imap <buffer> <C-j> <Plug>(unite_select_next_line)
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
imap <silent><buffer><expr> <C-h> unite#do_action('split')
imap <silent><buffer><expr> <C-v> unite#do_action('vsplit')
imap <silent><buffer><expr> <C-t> unite#do_action('tabopen')
nmap <buffer> <ESC>OA k
nmap <buffer> <ESC>OB j
nmap <buffer> <ESC>OC l
nmap <buffer> <ESC>OD h
nmap <buffer> <ESC> <Plug>(unite_exit)
endfunction
autocmd VimEnter * call s:on_vim_enter()
function! s:on_vim_enter()
let l:dir = expand("<amatch>")
if l:dir == ''
Unite -buffer-name=mru -no-split file_mru
elseif isdirectory(l:dir)
Unite -buffer-name=folder -no-split file
endif
endfunction
filetype plugin indent on " required!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment